Skip to content

Commit 58fbf78

Browse files
authored
perf: ai param config (#3451)
* perf: ai param config * pacakge import * perf: ai config doc
1 parent ae14906 commit 58fbf78

File tree

19 files changed

+287
-172
lines changed

19 files changed

+287
-172
lines changed

docSite/assets/imgs/image-51.png

246 KB
Loading

docSite/assets/imgs/image-52.png

146 KB
Loading

docSite/assets/imgs/image-53.png

136 KB
Loading

docSite/assets/imgs/image-54.png

150 KB
Loading

docSite/content/zh-cn/docs/guide/course/ai_settings.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ weight: 104
1111

1212
| | | |
1313
| --- | --- | --- |
14-
| ![](/imgs/aichat0.png) | ![](/imgs/aichat02.png) | ![](/imgs/aichat2.png) |
14+
| ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) |
1515

16-
## 返回AI内容(高级编排特有
16+
## 流响应(高级编排 AI 对话 特有
1717

18-
这是一个开关,打开的时候,当 AI 对话模块运行时,会将其输出的内容返回到浏览器(API响应);如果关闭,AI 输出的内容不会返回到浏览器,但是生成的内容仍可以通过【AI回复】进行输出。你可以将【AI回复】连接到其他模块中。
18+
旧版名字叫做:返回 AI 内容;新版改名:流响应。
19+
20+
这是一个开关,打开的时候,当 AI 对话模块运行时,会将其输出的内容返回到浏览器(API响应);
21+
如果关闭,会强制使用非流模式调用模型,并且 AI 输出的内容不会返回到浏览器,但是生成的内容仍可以通过【AI回复】进行输出。你可以将【AI回复】连接到其他模块中进行二次使用。
1922

2023
### 最大上下文
2124

@@ -33,13 +36,25 @@ weight: 104
3336

3437
最大回复 token 数量。注意,是回复的Tokens!不是上下文 tokens。
3538

39+
通常,回复上限=min(模型允许的最大回复上限, 最大上下文-已用上下文)
40+
41+
所以,一般配置模型时,不会把最大上下文配置成模型实际最大上下文,而是预留预定空间给回答,例如 128k 模型,可以配置 max_context=115000
42+
3643
### 系统提示词
3744

3845
被放置在上下文数组的最前面,role 为 system,用于引导模型。
3946

47+
### 最大对话轮数(仅简易模式)
48+
49+
可以配置模型支持的最大对话轮数,如果模型的超出上下文,系统会自动截断,尽可能保证不超模型上下文。
50+
51+
所以尽管配置 30 轮对话,实际运行时候,不一定会达到 30 轮。
52+
4053
## 引用模板 & 引用提示词
4154

42-
这两个参数与知识库问答场景相关,可以控制知识库相关的提示词。
55+
进行知识库搜索后,你可以自定义组织检索结果构成的提示词,这个配置,仅工作流中 AI 对话节点可用。并且,只会在有引用知识库内容时才会生效。
56+
57+
![alt text](/imgs/image-54.png)
4358

4459
### AI 对话消息组成
4560

packages/web/components/common/Image/PhotoView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useSystem } from '../../../hooks/useSystem';
66
import Loading from '../MyLoading';
77
import MyImage from './MyImage';
88

9-
const MyPhotoView = ({ ...props }: ImageProps) => {
9+
const MyPhotoView = (props: ImageProps) => {
1010
const { isPc } = useSystem();
1111

1212
return (
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React, { useMemo } from 'react';
2+
import { Slider, SliderTrack, SliderThumb, HStack, SliderMark } from '@chakra-ui/react';
3+
import MyNumberInput from '../Input/NumberInput';
4+
5+
const InputSlider = ({
6+
onChange,
7+
value,
8+
max = 100,
9+
min = 0,
10+
step = 1
11+
}: {
12+
value: number;
13+
onChange: (index: number) => void;
14+
max: number;
15+
min: number;
16+
step?: number;
17+
}) => {
18+
const markList = useMemo(() => {
19+
const valLen = max - min;
20+
return [
21+
valLen * 0.007 + min,
22+
valLen * 0.2 + min,
23+
valLen * 0.4 + min,
24+
valLen * 0.6 + min,
25+
valLen * 0.8 + min,
26+
valLen * 0.985 + min
27+
];
28+
}, []);
29+
30+
return (
31+
<HStack zIndex={10} spacing={3}>
32+
<Slider
33+
max={max}
34+
min={min}
35+
step={step}
36+
value={value}
37+
focusThumbOnChange={false}
38+
onChange={onChange}
39+
>
40+
<SliderTrack bg={'myGray.100'} h={'4px'} />
41+
{markList.map((val, i) => (
42+
<SliderMark
43+
key={i}
44+
value={val}
45+
w={'2px'}
46+
h={'2px'}
47+
bg={'#A4A4A4'}
48+
borderRadius={'2px'}
49+
opacity={0.4}
50+
transform={'translateY(-50%)'}
51+
/>
52+
))}
53+
<SliderThumb
54+
bg={'primary.500'}
55+
border={'4px solid'}
56+
borderColor={'#dee7f6'}
57+
w={'18px'}
58+
h={'18px'}
59+
boxShadow={'none'}
60+
// transform={'translate(-50%, -50%) !important'}
61+
/>
62+
</Slider>
63+
<MyNumberInput
64+
size={'sm'}
65+
width={'150px'}
66+
min={min}
67+
max={max}
68+
step={step}
69+
value={value}
70+
onChange={(e) => onChange(e ?? min)}
71+
/>
72+
</HStack>
73+
);
74+
};
75+
76+
export default InputSlider;

packages/web/context/useSystem.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ const SystemStoreContextProvider = ({
2525
children: ReactNode;
2626
device?: 'pc' | 'mobile' | null;
2727
}) => {
28-
const [isPc] = useMediaQuery('(min-width: 900px)');
29-
28+
const [isPc] = useMediaQuery('(min-width: 900px)', {
29+
fallback: device === 'pc'
30+
});
3031
useEffect(() => {
3132
setSize(isPc ? 'pc' : 'mobile');
3233
}, [isPc]);
3334

3435
const contextValue = useMemo(
3536
() => ({
36-
isPc: device ? device === 'pc' : isPc
37+
isPc
3738
}),
38-
[device, isPc]
39+
[isPc]
3940
);
41+
4042
return (
4143
<useSystemStoreContext.Provider value={contextValue}>{children}</useSystemStoreContext.Provider>
4244
);

packages/web/i18n/en/app.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"Run": "Execute",
44
"Team Tags Set": "Team tags",
55
"Team_Tags": "Team tags",
6+
"ai_point_price": "Billing",
67
"ai_settings": "AI Configuration",
78
"all_apps": "All Applications",
89
"app.Version name": "Version Name",
@@ -19,8 +20,9 @@
1920
"auto_execute_tip": "After turning it on, the workflow will be automatically triggered when the user enters the conversation interface. \nExecution order: 1. Dialogue starter; 2. Global variables; 3. Automatic execution.",
2021
"auto_save": "Auto save",
2122
"chat_debug": "Chat Preview",
22-
"chat_logs": "Conversation Logs",
23+
"chat_logs": "Logs",
2324
"chat_logs_tips": "Logs will record the online, shared, and API (requires chatId) conversation records of this app.",
25+
"config_ai_model_params": "Click to configure AI model related properties",
2426
"config_file_upload": "Click to Configure File Upload Rules",
2527
"config_question_guide": "Configuration guess you want to ask",
2628
"confirm_copy_app_tip": "The system will create an app with the same configuration for you, but permissions will not be copied. Please confirm!",
@@ -68,13 +70,15 @@
6870
"interval.per_hour": "Every Hour",
6971
"intro": "A comprehensive model application orchestration system that offers out-of-the-box data processing and model invocation capabilities. It allows for rapid Dataset construction and workflow orchestration through Flow visualization, enabling complex Dataset scenarios!",
7072
"llm_not_support_vision": "This model does not support image recognition",
71-
"llm_use_vision": "Enable Image Recognition",
73+
"llm_use_vision": "Vision",
7274
"llm_use_vision_tip": "After clicking on the model selection, you can see whether the model supports image recognition and the ability to control whether to start image recognition. \nAfter starting image recognition, the model will read the image content in the file link, and if the user question is less than 500 words, it will automatically parse the image in the user question.",
7375
"logs_chat_user": "user",
7476
"logs_empty": "No logs yet~",
7577
"logs_message_total": "Total Messages",
7678
"logs_title": "Title",
79+
"look_ai_point_price": "View all model billing standards",
7780
"mark_count": "Number of Marked Answers",
81+
"max_histories_number": "Max histories",
7882
"module.Custom Title Tip": "This title will be displayed during the conversation.",
7983
"module.No Modules": "No Plugins Found",
8084
"module.type": "\"{{type}}\" type\n{{description}}",
@@ -96,13 +100,15 @@
96100
"plugin_cost_per_times": "{{cost}} points/time",
97101
"plugin_dispatch": "Plugin Invocation",
98102
"plugin_dispatch_tip": "Adds extra capabilities to the model. The specific plugins to be invoked will be autonomously decided by the model.\nIf a plugin is selected, the Dataset invocation will automatically be treated as a special plugin.",
99-
"publish_channel": "Publish Channel",
103+
"publish_channel": "Publish",
100104
"publish_success": "Publish Successful",
101105
"question_guide_tip": "After the conversation, 3 guiding questions will be generated for you.",
102106
"saved_success": "Save Successful",
103107
"search_app": "Search Application",
104-
"setting_app": "Application Settings",
105-
"setting_plugin": "Plugin Settings",
108+
"setting_app": "Workflow",
109+
"setting_plugin": "Workflow",
110+
"stream_response": "Stream",
111+
"stream_response_tip": "Turning this switch off forces the model to use non-streaming mode and will not output content directly. \nIn the output of the AI ​​reply, the content output by this model can be obtained for secondary processing.",
106112
"template.hard_strict": "Strict Q&A template",
107113
"template.hard_strict_des": "Based on the question and answer template, stricter requirements are imposed on the model's answers.",
108114
"template.qa_template": "Q&A template",
@@ -164,7 +170,7 @@
164170
"workflow.form_input_description_placeholder": "For example: \nAdd your information",
165171
"workflow.form_input_tip": " This module can configure multiple inputs to guide users in entering specific content.",
166172
"workflow.input_description_tip": "You can add a description to explain to users what they need to input",
167-
"workflow.read_files": "Document Parsing",
173+
"workflow.read_files": "Document Parse",
168174
"workflow.read_files_result": "Document Parsing Result",
169175
"workflow.read_files_result_desc": "Original document text, consisting of file names and document content, separated by hyphens between multiple files.",
170176
"workflow.read_files_tip": "Parse the documents uploaded in this round of dialogue and return the corresponding document content",
@@ -175,6 +181,6 @@
175181
"workflow.template.communication": "Communication",
176182
"workflow.user_file_input": "File Link",
177183
"workflow.user_file_input_desc": "Links to documents and images uploaded by users.",
178-
"workflow.user_select": "User Selection",
184+
"workflow.user_select": "User Select",
179185
"workflow.user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches."
180186
}

packages/web/i18n/en/common.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,14 @@
261261
"contribute_app_template": "Contribute Template",
262262
"core.Chat": "Chat",
263263
"core.Max Token": "Max Token",
264-
"core.ai.AI settings": "AI Settings",
265-
"core.ai.Ai point price": "AI Points Consumption",
266264
"core.ai.Max context": "Max Context",
267-
"core.ai.Model": "AI Model",
265+
"core.ai.Model": "Model",
268266
"core.ai.Not deploy rerank model": "Re-rank Model Not Deployed",
269267
"core.ai.Prompt": "Prompt",
270268
"core.ai.Support tool": "Function Call",
271269
"core.ai.model.Dataset Agent Model": "File read model",
272270
"core.ai.model.Vector Model": "Index model",
273271
"core.ai.model.doc_index_and_dialog": "Document Index & Dialog Index",
274-
"core.app.Ai response": "AI Response",
275272
"core.app.Api request": "API Request",
276273
"core.app.Api request desc": "Integrate into existing systems through API, or WeChat Work, Feishu, etc.",
277274
"core.app.App intro": "App Introduction",
@@ -284,8 +281,7 @@
284281
"core.app.Interval timer run": "Scheduled Execution",
285282
"core.app.Interval timer tip": "Can Execute App on Schedule",
286283
"core.app.Make a brief introduction of your app": "Give Your AI App an Introduction",
287-
"core.app.Max histories": "Number of Chat Histories",
288-
"core.app.Max tokens": "Response Limit",
284+
"core.app.Max tokens": "Max response",
289285
"core.app.Name and avatar": "Avatar & Name",
290286
"core.app.Publish": "Publish",
291287
"core.app.Publish Confirm": "Confirm to Publish App? This Will Immediately Update the App Status on All Publishing Channels.",

0 commit comments

Comments
 (0)