fix: 修复翻译引用问题

This commit is contained in:
wangdan-fit2cloud 2024-05-21 14:06:54 +08:00
parent 89b7fe2f39
commit 0a05be91a6
3 changed files with 309 additions and 231 deletions

View File

@ -1,103 +1,113 @@
export default { export default {
applicationList: { applicationList: {
title: "Applications", title: 'Applications',
searchBar: { searchBar: {
placeholder: "Search by name", placeholder: 'Search by name'
},
card: {
createApplication: "Create Application",
overview: "Overview",
demo: "Demo",
setting: "Settings",
delete: {
tooltip: "Delete",
confirmTitle: "Are you sure you want to delete this application?",
confirmMessage: "Deleting this application will no longer provide its services. Please proceed with caution.",
confirmButton: "Delete",
cancelButton: "Cancel",
successMessage: "Successfully deleted"
}
},
tooltips: {
demo: "Demo",
setting: "Settings",
delete: "Delete"
},
}, },
applicationForm: { card: {
title: { createApplication: 'Create Application',
create: "Create Application", overview: 'Overview',
edit: "Edit Settings", demo: 'Demo',
info:"Application Information" setting: 'Settings',
}, delete: {
form: { tooltip: 'Delete',
appName: { confirmTitle: 'Are you sure you want to delete this application?',
label: "Application Name", confirmMessage:
placeholder: "Please enter the application name", 'Deleting this application will no longer provide its services. Please proceed with caution.',
requiredMessage: "Application name is required" confirmButton: 'Delete',
}, cancelButton: 'Cancel',
appDescription: { successMessage: 'Successfully deleted'
label: "Application Description", }
placeholder: "Describe the application scenario and use, e.g.: MaxKB assistant answering user questions about MaxKB product usage"
},
aiModel: {
label: "AI Model",
placeholder: "Please select an AI model",
unavailable: "(Unavailable)"
},
prompt: {
label: "Prompt",
placeholder: "Please enter prompt",
tooltip: "By adjusting the content of the prompt, you can guide the direction of the large model conversation. This prompt will be fixed at the beginning of the context. Variables used: {data} carries known information from the knowledge base; {question} is the question posed by the user."
},
multipleRoundsDialogue: "Multiple Rounds Dialogue",
relatedKnowledgeBase: "Related Knowledge Base",
relatedKnowledgeBaseWhere: "Associated knowledge bases are displayed here",
prologue: "Prologue",
problemOptimization: {
label: "Problem Optimization",
tooltip: "Optimize the current question based on historical chat to better match knowledge points."
},
addModel: "Add Model",
paramSetting: "Parameter Settings",
add: "Add",
apptest:"Debug Preview"
},
buttons: {
confirm:"Confirm",
cancel: "Cancel",
create: "Create",
createSuccess: "Create Success",
save: "Save",
saveSuccess: "Save Success"
},
dialogues: {
addDataset: "Add Related Knowledge Base",
removeDataset: "Remove Knowledge Base",
paramSettings: "Parameter Settings",
refresh: "Refresh",
selectSearchMode: "Search Mode",
vectorSearch: "Vector Search",
vectorSearchTooltip: "Vector search is a retrieval method based on vector distance calculations, suitable for large data volumes in the knowledge base.",
fullTextSearch: "Full-text Search",
fullTextSearchTooltip: "Full-text search is a retrieval method based on text similarity, suitable for small data volumes in the knowledge base.",
hybridSearch: "Hybrid Search",
hybridSearchTooltip: "Hybrid search is a retrieval method based on both vector and text similarity, suitable for medium data volumes in the knowledge base.",
similarityThreshold: "Similarity Threshold",
topReferences: "Top N References",
maxCharacters: "Maximum Characters per Reference",
noReferencesAction: "When there are no knowledge base references",
continueQuestioning: "Continue Questioning AI Model",
provideAnswer: "Provide a Specific Answer",
prompt: "Prompt",
promptPlaceholder:"Please enter a prompt",
concent:"Content",
concentPlaceholder:"Please enter content",
designated_answer:"Hello, I am MaxKB Assistant. My knowledge base only contains information related to MaxKB products. Please rephrase your question."
}
}, },
prompt:{ tooltips: {
defaultPrompt:"Known information:\n{{data}}\nResponse requirements:\n- Please use concise and professional language to answer the user's question.\n- If you do not know the answer, reply, \"No relevant information was found in the knowledge base; it is recommended to consult technical support or refer to the official documentation for operations.\"\n- Avoid mentioning that your knowledge is obtained from known information.\n- Ensure the answer is consistent with the information described in the known data.\n- Please use Markdown syntax to optimize the format of the answer.\n- Directly return any images, link addresses, and script languages found in the known information.\n- Please respond in the same language as the question.\nQuestion:\n{question}", demo: 'Demo',
defaultPrologue:"Hello, I am MaxKB Assistant. You can ask me questions about using MaxKB.\n- What are the main features of MaxKB?\n- Which large language models does MaxKB support?\n- What document types does MaxKB support?" setting: 'Settings',
delete: 'Delete'
} }
}; },
applicationForm: {
title: {
create: 'Create Application',
edit: 'Edit Settings',
info: 'Application Information'
},
form: {
appName: {
label: 'Application Name',
placeholder: 'Please enter the application name',
requiredMessage: 'Application name is required'
},
appDescription: {
label: 'Application Description',
placeholder:
'Describe the application scenario and use, e.g.: MaxKB assistant answering user questions about MaxKB product usage'
},
aiModel: {
label: 'AI Model',
placeholder: 'Please select an AI model',
unavailable: '(Unavailable)'
},
prompt: {
label: 'Prompt',
placeholder: 'Please enter prompt',
tooltip:
'By adjusting the content of the prompt, you can guide the direction of the large model conversation. This prompt will be fixed at the beginning of the context. Variables used: {data} carries known information from the knowledge base; {question} is the question posed by the user.'
},
multipleRoundsDialogue: 'Multiple Rounds Dialogue',
relatedKnowledgeBase: 'Related Knowledge Base',
relatedKnowledgeBaseWhere: 'Associated knowledge bases are displayed here',
prologue: 'Prologue',
problemOptimization: {
label: 'Problem Optimization',
tooltip:
'Optimize the current question based on historical chat to better match knowledge points.'
},
addModel: 'Add Model',
paramSetting: 'Parameter Settings',
add: 'Add',
apptest: 'Debug Preview'
},
buttons: {
confirm: 'Confirm',
cancel: 'Cancel',
create: 'Create',
createSuccess: 'Create Success',
save: 'Save',
saveSuccess: 'Save Success'
},
dialogues: {
addDataset: 'Add Related Knowledge Base',
removeDataset: 'Remove Knowledge Base',
paramSettings: 'Parameter Settings',
refresh: 'Refresh',
selectSearchMode: 'Search Mode',
vectorSearch: 'Vector Search',
vectorSearchTooltip:
'Vector search is a retrieval method based on vector distance calculations, suitable for large data volumes in the knowledge base.',
fullTextSearch: 'Full-text Search',
fullTextSearchTooltip:
'Full-text search is a retrieval method based on text similarity, suitable for small data volumes in the knowledge base.',
hybridSearch: 'Hybrid Search',
hybridSearchTooltip:
'Hybrid search is a retrieval method based on both vector and text similarity, suitable for medium data volumes in the knowledge base.',
similarityThreshold: 'Similarity Threshold',
topReferences: 'Top N References',
maxCharacters: 'Maximum Characters per Reference',
noReferencesAction: 'When there are no knowledge base references',
continueQuestioning: 'Continue Questioning AI Model',
provideAnswer: 'Provide a Specific Answer',
prompt: 'Prompt',
promptPlaceholder: 'Please enter a prompt',
concent: 'Content',
concentPlaceholder: 'Please enter content',
designated_answer:
'Hello, I am MaxKB Assistant. My knowledge base only contains information related to MaxKB products. Please rephrase your question.'
}
},
prompt: {
defaultPrompt:
'Known information:\n{data}\nResponse requirements:\n- Please use concise and professional language to answer the user\'s question.\n- If you do not know the answer, reply, "No relevant information was found in the knowledge base; it is recommended to consult technical support or refer to the official documentation for operations."\n- Avoid mentioning that your knowledge is obtained from known information.\n- Ensure the answer is consistent with the information described in the known data.\n- Please use Markdown syntax to optimize the format of the answer.\n- Directly return any images, link addresses, and script languages found in the known information.\n- Please respond in the same language as the question.\nQuestion:\n{question}',
defaultPrologue:
'Hello, I am MaxKB Assistant. You can ask me questions about using MaxKB.\n- What are the main features of MaxKB?\n- Which large language models does MaxKB support?\n- What document types does MaxKB support?'
}
}

View File

@ -1,103 +1,109 @@
export default { export default {
applicationList: { applicationList: {
title: "应用", title: '应用',
searchBar: { searchBar: {
placeholder: "按名称搜索", placeholder: '按名称搜索'
},
card: {
createApplication: "创建应用",
overview: "概览",
demo: "演示",
setting: "设置",
delete: {
tooltip: "删除",
confirmTitle: "是否删除应用:",
confirmMessage: "删除后该应用将不再提供服务,请谨慎操作。",
confirmButton: "删除",
cancelButton: "取消",
successMessage: "删除成功"
}
},
tooltips: {
demo: "演示",
setting: "设置",
delete: "删除"
},
}, },
applicationForm: { card: {
title: { createApplication: '创建应用',
create: "创建应用", overview: '概览',
edit: "设置", demo: '演示',
info:"应用信息" setting: '设置',
}, delete: {
form: { tooltip: '删除',
appName: { confirmTitle: '是否删除应用:',
label: "应用名称", confirmMessage: '删除后该应用将不再提供服务,请谨慎操作。',
placeholder: "请输入应用名称", confirmButton: '删除',
requiredMessage: "请输入应用名称" cancelButton: '取消',
}, successMessage: '删除成功'
appDescription: { }
label: "应用描述",
placeholder: "描述该应用的应用场景及用途MaxKB 小助手回答用户提出的 MaxKB 产品使用问题"
},
aiModel: {
label: "AI 模型",
placeholder: "请选择 AI 模型",
unavailable: "(不可用)"
},
prompt: {
label: "提示词",
placeholder: "请输入提示词",
tooltip: "通过调整提示词内容,可以引导大模型聊天方向,该提示词会被固定在上下文的开头。可以使用变量:{data} 是携带知识库中已知信息;{question}是用户提出的问题。"
},
multipleRoundsDialogue: "多轮对话",
relatedKnowledgeBase: "关联知识库",
relatedKnowledgeBaseWhere: "关联知识库展示在这里",
prologue: "开场白",
problemOptimization: {
label: "问题优化",
tooltip: "根据历史聊天优化完善当前问题,更利于匹配知识点。"
},
addModel: "添加模型",
paramSetting: "参数设置",
add: "添加",
apptest:"调试预览"
},
buttons: {
confirm:"确认",
cancel: "取消",
create: "创建",
createSuccess: "创建",
save: "保存",
saveSuccess: "保存"
},
dialogues: {
addDataset: "添加关联知识库",
removeDataset: "移除知识库",
paramSettings: "参数设置",
refresh: "刷新",
selectSearchMode: "检索模式",
vectorSearch: "向量检索",
vectorSearchTooltip: "向量检索是一种基于向量相似度的检索方式,适用于知识库中的大数据量场景。",
fullTextSearch: "全文检索",
fullTextSearchTooltip: "全文检索是一种基于文本相似度的检索方式,适用于知识库中的小数据量场景。",
hybridSearch: "混合检索",
hybridSearchTooltip: "混合检索是一种基于向量和文本相似度的检索方式,适用于知识库中的中等数据量场景。",
similarityThreshold: "相似度高于",
topReferences: "引用分段数 TOP",
maxCharacters: "最多引用字符数",
noReferencesAction: "无引用知识库分段时",
continueQuestioning: "继续向 AI 模型提问",
provideAnswer: "指定回答内容",
prompt: "提示词",
promptPlaceholder:"请输入提示词",
concent:"内容",
concentPlaceholder:"请输入内容",
designated_answer:"你好,我是 MaxKB 小助手,我的知识库只包含了 MaxKB 产品相关知识,请重新描述您的问题。"
}
}, },
prompt:{ tooltips: {
defaultPrompt:"已知信息:\n {{data}} \n回答要求\n- 请使用简洁且专业的语言来回答用户的问题。\n- 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。\n- 避免提及你是从已知信息中获得的知识。\n- 请保证答案与已知信息中描述的一致。\n- 请使用 Markdown 语法优化答案的格式。\n- 已知信息中的图片、链接地址和脚本语言请直接返回。\n- 请使用与问题相同的语言来回答。\n问题\n{question}", demo: '演示',
defaultPrologue:"您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?" setting: '设置',
delete: '删除'
} }
}; },
applicationForm: {
title: {
create: '创建应用',
edit: '设置',
info: '应用信息'
},
form: {
appName: {
label: '应用名称',
placeholder: '请输入应用名称',
requiredMessage: '请输入应用名称'
},
appDescription: {
label: '应用描述',
placeholder: '描述该应用的应用场景及用途MaxKB 小助手回答用户提出的 MaxKB 产品使用问题'
},
aiModel: {
label: 'AI 模型',
placeholder: '请选择 AI 模型',
unavailable: '(不可用)'
},
prompt: {
label: '提示词',
placeholder: '请输入提示词',
tooltip:
'通过调整提示词内容,可以引导大模型聊天方向,该提示词会被固定在上下文的开头。可以使用变量:{data} 是携带知识库中已知信息;{question}是用户提出的问题。'
},
multipleRoundsDialogue: '多轮对话',
relatedKnowledgeBase: '关联知识库',
relatedKnowledgeBaseWhere: '关联知识库展示在这里',
prologue: '开场白',
problemOptimization: {
label: '问题优化',
tooltip: '根据历史聊天优化完善当前问题,更利于匹配知识点。'
},
addModel: '添加模型',
paramSetting: '参数设置',
add: '添加',
apptest: '调试预览'
},
buttons: {
confirm: '确认',
cancel: '取消',
create: '创建',
createSuccess: '创建',
save: '保存',
saveSuccess: '保存'
},
dialogues: {
addDataset: '添加关联知识库',
removeDataset: '移除知识库',
paramSettings: '参数设置',
refresh: '刷新',
selectSearchMode: '检索模式',
vectorSearch: '向量检索',
vectorSearchTooltip: '向量检索是一种基于向量相似度的检索方式,适用于知识库中的大数据量场景。',
fullTextSearch: '全文检索',
fullTextSearchTooltip:
'全文检索是一种基于文本相似度的检索方式,适用于知识库中的小数据量场景。',
hybridSearch: '混合检索',
hybridSearchTooltip:
'混合检索是一种基于向量和文本相似度的检索方式,适用于知识库中的中等数据量场景。',
similarityThreshold: '相似度高于',
topReferences: '引用分段数 TOP',
maxCharacters: '最多引用字符数',
noReferencesAction: '无引用知识库分段时',
continueQuestioning: '继续向 AI 模型提问',
provideAnswer: '指定回答内容',
prompt: '提示词',
promptPlaceholder: '请输入提示词',
concent: '内容',
concentPlaceholder: '请输入内容',
designated_answer:
'你好,我是 MaxKB 小助手,我的知识库只包含了 MaxKB 产品相关知识,请重新描述您的问题。'
}
},
prompt: {
defaultPrompt:
'已知信息:\n {data} \n回答要求\n- 请使用简洁且专业的语言来回答用户的问题。\n- 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。\n- 避免提及你是从已知信息中获得的知识。\n- 请保证答案与已知信息中描述的一致。\n- 请使用 Markdown 语法优化答案的格式。\n- 已知信息中的图片、链接地址和脚本语言请直接返回。\n- 请使用与问题相同的语言来回答。\n问题\n{question}',
defaultPrologue:
'您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?'
}
}

View File

@ -1,13 +1,19 @@
<template> <template>
<LayoutContainer <LayoutContainer
:header="id ? $t('views.application.applicationForm.title.edit'): $t('views.application.applicationForm.title.create')" :header="
id
? $t('views.application.applicationForm.title.edit')
: $t('views.application.applicationForm.title.create')
"
:back-to="id ? '' : '-1'" :back-to="id ? '' : '-1'"
class="create-application" class="create-application"
> >
<el-row v-loading="loading"> <el-row v-loading="loading">
<el-col :span="10"> <el-col :span="10">
<div class="p-24 mb-16" style="padding-bottom: 0"> <div class="p-24 mb-16" style="padding-bottom: 0">
<h4 class="title-decoration-1">{{$t('views.application.applicationForm.title.info')}}</h4> <h4 class="title-decoration-1">
{{ $t('views.application.applicationForm.title.info') }}
</h4>
</div> </div>
<div class="scrollbar-height-left"> <div class="scrollbar-height-left">
<el-scrollbar> <el-scrollbar>
@ -24,7 +30,10 @@
<el-form-item prop="name"> <el-form-item prop="name">
<template #label> <template #label>
<div class="flex-between"> <div class="flex-between">
<span>{{$t('views.application.applicationForm.form.appName.label')}} <span class="danger">*</span></span> <span
>{{ $t('views.application.applicationForm.form.appName.label') }}
<span class="danger">*</span></span
>
</div> </div>
</template> </template>
<el-input <el-input
@ -34,21 +43,28 @@
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t('views.application.applicationForm.form.appDescription.label')"> <el-form-item
:label="$t('views.application.applicationForm.form.appDescription.label')"
>
<el-input <el-input
v-model="applicationForm.desc" v-model="applicationForm.desc"
type="textarea" type="textarea"
:placeholder="$t('views.application.applicationForm.form.appDescription.placeholder')" :placeholder="
$t('views.application.applicationForm.form.appDescription.placeholder')
"
:rows="3" :rows="3"
maxlength="256" maxlength="256"
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t('views.application.applicationForm.form.aiModel.label')" prop="model_id"> <el-form-item
:label="$t('views.application.applicationForm.form.aiModel.label')"
prop="model_id"
>
<template #label> <template #label>
<div class="flex-between"> <div class="flex-between">
<span>{{$t('views.application.applicationForm.form.aiModel.label')}}</span> <span>{{ $t('views.application.applicationForm.form.aiModel.label') }}</span>
</div> </div>
</template> </template>
<el-select <el-select
@ -96,7 +112,9 @@
class="model-icon mr-8" class="model-icon mr-8"
></span> ></span>
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<span class="danger">{{$t('views.application.applicationForm.form.aiModel.unavailable')}}</span> <span class="danger">{{
$t('views.application.applicationForm.form.aiModel.unavailable')
}}</span>
</div> </div>
<el-icon class="check-icon" v-if="item.id === applicationForm.model_id" <el-icon class="check-icon" v-if="item.id === applicationForm.model_id"
><Check ><Check
@ -106,22 +124,29 @@
<template #footer> <template #footer>
<div class="w-full text-left cursor" @click="openCreateModel()"> <div class="w-full text-left cursor" @click="openCreateModel()">
<el-button type="primary" link> <el-button type="primary" link>
<el-icon class="mr-4"><Plus /></el-icon> {{$t('views.application.applicationForm.form.addModel')}} <el-icon class="mr-4"><Plus /></el-icon>
{{ $t('views.application.applicationForm.form.addModel') }}
</el-button> </el-button>
</div> </div>
</template> </template>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('views.application.applicationForm.form.prompt.label')" prop="model_setting.prompt"> <el-form-item
:label="$t('views.application.applicationForm.form.prompt.label')"
prop="model_setting.prompt"
>
<template #label> <template #label>
<div class="flex align-center"> <div class="flex align-center">
<div class="flex-between mr-4"> <div class="flex-between mr-4">
<span>{{$t('views.application.applicationForm.form.prompt.label')}} <span class="danger">*</span></span> <span
>{{ $t('views.application.applicationForm.form.prompt.label') }}
<span class="danger">*</span></span
>
</div> </div>
<el-tooltip effect="dark" placement="right"> <el-tooltip effect="dark" placement="right">
<template #content <template #content>{{
>{{$t('views.application.applicationForm.form.prompt.tooltip')}}</template $t('views.application.applicationForm.form.prompt.tooltip')
> }}</template>
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon> <AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip> </el-tooltip>
</div> </div>
@ -134,30 +159,39 @@
:placeholder="defaultPrompt" :placeholder="defaultPrompt"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t('views.application.applicationForm.form.multipleRoundsDialogue')" @click.prevent> <el-form-item
:label="$t('views.application.applicationForm.form.multipleRoundsDialogue')"
@click.prevent
>
<el-switch <el-switch
size="small" size="small"
v-model="applicationForm.multiple_rounds_dialogue" v-model="applicationForm.multiple_rounds_dialogue"
></el-switch> ></el-switch>
</el-form-item> </el-form-item>
<el-form-item label="$t('views.application.applicationForm.form.relatedKnowledgeBase')"> <el-form-item
label="$t('views.application.applicationForm.form.relatedKnowledgeBase')"
>
<template #label> <template #label>
<div class="flex-between"> <div class="flex-between">
<span>{{$t('views.application.applicationForm.form.relatedKnowledgeBase')}}</span> <span>{{
$t('views.application.applicationForm.form.relatedKnowledgeBase')
}}</span>
<div> <div>
<el-button type="primary" link @click="openParamSettingDialog"> <el-button type="primary" link @click="openParamSettingDialog">
<AppIcon iconName="app-operation" class="mr-4"></AppIcon>{{$t('views.application.applicationForm.form.paramSetting')}} <AppIcon iconName="app-operation" class="mr-4"></AppIcon
>{{ $t('views.application.applicationForm.form.paramSetting') }}
</el-button> </el-button>
<el-button type="primary" link @click="openDatasetDialog"> <el-button type="primary" link @click="openDatasetDialog">
<el-icon class="mr-4"><Plus /></el-icon>{{$t('views.application.applicationForm.form.add')}} <el-icon class="mr-4"><Plus /></el-icon
>{{ $t('views.application.applicationForm.form.add') }}
</el-button> </el-button>
</div> </div>
</div> </div>
</template> </template>
<div class="w-full"> <div class="w-full">
<el-text type="info" v-if="applicationForm.dataset_id_list?.length === 0" <el-text type="info" v-if="applicationForm.dataset_id_list?.length === 0">{{
>{{$t('views.application.applicationForm.form.relatedKnowledgeBaseWhere')}}</el-text $t('views.application.applicationForm.form.relatedKnowledgeBaseWhere')
> }}</el-text>
<el-row :gutter="12" v-else> <el-row :gutter="12" v-else>
<el-col <el-col
:xs="24" :xs="24"
@ -209,10 +243,14 @@
<el-form-item @click.prevent> <el-form-item @click.prevent>
<template #label> <template #label>
<div class="flex align-center"> <div class="flex align-center">
<span class="mr-4">{{$t('views.application.applicationForm.form.problemOptimization.label')}}</span> <span class="mr-4">{{
$t('views.application.applicationForm.form.problemOptimization.label')
}}</span>
<el-tooltip <el-tooltip
effect="dark" effect="dark"
:content="$t('views.application.applicationForm.form.problemOptimization.tooltip')" :content="
$t('views.application.applicationForm.form.problemOptimization.tooltip')
"
placement="right" placement="right"
> >
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon> <AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
@ -225,16 +263,28 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="text-right border-t p-16"> <div class="text-right border-t p-16">
<el-button v-if="!id" @click="router.push({ path: `/application` })">{{$t('views.application.applicationForm.buttons.cancel')}} </el-button> <el-button v-if="!id" @click="router.push({ path: `/application` })"
>{{ $t('views.application.applicationForm.buttons.cancel') }}
</el-button>
<el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading"> <el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading">
{{ id ? $t('views.application.applicationForm.buttons.save') : $t('views.application.applicationForm.buttons.create') }} {{
id
? $t('views.application.applicationForm.buttons.save')
: $t('views.application.applicationForm.buttons.create')
}}
</el-button> </el-button>
</div> </div>
</el-col> </el-col>
<el-col :span="14" class="p-24 border-l"> <el-col :span="14" class="p-24 border-l">
<h4 class="title-decoration-1 mb-16">{{$t('views.application.applicationForm.form.apptest')}}</h4> <h4 class="title-decoration-1 mb-16">
{{ $t('views.application.applicationForm.form.apptest') }}
</h4>
<div class="dialog-bg"> <div class="dialog-bg">
<h4 class="p-24">{{ applicationForm?.name || $t('views.application.applicationForm.form.appName.label') }}</h4> <h4 class="p-24">
{{
applicationForm?.name || $t('views.application.applicationForm.form.appName.label')
}}
</h4>
<div class="scrollbar-height"> <div class="scrollbar-height">
<AiChat :data="applicationForm"></AiChat> <AiChat :data="applicationForm"></AiChat>
</div> </div>
@ -284,8 +334,8 @@ const route = useRoute()
const { const {
params: { id } params: { id }
} = route as any } = route as any
// @ts-ignore // @ts-ignore
const defaultPrompt =t('views.application.prompt.defaultPrompt') const defaultPrompt = t('views.application.prompt.defaultPrompt')
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>() const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
const createModelRef = ref<InstanceType<typeof CreateModelDialog>>() const createModelRef = ref<InstanceType<typeof CreateModelDialog>>()
@ -320,15 +370,27 @@ const applicationForm = ref<ApplicationFormType>({
}) })
const rules = reactive<FormRules<ApplicationFormType>>({ const rules = reactive<FormRules<ApplicationFormType>>({
name: [{ required: true, message: t('views.application.applicationForm.appName.placeholder'), trigger: 'blur' }], name: [
{
required: true,
message: t('views.application.applicationForm.form.appName.placeholder'),
trigger: 'blur'
}
],
model_id: [ model_id: [
{ {
required: false, required: false,
message: t('views.application.applicationForm.aiModel.placeholder'), message: t('views.application.applicationForm.form.aiModel.placeholder'),
trigger: 'change' trigger: 'change'
} }
], ],
'model_setting.prompt': [{ required: true, message:t('views.application.applicationForm.prompt.placeholder'), trigger: 'blur' }] 'model_setting.prompt': [
{
required: true,
message: t('views.application.applicationForm.form.prompt.placeholder'),
trigger: 'blur'
}
]
}) })
const modelOptions = ref<any>(null) const modelOptions = ref<any>(null)
const providerOptions = ref<Array<Provider>>([]) const providerOptions = ref<Array<Provider>>([])