mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
feat: model select support close params;perf: dataset params slider;update doc (#3453)
* feat: model select support close params * perf: dataset params slider * update doc * update doc * add delete log * perf: ai config overflow * test * test * test * delete collection tags * delete collection tags
This commit is contained in:
8
packages/global/core/app/type.d.ts
vendored
8
packages/global/core/app/type.d.ts
vendored
@@ -73,8 +73,8 @@ export type AppSimpleEditFormType = {
|
||||
aiSettings: {
|
||||
model: string;
|
||||
systemPrompt?: string | undefined;
|
||||
temperature: number;
|
||||
maxToken: number;
|
||||
temperature?: number;
|
||||
maxToken?: number;
|
||||
isResponseAnswerText: boolean;
|
||||
maxHistories: number;
|
||||
};
|
||||
@@ -109,8 +109,8 @@ export type AppChatConfigType = {
|
||||
};
|
||||
export type SettingAIDataType = {
|
||||
model: string;
|
||||
temperature: number;
|
||||
maxToken: number;
|
||||
temperature?: number;
|
||||
maxToken?: number;
|
||||
isResponseAnswerText?: boolean;
|
||||
maxHistories?: number;
|
||||
[NodeInputKeyEnum.aiChatVision]?: boolean; // Is open vision mode
|
||||
|
@@ -201,13 +201,14 @@ export type DispatchNodeResultType<T = {}> = {
|
||||
export type AIChatNodeProps = {
|
||||
[NodeInputKeyEnum.aiModel]: string;
|
||||
[NodeInputKeyEnum.aiSystemPrompt]?: string;
|
||||
[NodeInputKeyEnum.aiChatTemperature]: number;
|
||||
[NodeInputKeyEnum.aiChatMaxToken]: number;
|
||||
[NodeInputKeyEnum.aiChatTemperature]?: number;
|
||||
[NodeInputKeyEnum.aiChatMaxToken]?: number;
|
||||
[NodeInputKeyEnum.aiChatIsResponseText]: boolean;
|
||||
[NodeInputKeyEnum.aiChatVision]?: boolean;
|
||||
|
||||
[NodeInputKeyEnum.aiChatQuoteRole]?: AiChatQuoteRoleType;
|
||||
[NodeInputKeyEnum.aiChatQuoteTemplate]?: string;
|
||||
[NodeInputKeyEnum.aiChatQuotePrompt]?: string;
|
||||
[NodeInputKeyEnum.aiChatVision]?: boolean;
|
||||
|
||||
[NodeInputKeyEnum.stringQuoteText]?: string;
|
||||
[NodeInputKeyEnum.fileUrlList]?: string[];
|
||||
|
@@ -12,10 +12,12 @@ export const computedMaxToken = async ({
|
||||
model,
|
||||
filterMessages = []
|
||||
}: {
|
||||
maxToken: number;
|
||||
maxToken?: number;
|
||||
model: LLMModelItemType;
|
||||
filterMessages: ChatCompletionMessageParam[];
|
||||
}) => {
|
||||
if (maxToken === undefined) return;
|
||||
|
||||
maxToken = Math.min(maxToken, model.maxResponse);
|
||||
const tokensLimit = model.maxContext;
|
||||
|
||||
@@ -63,12 +65,13 @@ export const llmCompletionsBodyFormat = <T extends CompletionsBodyType>(
|
||||
|
||||
const requestBody: T = {
|
||||
...body,
|
||||
temperature: body.temperature
|
||||
? computedTemperature({
|
||||
model: modelData,
|
||||
temperature: body.temperature
|
||||
})
|
||||
: undefined,
|
||||
temperature:
|
||||
typeof body.temperature === 'number'
|
||||
? computedTemperature({
|
||||
model: modelData,
|
||||
temperature: body.temperature
|
||||
})
|
||||
: undefined,
|
||||
...modelData?.defaultConfig
|
||||
};
|
||||
|
||||
|
@@ -71,19 +71,10 @@ export async function delDatasetRelevantData({
|
||||
const teamId = datasets[0].teamId;
|
||||
|
||||
if (!teamId) {
|
||||
return Promise.reject('teamId is required');
|
||||
return Promise.reject('TeamId is required');
|
||||
}
|
||||
|
||||
const datasetIds = datasets.map((item) => String(item._id));
|
||||
|
||||
// Get _id, teamId, fileId, metadata.relatedImgId for all collections
|
||||
const collections = await MongoDatasetCollection.find(
|
||||
{
|
||||
teamId,
|
||||
datasetId: { $in: datasetIds }
|
||||
},
|
||||
'_id teamId datasetId fileId metadata'
|
||||
).lean();
|
||||
const datasetIds = datasets.map((item) => item._id);
|
||||
|
||||
// delete training data
|
||||
await MongoDatasetTraining.deleteMany({
|
||||
@@ -91,20 +82,27 @@ export async function delDatasetRelevantData({
|
||||
datasetId: { $in: datasetIds }
|
||||
});
|
||||
|
||||
// image and file
|
||||
await delCollectionRelatedSource({ collections, session });
|
||||
|
||||
// delete dataset.datas
|
||||
await MongoDatasetData.deleteMany({ teamId, datasetId: { $in: datasetIds } }, { session });
|
||||
|
||||
// delete collections
|
||||
await MongoDatasetCollection.deleteMany(
|
||||
// Get _id, teamId, fileId, metadata.relatedImgId for all collections
|
||||
const collections = await MongoDatasetCollection.find(
|
||||
{
|
||||
teamId,
|
||||
datasetId: { $in: datasetIds }
|
||||
},
|
||||
'_id teamId datasetId fileId metadata',
|
||||
{ session }
|
||||
);
|
||||
).lean();
|
||||
|
||||
// image and file
|
||||
await delCollectionRelatedSource({ collections, session });
|
||||
|
||||
// delete collections
|
||||
await MongoDatasetCollection.deleteMany({
|
||||
teamId,
|
||||
datasetId: { $in: datasetIds }
|
||||
}).session(session);
|
||||
|
||||
// delete dataset.datas(Not need session)
|
||||
await MongoDatasetData.deleteMany({ teamId, datasetId: { $in: datasetIds } });
|
||||
|
||||
// no session delete: delete files, vector data
|
||||
await deleteDatasetDataVector({ teamId, datasetIds });
|
||||
|
@@ -46,7 +46,7 @@ export const runToolWithFunctionCall = async (
|
||||
user,
|
||||
stream,
|
||||
workflowStreamResponse,
|
||||
params: { temperature = 0, maxToken = 4000, aiChatVision }
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
} = workflowProps;
|
||||
|
||||
// Interactive
|
||||
|
@@ -54,7 +54,7 @@ export const runToolWithPromptCall = async (
|
||||
user,
|
||||
stream,
|
||||
workflowStreamResponse,
|
||||
params: { temperature = 0, maxToken = 4000, aiChatVision }
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
} = workflowProps;
|
||||
|
||||
if (interactiveEntryToolParams) {
|
||||
|
@@ -94,7 +94,7 @@ export const runToolWithToolChoice = async (
|
||||
stream,
|
||||
user,
|
||||
workflowStreamResponse,
|
||||
params: { temperature = 0, maxToken = 4000, aiChatVision }
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
} = workflowProps;
|
||||
|
||||
if (maxRunToolTimes <= 0 && response) {
|
||||
|
@@ -71,8 +71,8 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
chatConfig,
|
||||
params: {
|
||||
model,
|
||||
temperature = 0,
|
||||
maxToken = 4000,
|
||||
temperature,
|
||||
maxToken,
|
||||
history = 6,
|
||||
quoteQA,
|
||||
userChatInput,
|
||||
|
@@ -7,13 +7,15 @@ const InputSlider = ({
|
||||
value,
|
||||
max = 100,
|
||||
min = 0,
|
||||
step = 1
|
||||
step = 1,
|
||||
isDisabled
|
||||
}: {
|
||||
value: number;
|
||||
value?: number;
|
||||
onChange: (index: number) => void;
|
||||
max: number;
|
||||
min: number;
|
||||
step?: number;
|
||||
isDisabled?: boolean;
|
||||
}) => {
|
||||
const markList = useMemo(() => {
|
||||
const valLen = max - min;
|
||||
@@ -36,6 +38,7 @@ const InputSlider = ({
|
||||
value={value}
|
||||
focusThumbOnChange={false}
|
||||
onChange={onChange}
|
||||
isDisabled={isDisabled}
|
||||
>
|
||||
<SliderTrack bg={'myGray.100'} h={'4px'} />
|
||||
{markList.map((val, i) => (
|
||||
@@ -67,6 +70,7 @@ const InputSlider = ({
|
||||
max={max}
|
||||
step={step}
|
||||
value={value}
|
||||
isDisabled={isDisabled}
|
||||
onChange={(e) => onChange(e ?? min)}
|
||||
/>
|
||||
</HStack>
|
||||
|
@@ -79,6 +79,12 @@
|
||||
"look_ai_point_price": "View all model billing standards",
|
||||
"mark_count": "Number of Marked Answers",
|
||||
"max_histories_number": "Max histories",
|
||||
"max_histories_number_tip": "The maximum number of rounds of dialogue that the model can carry into memory. If the memory exceeds the model context, the system will force truncation. \nTherefore, even if 30 rounds of dialogue are configured, the actual number may not reach 30 rounds during operation.",
|
||||
"max_quote_tokens": "Max quote",
|
||||
"max_quote_tokens_tips": "The maximum number of tokens in a single search, about 1 character in Chinese = 1.7 tokens, and about 1 character in English = 1 token",
|
||||
"max_tokens": "Max tokens",
|
||||
"min_similarity": "lowest correlation",
|
||||
"min_similarity_tip": "The relevance of different index models is different. Please select the appropriate value through search testing. \nWhen using Result Rearrange , use the rearranged results for filtering.",
|
||||
"module.Custom Title Tip": "This title will be displayed during the conversation.",
|
||||
"module.No Modules": "No Plugins Found",
|
||||
"module.type": "\"{{type}}\" type\n{{description}}",
|
||||
@@ -109,6 +115,8 @@
|
||||
"setting_plugin": "Workflow",
|
||||
"stream_response": "Stream",
|
||||
"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.",
|
||||
"temperature": "Temperature",
|
||||
"temperature_tip": "Range 0~10. \nThe larger the value, the more divergent the model’s answer is; the smaller the value, the more rigorous the answer.",
|
||||
"template.hard_strict": "Strict Q&A template",
|
||||
"template.hard_strict_des": "Based on the question and answer template, stricter requirements are imposed on the model's answers.",
|
||||
"template.qa_template": "Q&A template",
|
||||
|
@@ -281,7 +281,6 @@
|
||||
"core.app.Interval timer run": "Scheduled Execution",
|
||||
"core.app.Interval timer tip": "Can Execute App on Schedule",
|
||||
"core.app.Make a brief introduction of your app": "Give Your AI App an Introduction",
|
||||
"core.app.Max tokens": "Max response",
|
||||
"core.app.Name and avatar": "Avatar & Name",
|
||||
"core.app.Publish": "Publish",
|
||||
"core.app.Publish Confirm": "Confirm to Publish App? This Will Immediately Update the App Status on All Publishing Channels.",
|
||||
@@ -308,7 +307,6 @@
|
||||
"core.app.TTS Tip": "After enabling, you can use the voice playback function after each conversation. Using this feature may incur additional costs.",
|
||||
"core.app.TTS start": "Read Content",
|
||||
"core.app.Team tags": "Team Tags",
|
||||
"core.app.Temperature": "Temperature",
|
||||
"core.app.Tool call": "Tool Call",
|
||||
"core.app.ToolCall.No plugin": "No Available Plugins",
|
||||
"core.app.ToolCall.Parameter setting": "Input Parameters",
|
||||
@@ -599,10 +597,6 @@
|
||||
"core.dataset.search.Dataset Search Params": "Dataset Search Configuration",
|
||||
"core.dataset.search.Empty result response": "Empty Search Response",
|
||||
"core.dataset.search.Filter": "Search Filter",
|
||||
"core.dataset.search.Max Tokens": "Quote Limit",
|
||||
"core.dataset.search.Max Tokens Tips": "The maximum number of tokens for a single search. About 1 Chinese character = 1.7 tokens, 1 English word = 1 token",
|
||||
"core.dataset.search.Min Similarity": "Minimum Similarity",
|
||||
"core.dataset.search.Min Similarity Tips": "The similarity of different index models varies. Please choose an appropriate value through search testing. When using Re-rank, the similarity may be very low.",
|
||||
"core.dataset.search.No support similarity": "Only supported when using result re-rank or semantic search",
|
||||
"core.dataset.search.Nonsupport": "Not Supported",
|
||||
"core.dataset.search.Params Setting": "Search Parameter Settings",
|
||||
|
@@ -78,7 +78,13 @@
|
||||
"logs_title": "标题",
|
||||
"look_ai_point_price": "查看所有模型计费标准",
|
||||
"mark_count": "标注答案数量",
|
||||
"max_histories_number": "最大对话轮数",
|
||||
"max_histories_number": "记忆轮数",
|
||||
"max_histories_number_tip": "模型最多携带多少轮对话进入记忆中,如果记忆超出模型上下文,系统会强制截断。所以尽管配置 30 轮对话,实际运行时候,不一定会达到 30 轮。",
|
||||
"max_quote_tokens": "引用上限",
|
||||
"max_quote_tokens_tips": "单次搜索最大的 token 数量,中文约 1 字=1.7 tokens,英文约 1 字=1 token",
|
||||
"max_tokens": "回复上限",
|
||||
"min_similarity": "最低相关度",
|
||||
"min_similarity_tip": "不同索引模型的相关度有区别,请通过搜索测试来选择合适的数值。使用 结果重排 时,使用重排结果进行过滤。",
|
||||
"module.Custom Title Tip": "该标题名字会展示在对话过程中",
|
||||
"module.No Modules": "没找到插件",
|
||||
"module.type": "\"{{type}}\"类型\n{{description}}",
|
||||
@@ -109,6 +115,8 @@
|
||||
"setting_plugin": "插件配置",
|
||||
"stream_response": "流输出",
|
||||
"stream_response_tip": "关闭该开关,可以强制模型使用非流模式,并且不会直接进行内容输出。可以在 AI 回复的输出中,获取本次模型输出的内容进行二次处理。",
|
||||
"temperature": "温度",
|
||||
"temperature_tip": "范围 0~10。值越大,代表模型回答越发散;值越小,代表回答越严谨。",
|
||||
"template.hard_strict": "严格问答模板",
|
||||
"template.hard_strict_des": "在问答模板基础上,对模型的回答做更严格的要求。",
|
||||
"template.qa_template": "问答模板",
|
||||
|
@@ -280,7 +280,6 @@
|
||||
"core.app.Interval timer run": "定时执行",
|
||||
"core.app.Interval timer tip": "可定时执行应用",
|
||||
"core.app.Make a brief introduction of your app": "给你的 AI 应用一个介绍",
|
||||
"core.app.Max tokens": "回复上限",
|
||||
"core.app.Name and avatar": "头像 & 名称",
|
||||
"core.app.Publish": "发布",
|
||||
"core.app.Publish Confirm": "确认发布应用?会立即更新所有发布渠道的应用状态。",
|
||||
@@ -307,7 +306,6 @@
|
||||
"core.app.TTS Tip": "开启后,每次对话后可使用语音播放功能。使用该功能可能产生额外费用。",
|
||||
"core.app.TTS start": "朗读内容",
|
||||
"core.app.Team tags": "团队标签",
|
||||
"core.app.Temperature": "温度",
|
||||
"core.app.Tool call": "工具调用",
|
||||
"core.app.ToolCall.No plugin": "没有可用的插件",
|
||||
"core.app.ToolCall.Parameter setting": "输入参数",
|
||||
@@ -598,10 +596,6 @@
|
||||
"core.dataset.search.Dataset Search Params": "知识库搜索配置",
|
||||
"core.dataset.search.Empty result response": "空搜索回复",
|
||||
"core.dataset.search.Filter": "搜索过滤",
|
||||
"core.dataset.search.Max Tokens": "引用上限",
|
||||
"core.dataset.search.Max Tokens Tips": "单次搜索最大的 token 数量,中文约 1 字=1.7 tokens,英文约 1 字=1 token",
|
||||
"core.dataset.search.Min Similarity": "最低相关度",
|
||||
"core.dataset.search.Min Similarity Tips": "不同索引模型的相关度有区别,请通过搜索测试来选择合适的数值,使用 Rerank 时,相关度可能会很低。",
|
||||
"core.dataset.search.No support similarity": "仅使用结果重排或语义检索时,支持相关度过滤",
|
||||
"core.dataset.search.Nonsupport": "不支持",
|
||||
"core.dataset.search.Params Setting": "搜索参数设置",
|
||||
|
@@ -78,7 +78,13 @@
|
||||
"logs_title": "標題",
|
||||
"look_ai_point_price": "查看所有模型計費標準",
|
||||
"mark_count": "標記答案數量",
|
||||
"max_histories_number": "最大對話輪數",
|
||||
"max_histories_number": "記憶輪數",
|
||||
"max_histories_number_tip": "模型最多攜帶多少輪對話進入記憶中,如果記憶超出模型上下文,系統會強制截斷。\n所以儘管配置 30 輪對話,實際運行時候,不一定會達到 30 輪。",
|
||||
"max_quote_tokens": "引用上限",
|
||||
"max_quote_tokens_tips": "單次搜尋最大的 token 數量,中文約 1 字=1.7 tokens,英文約 1 字=1 token",
|
||||
"max_tokens": "回覆上限",
|
||||
"min_similarity": "最低相關度",
|
||||
"min_similarity_tip": "不同索引模型的相關度有區別,請透過搜尋測試來選擇合適的數值。\n使用 結果重排 時,使用重排結果過濾。",
|
||||
"module.Custom Title Tip": "這個標題會顯示在對話過程中",
|
||||
"module.No Modules": "找不到外掛",
|
||||
"module.type": "\"{{type}}\" 類型\n{{description}}",
|
||||
@@ -109,6 +115,8 @@
|
||||
"setting_plugin": "外掛設定",
|
||||
"stream_response": "流輸出",
|
||||
"stream_response_tip": "關閉該開關,可以強制模型使用非流模式,並且不會直接進行內容輸出。\n可在 AI 回覆的輸出中,取得本次模型輸出的內容進行二次處理。",
|
||||
"temperature": "溫度",
|
||||
"temperature_tip": "範圍 0~10。\n值越大,代表模型回答越發散;值越小,代表回答越嚴謹。",
|
||||
"template.hard_strict": "嚴格問答範本",
|
||||
"template.hard_strict_des": "在問答範本基礎上,對模型的回答做出更嚴格的要求。",
|
||||
"template.qa_template": "問答範本",
|
||||
|
@@ -281,7 +281,6 @@
|
||||
"core.app.Interval timer run": "排程執行",
|
||||
"core.app.Interval timer tip": "可排程執行應用程式",
|
||||
"core.app.Make a brief introduction of your app": "為您的 AI 應用程式寫一段介紹",
|
||||
"core.app.Max tokens": "回應上限",
|
||||
"core.app.Name and avatar": "頭像與名稱",
|
||||
"core.app.Publish": "發布",
|
||||
"core.app.Publish Confirm": "確認發布應用程式?這將立即更新所有發布管道的應用程式狀態。",
|
||||
@@ -308,7 +307,6 @@
|
||||
"core.app.TTS Tip": "開啟後,每次對話後可使用語音播放功能。使用此功能可能會產生額外費用。",
|
||||
"core.app.TTS start": "朗讀內容",
|
||||
"core.app.Team tags": "團隊標籤",
|
||||
"core.app.Temperature": "溫度",
|
||||
"core.app.Tool call": "工具呼叫",
|
||||
"core.app.ToolCall.No plugin": "沒有可用的外掛程式",
|
||||
"core.app.ToolCall.Parameter setting": "輸入參數",
|
||||
@@ -599,10 +597,6 @@
|
||||
"core.dataset.search.Dataset Search Params": "知識庫搜尋設定",
|
||||
"core.dataset.search.Empty result response": "空搜尋回應",
|
||||
"core.dataset.search.Filter": "搜尋篩選",
|
||||
"core.dataset.search.Max Tokens": "引用上限",
|
||||
"core.dataset.search.Max Tokens Tips": "單次搜尋最大的 Token 數量,中文約 1 字=1.7 tokens,英文約 1 字=1 token",
|
||||
"core.dataset.search.Min Similarity": "最低相關度",
|
||||
"core.dataset.search.Min Similarity Tips": "不同索引模型的相關度有所差異,請透過搜尋測試來選擇合適的數值。使用重新排名時,相關度可能會很低。",
|
||||
"core.dataset.search.No support similarity": "僅使用結果重新排名或語意搜尋時,支援相關度篩選",
|
||||
"core.dataset.search.Nonsupport": "不支援",
|
||||
"core.dataset.search.Params Setting": "搜尋參數設定",
|
||||
|
Reference in New Issue
Block a user