Skip to content

Commit 2aaa248

Browse files
authored
New tool (#268)
* Install packages * fix: tag union field * qwen vl model * qwen model * update bun version * update bun version * update zod version * npm * zod v4 * zod version
1 parent fbd0b5d commit 2aaa248

File tree

118 files changed

+236
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+236
-224
lines changed

bun.lock

Lines changed: 46 additions & 37 deletions
Large diffs are not rendered by default.

lib/mongo/models/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type MongoPluginSchemaType = z.infer<typeof PluginZodSchema>;
1313

1414
const pluginMongooseSchema = new Schema({
1515
toolId: { type: String },
16-
type: { type: String, required: true, enum: Object.values(pluginTypeEnum.Enum) }
16+
type: { type: String, required: true, enum: Object.values(pluginTypeEnum.enum) }
1717
});
1818

1919
pluginMongooseSchema.index({ toolId: 1 }, { unique: true, sparse: true });

lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"@opentelemetry/sdk-logs": "^0.203.0",
1515
"@opentelemetry/sdk-metrics": "^2.0.1",
1616
"@scalar/express-api-reference": "^0.8.7",
17-
"@ts-rest/core": "^3.52.1",
17+
"@ts-rest/core": "3.52.1",
1818
"@ts-rest/express": "^3.52.1",
19-
"@ts-rest/open-api": "^3.52.1",
19+
"@ts-rest/open-api": "3.52.1",
2020
"@vercel/otel": "^1.9.2",
2121
"fs-extra": "^11.3.2",
2222
"jszip": "^3.10.1",

lib/redis/lock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import z from 'zod';
1+
import { z } from 'zod';
22
import { FASTGPT_REDIS_PREFIX, getGlobalRedisConnection } from '.';
33
export const lockEnum = z.enum(['parsePkg']);
44
const lockPrefix = `${FASTGPT_REDIS_PREFIX}LOCK:`;

lib/s3/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const PresignedUrlInputSchema = z.object({
44
filepath: z.string(),
55
filename: z.string(),
66
contentType: z.string().optional(),
7-
metadata: z.record(z.string()).optional(),
7+
metadata: z.record(z.string(), z.string()).optional(),
88
maxSize: z.number().optional().describe('B'),
99
fileExpireMins: z.number().optional()
1010
});

lib/worker/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import z from 'zod';
1+
import { z } from 'zod';
22
import { FileMetadataSchema, type FileMetadata } from '@/s3/config';
33
import { FileInputSchema } from '@/s3/type';
44
import { StreamDataSchema, ToolCallbackReturnSchema } from '@tool/type/req';

lib/worker/worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { setupProxy } from '../utils/setupProxy';
44
import { LoadToolsByFilename } from '@tool/utils';
55
import { getErrText } from '@tool/utils/err';
66
import { LoadToolsDev } from '@tool/loadToolDev';
7+
import type { ToolCallbackReturnSchemaType } from '@tool/type/req';
78

89
setupProxy();
910

@@ -45,7 +46,7 @@ parentPort?.on('message', async (params: Main2WorkerMessageType) => {
4546
};
4647

4748
// sendMessage is optinal
48-
const result = await tool.cb(data.inputs, {
49+
const result: ToolCallbackReturnSchemaType = await tool.cb(data.inputs, {
4950
systemVar: data.systemVar,
5051
streamResponse: sendMessage
5152
});

modules/model/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import z from 'zod';
1+
import { z } from 'zod';
22
import { c } from '@/contract/init';
33
import { type ListModelsType } from './api/type';
44
import { type I18nStringStrictType } from '@/type/i18n';

modules/model/provider/Qwen/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@ const models: ProviderConfigType = {
8888
stream: true
8989
}
9090
},
91+
{
92+
type: ModelTypeEnum.llm,
93+
model: 'qwen3-vl-flash',
94+
maxContext: 25000,
95+
maxTokens: 8000,
96+
quoteMaxToken: 20000,
97+
maxTemperature: 1,
98+
responseFormatList: ['text'],
99+
vision: true,
100+
reasoning: false,
101+
toolChoice: true
102+
},
103+
{
104+
type: ModelTypeEnum.llm,
105+
model: 'qwen3-vl-plus',
106+
maxContext: 25000,
107+
maxTokens: 8000,
108+
quoteMaxToken: 20000,
109+
maxTemperature: 1,
110+
responseFormatList: ['text'],
111+
vision: true,
112+
reasoning: false,
113+
toolChoice: true
114+
},
91115
{
92116
type: ModelTypeEnum.llm,
93117
model: 'qwen3-32b',

modules/model/type/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export const LLMModelItemSchema = PriceSchema.merge(BaseModelItemSchema).extend(
5050
useInEvaluation: z.boolean().optional(), // evaluation
5151

5252
defaultSystemChatPrompt: z.string().optional(),
53-
defaultConfig: z.record(z.any()).optional(),
54-
fieldMap: z.record(z.string()).optional()
53+
defaultConfig: z.record(z.string(), z.any()).optional(),
54+
fieldMap: z.record(z.string(), z.string()).optional()
5555
});
5656

5757
// Embedding 模型类型 schema
@@ -62,9 +62,9 @@ export const EmbeddingModelItemSchema = PriceSchema.merge(BaseModelItemSchema).e
6262
weight: z.number().optional(), // training weight
6363
hidden: z.boolean().optional(), // Disallow creation
6464
normalization: z.boolean().optional(), // normalization processing
65-
defaultConfig: z.record(z.any()).optional(), // post request config
66-
dbConfig: z.record(z.any()).optional(), // Custom parameters for storage
67-
queryConfig: z.record(z.any()).optional() // Custom parameters for query
65+
defaultConfig: z.record(z.string(), z.any()).optional(), // post request config
66+
dbConfig: z.record(z.string(), z.any()).optional(), // Custom parameters for storage
67+
queryConfig: z.record(z.string(), z.any()).optional() // Custom parameters for query
6868
});
6969

7070
// Rerank 模型类型 schema

0 commit comments

Comments
 (0)