fix: rerank usage (#4751)

* remove invalid index

* perf: i18n

* fix: rerank usage
This commit is contained in:
Archer
2025-05-06 16:23:36 +08:00
committed by GitHub
parent 367ee517ec
commit ef537f391c
10 changed files with 38 additions and 34 deletions

View File

@@ -21,6 +21,11 @@ export type BillSchemaType = {
datasetSize?: number; datasetSize?: number;
extraPoints?: number; extraPoints?: number;
}; };
refundData?: {
amount: number;
refundId: string;
refundTime: Date;
};
}; };
export type ChatNodeUsageType = { export type ChatNodeUsageType = {

View File

@@ -95,8 +95,6 @@ try {
close custom feedback; close custom feedback;
*/ */
ChatItemSchema.index({ appId: 1, chatId: 1, dataId: 1 }); ChatItemSchema.index({ appId: 1, chatId: 1, dataId: 1 });
// admin charts
ChatItemSchema.index({ time: -1, obj: 1 });
// timer, clear history // timer, clear history
ChatItemSchema.index({ teamId: 1, time: -1 }); ChatItemSchema.index({ teamId: 1, time: -1 });

View File

@@ -178,7 +178,7 @@ const JSONEditor = ({
} catch (error) { } catch (error) {
toast({ toast({
status: 'warning', status: 'warning',
title: t('common:jsonEditor.Parse error') title: t('common:json_parse_error')
}); });
} }
}, [value]); }, [value]);

View File

@@ -20,7 +20,7 @@ export const useCopyData = () => {
const copyData = useCallback( const copyData = useCallback(
async ( async (
data: string, data: string,
title: string | null | undefined = t('common:Copy Successful'), title: string | null | undefined = t('common:copy_successful'),
duration = 1000 duration = 1000
) => { ) => {
data = data.trim(); data = data.trim();

View File

@@ -135,7 +135,7 @@
"comfirm_leave_page": "Confirm to Leave This Page?", "comfirm_leave_page": "Confirm to Leave This Page?",
"Continue_Adding": "Continue adding", "Continue_Adding": "Continue adding",
"Copy": "Copy", "Copy": "Copy",
"Copy Successful": "Copied Successfully", "copy_successful": "Copied Successfully",
"create_failed": "Creation Failed", "create_failed": "Creation Failed",
"create_success": "Created Successfully", "create_success": "Created Successfully",
"create_time": "Creation Time", "create_time": "Creation Time",
@@ -239,7 +239,7 @@
"have_done": "Completed", "have_done": "Completed",
"input.Repeat Value": "Duplicate Value", "input.Repeat Value": "Duplicate Value",
"is_requesting": "Requesting...", "is_requesting": "Requesting...",
"jsonEditor.Parse error": "Possible JSON Error, Please Check Carefully", "json_parse_error": "Possible JSON Error, Please Check Carefully",
"json_config": "JSON Configuration", "json_config": "JSON Configuration",
"link.UnValid": "Invalid Link", "link.UnValid": "Invalid Link",
"month": "Month", "month": "Month",
@@ -251,13 +251,13 @@
"redo_tip_mac": "Redo ⌘ shift z", "redo_tip_mac": "Redo ⌘ shift z",
"request_end": "All Loaded", "request_end": "All Loaded",
"request_more": "Click to Load More", "request_more": "Click to Load More",
"speech.error tip": "Speech to Text Failed", "speech_error_tip": "Speech to Text Failed",
"speech.not support": "Your Browser Does Not Support Speech Input", "speech_not_support": "Your Browser Does Not Support Speech Input",
"submit_success": "Submitted Successfully", "submit_success": "Submitted Successfully",
"submitted": "Submitted", "submitted": "Submitted",
"support": "Support", "support": "Support",
"system.Help Chatbot": "Help Chatbot", "system_help_chatbot": "Help Chatbot",
"system.Use Helper": "Use Helper", "use_helper": "Use Helper",
"ui.textarea.Magnifying": "Magnifying", "ui.textarea.Magnifying": "Magnifying",
"undo_tip": "Undo ctrl z", "undo_tip": "Undo ctrl z",
"undo_tip_mac": "Undo ⌘ z ", "undo_tip_mac": "Undo ⌘ z ",
@@ -274,7 +274,6 @@
"contact_way": "Notification Received", "contact_way": "Notification Received",
"contribute_app_template": "Contribute Template", "contribute_app_template": "Contribute Template",
"core.Chat": "Chat", "core.Chat": "Chat",
"core.Max Token": "Max Token",
"core.ai.Max context": "Max Context", "core.ai.Max context": "Max Context",
"core.ai.Model": "Model", "core.ai.Model": "Model",
"core.ai.Not deploy rerank model": "Re-rank Model Not Deployed", "core.ai.Not deploy rerank model": "Re-rank Model Not Deployed",

View File

@@ -133,7 +133,7 @@
"comfirm_leave_page": "确认离开该页面?", "comfirm_leave_page": "确认离开该页面?",
"Continue_Adding": "继续添加", "Continue_Adding": "继续添加",
"Copy": "复制", "Copy": "复制",
"Copy Successful": "复制成功", "copy_successful": "复制成功",
"create_failed": "创建异常", "create_failed": "创建异常",
"create_success": "创建成功", "create_success": "创建成功",
"create_time": "创建时间", "create_time": "创建时间",
@@ -239,7 +239,7 @@
"have_done": "已完成", "have_done": "已完成",
"input.Repeat Value": "有重复的值", "input.Repeat Value": "有重复的值",
"is_requesting": "请求中……", "is_requesting": "请求中……",
"jsonEditor.Parse error": "JSON 可能有误,请仔细检查", "json_parse_error": "JSON 可能有误,请仔细检查",
"json_config": "JSON 配置", "json_config": "JSON 配置",
"link.UnValid": "无效的链接", "link.UnValid": "无效的链接",
"month": "月", "month": "月",
@@ -251,13 +251,13 @@
"redo_tip_mac": "恢复 ⌘ shift z", "redo_tip_mac": "恢复 ⌘ shift z",
"request_end": "已加载全部", "request_end": "已加载全部",
"request_more": "点击加载更多", "request_more": "点击加载更多",
"speech.error tip": "语音转文字失败", "speech_error_tip": "语音转文字失败",
"speech.not support": "您的浏览器不支持语音输入", "speech_not_support": "您的浏览器不支持语音输入",
"submit_success": "提交成功", "submit_success": "提交成功",
"submitted": "已提交", "submitted": "已提交",
"support": "支持", "support": "支持",
"system.Help Chatbot": "机器人助手", "system_help_chatbot": "机器人助手",
"system.Use Helper": "使用帮助", "use_helper": "使用帮助",
"ui.textarea.Magnifying": "放大", "ui.textarea.Magnifying": "放大",
"undo_tip": "撤销 ctrl z", "undo_tip": "撤销 ctrl z",
"undo_tip_mac": "撤销 ⌘ z ", "undo_tip_mac": "撤销 ⌘ z ",
@@ -273,7 +273,6 @@
"contact_way": "通知接收", "contact_way": "通知接收",
"contribute_app_template": "贡献模板", "contribute_app_template": "贡献模板",
"core.Chat": "对话", "core.Chat": "对话",
"core.Max Token": "单条数据上限",
"core.ai.Max context": "最大上下文", "core.ai.Max context": "最大上下文",
"core.ai.Model": "AI 模型", "core.ai.Model": "AI 模型",
"core.ai.Not deploy rerank model": "未部署重排模型", "core.ai.Not deploy rerank model": "未部署重排模型",

View File

@@ -132,7 +132,7 @@
"comfirm_leave_page": "確認離開此頁面?", "comfirm_leave_page": "確認離開此頁面?",
"Continue_Adding": "繼續新增", "Continue_Adding": "繼續新增",
"Copy": "複製", "Copy": "複製",
"Copy Successful": "複製成功", "copy_successful": "複製成功",
"create_failed": "建立失敗", "create_failed": "建立失敗",
"create_success": "建立成功", "create_success": "建立成功",
"create_time": "建立時間", "create_time": "建立時間",
@@ -238,7 +238,7 @@
"have_done": "已完成", "have_done": "已完成",
"input.Repeat Value": "重複的值", "input.Repeat Value": "重複的值",
"is_requesting": "請求中...", "is_requesting": "請求中...",
"jsonEditor.Parse error": "可能有 JSON 錯誤,請仔細檢查", "json_parse_error": "可能有 JSON 錯誤,請仔細檢查",
"json_config": "JSON 設定", "json_config": "JSON 設定",
"link.UnValid": "無效的連結", "link.UnValid": "無效的連結",
"month": "月", "month": "月",
@@ -250,13 +250,13 @@
"redo_tip_mac": "重做 ⌘ shift z", "redo_tip_mac": "重做 ⌘ shift z",
"request_end": "已載入全部", "request_end": "已載入全部",
"request_more": "點選載入更多", "request_more": "點選載入更多",
"speech.error tip": "語音轉文字失敗", "speech_error_tip": "語音轉文字失敗",
"speech.not support": "您的瀏覽器不支援語音輸入", "speech_not_support": "您的瀏覽器不支援語音輸入",
"submit_success": "送出成功", "submit_success": "送出成功",
"submitted": "已送出", "submitted": "已送出",
"support": "支援", "support": "支援",
"system.Help Chatbot": "機器人助手", "system_help_chatbot": "機器人助手",
"system.Use Helper": "使用說明", "use_helper": "使用說明",
"ui.textarea.Magnifying": "放大", "ui.textarea.Magnifying": "放大",
"undo_tip": "復原 ctrl z", "undo_tip": "復原 ctrl z",
"undo_tip_mac": "復原 ⌘ z ", "undo_tip_mac": "復原 ⌘ z ",
@@ -273,7 +273,6 @@
"contact_way": "通知接收", "contact_way": "通知接收",
"contribute_app_template": "貢獻範本", "contribute_app_template": "貢獻範本",
"core.Chat": "對話", "core.Chat": "對話",
"core.Max Token": "單筆資料上限",
"core.ai.Max context": "最大上下文", "core.ai.Max context": "最大上下文",
"core.ai.Model": "AI 模型", "core.ai.Model": "AI 模型",
"core.ai.Not deploy rerank model": "未部署重新排名模型", "core.ai.Not deploy rerank model": "未部署重新排名模型",

View File

@@ -98,7 +98,7 @@ async function handler(req: ApiRequestProps<SearchTestProps>): Promise<SearchTes
const { totalPoints: embeddingTotalPoints } = pushGenerateVectorUsage({ const { totalPoints: embeddingTotalPoints } = pushGenerateVectorUsage({
teamId, teamId,
tmbId, tmbId,
inputTokens: reRankInputTokens, inputTokens: embeddingTokens,
model: dataset.vectorModel, model: dataset.vectorModel,
source: apikey ? UsageSourceEnum.api : UsageSourceEnum.fastgpt, source: apikey ? UsageSourceEnum.api : UsageSourceEnum.fastgpt,

View File

@@ -161,17 +161,21 @@ const Dataset = () => {
description: t('dataset:common_dataset_desc'), description: t('dataset:common_dataset_desc'),
onClick: () => onSelectDatasetType(DatasetTypeEnum.dataset) onClick: () => onSelectDatasetType(DatasetTypeEnum.dataset)
}, },
{
icon: 'core/dataset/externalDatasetColor',
label: t('dataset:api_file'),
description: t('dataset:external_file_dataset_desc'),
onClick: () => onSelectDatasetType(DatasetTypeEnum.apiDataset)
},
{ {
icon: 'core/dataset/websiteDatasetColor', icon: 'core/dataset/websiteDatasetColor',
label: t('dataset:website_dataset'), label: t('dataset:website_dataset'),
description: t('dataset:website_dataset_desc'), description: t('dataset:website_dataset_desc'),
onClick: () => onSelectDatasetType(DatasetTypeEnum.websiteDataset) onClick: () => onSelectDatasetType(DatasetTypeEnum.websiteDataset)
}
]
},
{
children: [
{
icon: 'core/dataset/externalDatasetColor',
label: t('dataset:api_file'),
description: t('dataset:external_file_dataset_desc'),
onClick: () => onSelectDatasetType(DatasetTypeEnum.apiDataset)
}, },
{ {
icon: 'core/dataset/feishuDatasetColor', icon: 'core/dataset/feishuDatasetColor',

View File

@@ -120,7 +120,7 @@ export const useSpeech = (props?: OutLinkChatAuthProps & { appId?: string }) =>
if (!navigator?.mediaDevices?.getUserMedia) { if (!navigator?.mediaDevices?.getUserMedia) {
return toast({ return toast({
status: 'warning', status: 'warning',
title: t('common:speech.not support') title: t('common:speech_not_support')
}); });
} }
@@ -230,7 +230,7 @@ export const useSpeech = (props?: OutLinkChatAuthProps & { appId?: string }) =>
} catch (error) { } catch (error) {
toast({ toast({
status: 'warning', status: 'warning',
title: getErrText(error, t('common:speech.error tip')) title: getErrText(error, t('common:speech_error_tip'))
}); });
} }
setIsTransCription(false); setIsTransCription(false);