Skip to content

Commit a28a042

Browse files
authored
perf: fetch url limit size;feat: new model and base64 decode tool (#205)
* perf: fetch url limit size * feat: new model and base64 decode tool
1 parent 195900e commit a28a042

File tree

22 files changed

+258
-138
lines changed

22 files changed

+258
-138
lines changed

bun.lock

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

modules/model/provider/DeepSeek/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,30 @@ const models: ProviderConfigType = {
3939
vision: false,
4040
reasoning: false,
4141
toolChoice: true
42+
},
43+
{
44+
type: ModelTypeEnum.llm,
45+
model: 'deepseek-v3.1-terminus',
46+
maxContext: 125000,
47+
maxTokens: 32000,
48+
quoteMaxToken: 120000,
49+
maxTemperature: 1,
50+
responseFormatList: ['text', 'json_object'],
51+
vision: false,
52+
reasoning: false,
53+
toolChoice: true
54+
},
55+
{
56+
type: ModelTypeEnum.llm,
57+
model: 'deepseek-v3.2-exp',
58+
maxContext: 125000,
59+
maxTokens: 32000,
60+
quoteMaxToken: 120000,
61+
maxTemperature: 1,
62+
responseFormatList: ['text', 'json_object'],
63+
vision: false,
64+
reasoning: false,
65+
toolChoice: true
4266
}
4367
]
4468
};

modules/model/provider/Moonshot/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ import { ModelTypeEnum, type ProviderConfigType } from '../../type';
33
const models: ProviderConfigType = {
44
provider: 'Moonshot',
55
list: [
6+
{
7+
type: ModelTypeEnum.llm,
8+
model: 'kimi-k2-turbo-preview',
9+
maxContext: 256000,
10+
maxTokens: 32000,
11+
quoteMaxToken: 250000,
12+
maxTemperature: 1,
13+
responseFormatList: ['text', 'json_object'],
14+
vision: false,
15+
reasoning: false,
16+
toolChoice: true
17+
},
618
{
719
type: ModelTypeEnum.llm,
820
model: 'kimi-k2-0905-preview',

modules/model/provider/Qwen/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ const models: ProviderConfigType = {
2626
reasoning: false,
2727
toolChoice: false
2828
},
29+
{
30+
type: ModelTypeEnum.llm,
31+
model: 'qwen3-max',
32+
maxContext: 1024000,
33+
maxTokens: 64000,
34+
quoteMaxToken: 1000000,
35+
maxTemperature: 1,
36+
responseFormatList: ['text', 'json_object'],
37+
vision: false,
38+
reasoning: false,
39+
toolChoice: true
40+
},
2941
{
3042
type: ModelTypeEnum.llm,
3143
model: 'qwen-plus',
@@ -230,6 +242,18 @@ const models: ProviderConfigType = {
230242
reasoning: false,
231243
toolChoice: false
232244
},
245+
{
246+
type: ModelTypeEnum.llm,
247+
model: 'qwen3-coder-plus',
248+
maxContext: 1024000,
249+
maxTokens: 64000,
250+
quoteMaxToken: 1000000,
251+
maxTemperature: 1,
252+
responseFormatList: ['text', 'json_object'],
253+
vision: false,
254+
reasoning: false,
255+
toolChoice: true
256+
},
233257
{
234258
type: ModelTypeEnum.llm,
235259
model: 'qwen2.5-7b-instruct',

modules/tool/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ export const uploadedTools: ToolType[] = [];
44
export const builtinTools: ToolType[] = [];
55

66
export const UploadToolsS3Path = 'system/tools';
7+
8+
export const serviceRequestMaxContentLength =
9+
Number(process.env.SERVICE_REQUEST_MAX_CONTENT_LENGTH || 5) * 1024 * 1024; // 5MB

modules/tool/packages/base64ToImage/config.ts renamed to modules/tool/packages/base64Decode/children/toImage/config.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export default defineTool({
99
},
1010
type: ToolTypeEnum.tools,
1111
description: {
12-
'zh-CN': '输入 Base64 编码的图片,输出图片可访问链接。',
13-
en: 'Enter a Base64-encoded image and get a directly accessible image link.'
12+
'zh-CN': ' Base64 编码的字符串转换为图片。',
13+
en: 'Enter a Base64-encoded string and get a image.'
1414
},
15-
toolDescription: 'Enter a Base64-encoded image and get a directly accessible image link.',
15+
toolDescription: 'Base64-encoded to image',
1616
versionList: [
1717
{
1818
value: '0.1.0',
@@ -30,19 +30,8 @@ export default defineTool({
3030
valueType: WorkflowIOValueTypeEnum.string,
3131
key: 'url',
3232
label: '图片 URL',
33-
description: '可访问的图片地址: http://example.com'
34-
},
35-
{
36-
valueType: WorkflowIOValueTypeEnum.string,
37-
key: 'type',
38-
label: 'MIME 类型',
39-
description: 'MIME 类型'
40-
},
41-
{
42-
valueType: WorkflowIOValueTypeEnum.number,
43-
key: 'size',
44-
label: '图片大小(B)',
45-
description: '图片大小(B)'
33+
description: '可访问的图片地址: http://example.com',
34+
required: true
4635
}
4736
]
4837
}

modules/tool/packages/base64ToImage/src/index.ts renamed to modules/tool/packages/base64Decode/children/toImage/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ export const InputType = z.object({
8080
});
8181

8282
export const OutputType = z.object({
83-
url: z.string(),
84-
type: z.string(),
85-
size: z.number()
83+
url: z.string()
8684
});
8785

8886
/**
@@ -99,6 +97,7 @@ export async function tool({
9997
return match[1];
10098
}
10199
const detectedType = detectImageMimeType(base64);
100+
102101
if (!detectedType) {
103102
throw new Error('Image Type unknown');
104103
}
@@ -116,8 +115,6 @@ export async function tool({
116115
const meta = await uploadFile({ base64, defaultFilename: filename });
117116

118117
return {
119-
url: meta.accessUrl,
120-
type: meta.contentType,
121-
size: meta.size
118+
url: meta.accessUrl
122119
};
123120
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { defineTool } from '@tool/type';
2+
import {
3+
FlowNodeInputTypeEnum,
4+
FlowNodeOutputTypeEnum,
5+
WorkflowIOValueTypeEnum
6+
} from '@tool/type/fastgpt';
7+
import { ToolTypeEnum } from '@tool/type/tool';
8+
9+
export default defineTool({
10+
name: {
11+
'zh-CN': 'Base64 转文本',
12+
en: 'Base64 to text'
13+
},
14+
type: ToolTypeEnum.tools,
15+
description: {
16+
'zh-CN': '将 Base64 编码的字符串转换为文本。',
17+
en: 'Enter a Base64-encoded string and get a text.'
18+
},
19+
toolDescription: 'Base64-encoded to text',
20+
versionList: [
21+
{
22+
value: '0.1.0',
23+
description: 'Default version',
24+
inputs: [
25+
{
26+
key: 'base64',
27+
label: 'Base64 字符串',
28+
renderTypeList: [FlowNodeInputTypeEnum.input, FlowNodeInputTypeEnum.reference],
29+
valueType: WorkflowIOValueTypeEnum.string
30+
}
31+
],
32+
outputs: [
33+
{
34+
valueType: WorkflowIOValueTypeEnum.string,
35+
key: 'text',
36+
label: '文本',
37+
required: true
38+
}
39+
]
40+
}
41+
]
42+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import config from './config';
2+
import { InputType, OutputType, tool as toolCb } from './src';
3+
import { exportTool } from '@tool/utils/tool';
4+
5+
export default exportTool({
6+
toolCb,
7+
InputType,
8+
OutputType,
9+
config
10+
});

0 commit comments

Comments
 (0)