mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 国际化 'views/404' 和 'views/application' 页面
feat: 国际化 'views/404' 和 'views/application' 页面
This commit is contained in:
commit
5a4971645d
|
|
@ -1,12 +1,12 @@
|
|||
import en from 'element-plus/es/locale/lang/en';
|
||||
import components from './components';
|
||||
import layout from './layout';
|
||||
import pages from './pages';
|
||||
import views from './views';
|
||||
|
||||
export default {
|
||||
lang: 'English',
|
||||
layout,
|
||||
pages,
|
||||
views,
|
||||
components,
|
||||
en,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
export default {
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export default {
|
||||
title: "404",
|
||||
message: "Unable to Access Application",
|
||||
operate: "Back to Home",
|
||||
};
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
export default {
|
||||
applicationList: {
|
||||
title: "Applications",
|
||||
searchBar: {
|
||||
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: {
|
||||
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?"
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import notFound from './404';
|
||||
import application from './application';
|
||||
export default {
|
||||
notFound,
|
||||
application,
|
||||
};
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
import components from './components';
|
||||
import layout from './layout';
|
||||
import pages from './pages';
|
||||
import views from './views';
|
||||
|
||||
export default {
|
||||
lang: '简体中文',
|
||||
layout,
|
||||
pages,
|
||||
views,
|
||||
components,
|
||||
zhCn,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
export default {
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export default {
|
||||
title: "404",
|
||||
Message: "无法访问应用",
|
||||
operate: "返回首页",
|
||||
};
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
export default {
|
||||
applicationList: {
|
||||
title: "应用",
|
||||
searchBar: {
|
||||
placeholder: "按名称搜索",
|
||||
},
|
||||
card: {
|
||||
createApplication: "创建应用",
|
||||
overview: "概览",
|
||||
demo: "演示",
|
||||
setting: "设置",
|
||||
delete: {
|
||||
tooltip: "删除",
|
||||
confirmTitle: "是否删除应用:",
|
||||
confirmMessage: "删除后该应用将不再提供服务,请谨慎操作。",
|
||||
confirmButton: "删除",
|
||||
cancelButton: "取消",
|
||||
successMessage: "删除成功"
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
demo: "演示",
|
||||
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 支持哪些文档类型?"
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import notFound from './404';
|
||||
import application from './application';
|
||||
export default {
|
||||
notFound,
|
||||
application,
|
||||
};
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
<el-row class="not-found-container">
|
||||
<el-col class="img" :xs="0" :sm="0" :md="12" :lg="12" :xl="12"> </el-col>
|
||||
<el-col class="message-container" :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
||||
<div class="title">404</div>
|
||||
<div class="message">很抱歉,无法访问应用!</div>
|
||||
<div class="title">{{ $t('views.notFound.title')}}</div>
|
||||
<div class="message">{{ $t('views.notFound.message') }}</div>
|
||||
<!-- TODO 暂时不处理 -->
|
||||
<!-- <div class="operate"><el-button type="primary" @click="router.push('/')">返回首页</el-button></div> -->
|
||||
<!-- <div class="operate"><el-button type="primary" @click="router.push('/')">{{ $t('views.notFound.operate') }}</el-button></div> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
|
@ -42,6 +42,7 @@ const router = useRouter()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1000px) {
|
||||
.not-found-container .message-container {
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<LayoutContainer
|
||||
:header="id ? '设置' : '创建应用'"
|
||||
:header="id ? $t('views.application.applicationForm.title.edit'): $t('views.application.applicationForm.title.create')"
|
||||
:back-to="id ? '' : '-1'"
|
||||
class="create-application"
|
||||
>
|
||||
<el-row v-loading="loading">
|
||||
<el-col :span="10">
|
||||
<div class="p-24 mb-16" style="padding-bottom: 0">
|
||||
<h4 class="title-decoration-1">应用信息</h4>
|
||||
<h4 class="title-decoration-1">{{$t('views.application.applicationForm.title.info')}}</h4>
|
||||
</div>
|
||||
<div class="scrollbar-height-left">
|
||||
<el-scrollbar>
|
||||
|
|
@ -24,36 +24,36 @@
|
|||
<el-form-item prop="name">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>应用名称 <span class="danger">*</span></span>
|
||||
<span>{{$t('views.application.applicationForm.form.appName.label')}} <span class="danger">*</span></span>
|
||||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="applicationForm.name"
|
||||
maxlength="64"
|
||||
placeholder="请输入应用名称"
|
||||
:placeholder="$t('views.application.applicationForm.form.appName.placeholder')"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用描述">
|
||||
<el-form-item :label="$t('views.application.applicationForm.form.appDescription.label')">
|
||||
<el-input
|
||||
v-model="applicationForm.desc"
|
||||
type="textarea"
|
||||
placeholder="描述该应用的应用场景及用途,如:MaxKB 小助手回答用户提出的 MaxKB 产品使用问题"
|
||||
:placeholder="$t('views.application.applicationForm.form.appDescription.placeholder')"
|
||||
:rows="3"
|
||||
maxlength="256"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="AI 模型" prop="model_id">
|
||||
<el-form-item :label="$t('views.application.applicationForm.form.aiModel.label')" prop="model_id">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>AI 模型 </span>
|
||||
<span>{{$t('views.application.applicationForm.form.aiModel.label')}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-select
|
||||
v-model="applicationForm.model_id"
|
||||
placeholder="请选择 AI 模型"
|
||||
:placeholder="$t('views.application.applicationForm.form.aiModel.placeholder')"
|
||||
class="w-full"
|
||||
popper-class="select-model"
|
||||
:clearable="true"
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
class="model-icon mr-8"
|
||||
></span>
|
||||
<span>{{ item.name }}</span>
|
||||
<span class="danger">(不可用)</span>
|
||||
<span class="danger">{{$t('views.application.applicationForm.form.aiModel.unavailable')}}</span>
|
||||
</div>
|
||||
<el-icon class="check-icon" v-if="item.id === applicationForm.model_id"
|
||||
><Check
|
||||
|
|
@ -106,22 +106,21 @@
|
|||
<template #footer>
|
||||
<div class="w-full text-left cursor" @click="openCreateModel()">
|
||||
<el-button type="primary" link>
|
||||
<el-icon class="mr-4"><Plus /></el-icon> 添加模型
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{$t('views.application.applicationForm.form.addModel')}}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词" prop="model_setting.prompt">
|
||||
<el-form-item :label="$t('views.application.applicationForm.form.prompt.label')" prop="model_setting.prompt">
|
||||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<div class="flex-between mr-4">
|
||||
<span>提示词 <span class="danger">*</span></span>
|
||||
<span>{{$t('views.application.applicationForm.form.prompt.label')}} <span class="danger">*</span></span>
|
||||
</div>
|
||||
<el-tooltip effect="dark" placement="right">
|
||||
<template #content
|
||||
>通过调整提示词内容,可以引导大模型聊天方向,该提示词会被固定在上下文的开头。<br />可以使用变量:{data}
|
||||
是携带知识库中已知信息;{question}是用户提出的问题。</template
|
||||
>{{$t('views.application.applicationForm.form.prompt.tooltip')}}</template
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
</el-tooltip>
|
||||
|
|
@ -135,29 +134,29 @@
|
|||
:placeholder="defaultPrompt"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="多轮对话" @click.prevent>
|
||||
<el-form-item :label="$t('views.application.applicationForm.form.multipleRoundsDialogue')" @click.prevent>
|
||||
<el-switch
|
||||
size="small"
|
||||
v-model="applicationForm.multiple_rounds_dialogue"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联知识库">
|
||||
<el-form-item label="$t('views.application.applicationForm.form.relatedKnowledgeBase')">
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<span>关联知识库</span>
|
||||
<span>{{$t('views.application.applicationForm.form.relatedKnowledgeBase')}}</span>
|
||||
<div>
|
||||
<el-button type="primary" link @click="openParamSettingDialog">
|
||||
<AppIcon iconName="app-operation" class="mr-4"></AppIcon>参数设置
|
||||
<AppIcon iconName="app-operation" class="mr-4"></AppIcon>{{$t('views.application.applicationForm.form.paramSetting')}}
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="openDatasetDialog">
|
||||
<el-icon class="mr-4"><Plus /></el-icon>添加
|
||||
<el-icon class="mr-4"><Plus /></el-icon>{{$t('views.application.applicationForm.form.add')}}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full">
|
||||
<el-text type="info" v-if="applicationForm.dataset_id_list?.length === 0"
|
||||
>关联的知识库展示在这里</el-text
|
||||
>{{$t('views.application.applicationForm.form.relatedKnowledgeBaseWhere')}}</el-text
|
||||
>
|
||||
<el-row :gutter="12" v-else>
|
||||
<el-col
|
||||
|
|
@ -198,7 +197,7 @@
|
|||
</el-row>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="开场白">
|
||||
<el-form-item :label="$t('views.application.applicationForm.form.prologue')">
|
||||
<MdEditor
|
||||
class="prologue-md-editor"
|
||||
v-model="applicationForm.prologue"
|
||||
|
|
@ -210,10 +209,10 @@
|
|||
<el-form-item @click.prevent>
|
||||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<span class="mr-4">问题优化</span>
|
||||
<span class="mr-4">{{$t('views.application.applicationForm.form.problemOptimization.label')}}</span>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
content="根据历史聊天优化完善当前问题,更利于匹配知识点。"
|
||||
:content="$t('views.application.applicationForm.form.problemOptimization.tooltip')"
|
||||
placement="right"
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
|
|
@ -226,16 +225,16 @@
|
|||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="text-right border-t p-16">
|
||||
<el-button v-if="!id" @click="router.push({ path: `/application` })"> 取消 </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">
|
||||
{{ id ? '保存' : '创建' }}
|
||||
{{ id ? $t('views.application.applicationForm.buttons.save') : $t('views.application.applicationForm.buttons.create') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="14" class="p-24 border-l">
|
||||
<h4 class="title-decoration-1 mb-16">调试预览</h4>
|
||||
<h4 class="title-decoration-1 mb-16">{{$t('views.application.applicationForm.form.apptest')}}</h4>
|
||||
<div class="dialog-bg">
|
||||
<h4 class="p-24">{{ applicationForm?.name || '应用名称' }}</h4>
|
||||
<h4 class="p-24">{{ applicationForm?.name || $t('views.application.applicationForm.form.appName.label') }}</h4>
|
||||
<div class="scrollbar-height">
|
||||
<AiChat :data="applicationForm"></AiChat>
|
||||
</div>
|
||||
|
|
@ -277,7 +276,7 @@ import type { Provider } from '@/api/type/model'
|
|||
import { relatedObject } from '@/utils/utils'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
|
||||
import { t } from '@/locales'
|
||||
const { model, dataset, application, user } = useStore()
|
||||
|
||||
const router = useRouter()
|
||||
|
|
@ -285,20 +284,8 @@ const route = useRoute()
|
|||
const {
|
||||
params: { id }
|
||||
} = route as any
|
||||
|
||||
const defaultPrompt = `已知信息:
|
||||
{data}
|
||||
回答要求:
|
||||
- 请使用简洁且专业的语言来回答用户的问题。
|
||||
- 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。
|
||||
- 避免提及你是从已知信息中获得的知识。
|
||||
- 请保证答案与已知信息中描述的一致。
|
||||
- 请使用 Markdown 语法优化答案的格式。
|
||||
- 已知信息中的图片、链接地址和脚本语言请直接返回。
|
||||
- 请使用与问题相同的语言来回答。
|
||||
问题:
|
||||
{question}
|
||||
`
|
||||
// @ts-ignore
|
||||
const defaultPrompt =t('views.application.prompt.defaultPrompt')
|
||||
|
||||
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
||||
const createModelRef = ref<InstanceType<typeof CreateModelDialog>>()
|
||||
|
|
@ -314,10 +301,7 @@ const applicationForm = ref<ApplicationFormType>({
|
|||
desc: '',
|
||||
model_id: '',
|
||||
multiple_rounds_dialogue: false,
|
||||
prologue: `您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。
|
||||
- MaxKB 主要功能有什么?
|
||||
- MaxKB 支持哪些大语言模型?
|
||||
- MaxKB 支持哪些文档类型?`,
|
||||
prologue: t('views.application.prompt.defaultPrologue'),
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
top_n: 3,
|
||||
|
|
@ -336,15 +320,15 @@ const applicationForm = ref<ApplicationFormType>({
|
|||
})
|
||||
|
||||
const rules = reactive<FormRules<ApplicationFormType>>({
|
||||
name: [{ required: true, message: '请输入应用名称', trigger: 'blur' }],
|
||||
name: [{ required: true, message: t('views.application.applicationForm.appName.placeholder'), trigger: 'blur' }],
|
||||
model_id: [
|
||||
{
|
||||
required: false,
|
||||
message: '请选择模型',
|
||||
message: t('views.application.applicationForm.aiModel.placeholder'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
'model_setting.prompt': [{ required: true, message: '请输入提示词', trigger: 'blur' }]
|
||||
'model_setting.prompt': [{ required: true, message:t('views.application.applicationForm.prompt.placeholder'), trigger: 'blur' }]
|
||||
})
|
||||
const modelOptions = ref<any>(null)
|
||||
const providerOptions = ref<Array<Provider>>([])
|
||||
|
|
@ -356,11 +340,11 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (valid) {
|
||||
if (id) {
|
||||
application.asyncPutApplication(id, applicationForm.value, loading).then((res) => {
|
||||
MsgSuccess('保存成功')
|
||||
MsgSuccess(t('views.application.buttons.saveSuccess'))
|
||||
})
|
||||
} else {
|
||||
applicationApi.postApplication(applicationForm.value, loading).then((res) => {
|
||||
MsgSuccess('创建成功')
|
||||
MsgSuccess(t('views.application.buttons.createSuccess'))
|
||||
router.push({ path: `/application` })
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<el-dialog title="添加关联知识库" v-model="dialogVisible" width="600">
|
||||
<el-dialog :title="$t('views.application.applicationForm.dialogues.addDataset')" v-model="dialogVisible" width="600">
|
||||
<template #header="{ titleId, titleClass }">
|
||||
<div class="my-header flex">
|
||||
<h4 :id="titleId" :class="titleClass">添加关联知识库</h4>
|
||||
<h4 :id="titleId" :class="titleClass">{{$t('views.application.applicationForm.dialogues.addDataset')}}</h4>
|
||||
<el-button link class="ml-16" @click="refresh">
|
||||
<el-icon class="mr-4"><Refresh /></el-icon>刷新
|
||||
<el-icon class="mr-4"><Refresh /></el-icon>{{$t('views.application.applicationForm.dialogues.refresh')}}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
</el-row>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
|
||||
<el-button type="primary" @click="submitHandle"> 确认 </el-button>
|
||||
<el-button @click.prevent="dialogVisible = false"> {{$t('views.application.applicationForm.buttons.cancel')}} </el-button>
|
||||
<el-button type="primary" @click="submitHandle"> {{$t('views.application.applicationForm.buttons.confirm')}} </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
align-center
|
||||
title="参数设置"
|
||||
:title="$t('views.application.applicationForm.dialogues.paramSettings')"
|
||||
class="param-dialog"
|
||||
v-model="dialogVisible"
|
||||
style="width: 550px"
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
<el-scrollbar always>
|
||||
<div class="p-16">
|
||||
<el-form label-position="top" ref="paramFormRef" :model="form">
|
||||
<el-form-item label="检索模式">
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialogues.selectSearchMode')">
|
||||
<el-radio-group v-model="form.search_mode" class="card__radio" @change="changeHandle">
|
||||
<el-card
|
||||
shadow="never"
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
:class="form.search_mode === 'embedding' ? 'active' : ''"
|
||||
>
|
||||
<el-radio value="embedding" size="large">
|
||||
<p class="mb-4">向量检索</p>
|
||||
<el-text type="info">通过向量距离计算与用户问题最相似的文本分段</el-text>
|
||||
<p class="mb-4">{{$t('views.application.applicationForm.dialogues.vectorSearch')}}</p>
|
||||
<el-text type="info">{{$t('views.application.applicationForm.dialogues.vectorSearchTooltip')}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
<el-card
|
||||
|
|
@ -28,15 +28,15 @@
|
|||
:class="form.search_mode === 'keywords' ? 'active' : ''"
|
||||
>
|
||||
<el-radio value="keywords" size="large">
|
||||
<p class="mb-4">全文检索</p>
|
||||
<el-text type="info">通过关键词检索,返回包含关键词最多的文本分段</el-text>
|
||||
<p class="mb-4">{{$t('views.application.applicationForm.dialogues.fullTextSearch')}}</p>
|
||||
<el-text type="info">{{$t('views.application.applicationForm.dialogues.fullTextSearchTooltip')}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
<el-card shadow="never" :class="form.search_mode === 'blend' ? 'active' : ''">
|
||||
<el-radio value="blend" size="large">
|
||||
<p class="mb-4">混合检索</p>
|
||||
<p class="mb-4">{{$t('views.application.applicationForm.dialogues.hybridSearch')}}</p>
|
||||
<el-text type="info"
|
||||
>同时执行全文检索和向量检索,再进行重排序,从两类查询结果中选择匹配用户问题的最佳结果</el-text
|
||||
>{{$t('views.application.applicationForm.dialogues.hybridSearchTooltip')}}</el-text
|
||||
>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
<el-form-item>
|
||||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<span class="mr-4">相似度高于</span>
|
||||
<span class="mr-4">{{$t('views.application.applicationForm.dialogues.similarityThreshold')}}</span>
|
||||
<el-tooltip effect="dark" content="相似度越高相关性越强。" placement="right">
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
</el-tooltip>
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="引用分段数 TOP">
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialogues.topReferences')">
|
||||
<el-input-number
|
||||
v-model="form.top_n"
|
||||
:min="1"
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="最多引用字符数">
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialogues.maxCharacters')">
|
||||
<el-slider
|
||||
v-model="form.max_paragraph_char_number"
|
||||
show-input
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
class="custom-slider"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="无引用知识库分段时">
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialogues.noReferencesAction')">
|
||||
<el-form
|
||||
label-position="top"
|
||||
ref="noReferencesformRef"
|
||||
|
|
@ -102,10 +102,10 @@
|
|||
>
|
||||
<div>
|
||||
<el-radio value="ai_questioning">
|
||||
<p>继续向 AI 模型提问</p>
|
||||
<p>{{$t('views.application.applicationForm.dialogues.continueQuestioning')}}</p>
|
||||
<el-form-item
|
||||
v-if="form.no_references_setting.status === 'ai_questioning'"
|
||||
label="提示词"
|
||||
:label="$t('views.application.applicationForm.form.prompt.label')"
|
||||
prop="ai_questioning"
|
||||
>
|
||||
<el-input
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
</div>
|
||||
<div class="mt-8">
|
||||
<el-radio value="designated_answer">
|
||||
<p>指定回答内容</p>
|
||||
<p>{{$t('views.application.applicationForm.dialogues.provideAnswer')}}</p>
|
||||
<el-form-item
|
||||
v-if="form.no_references_setting.status === 'designated_answer'"
|
||||
prop="designated_answer"
|
||||
|
|
@ -144,9 +144,9 @@
|
|||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer p-16">
|
||||
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
|
||||
<el-button @click.prevent="dialogVisible = false">{{$t('views.application.applicationForm.buttons.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="submit(noReferencesformRef)" :loading="loading">
|
||||
保存
|
||||
{{$t('views.application.applicationForm.buttons.save')}}
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
import { ref, watch, reactive } from 'vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
import { t } from '@/locales'
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const paramFormRef = ref()
|
||||
|
|
@ -164,8 +164,8 @@ const noReferencesformRef = ref()
|
|||
|
||||
const defaultValue = {
|
||||
ai_questioning: '{question}',
|
||||
designated_answer:
|
||||
'你好,我是 MaxKB 小助手,我的知识库只包含了 MaxKB 产品相关知识,请重新描述您的问题。'
|
||||
// @ts-ignore
|
||||
designated_answer:t('views.application.applicationForm.dialogues.designated_answer')
|
||||
}
|
||||
|
||||
const form = ref<any>({
|
||||
|
|
@ -185,8 +185,8 @@ const noReferencesform = ref<any>({
|
|||
})
|
||||
|
||||
const noReferencesRules = reactive<FormRules<any>>({
|
||||
ai_questioning: [{ required: true, message: '请输入提示词', trigger: 'blur' }],
|
||||
designated_answer: [{ required: true, message: '请输入内容', trigger: 'blur' }]
|
||||
ai_questioning: [{ required: true, message: t('views.application.applicationForm.dialogues.promptPlaceholder'), trigger: 'blur' }],
|
||||
designated_answer: [{ required: true, message: t('views.application.applicationForm.dialogues.concentPlaceholder'), trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="application-list-container p-24" style="padding-top: 16px">
|
||||
<div class="flex-between mb-16">
|
||||
<h3>应用</h3>
|
||||
<h3>{{$t('views.application.applicationList.title')}}</h3>
|
||||
<el-input
|
||||
v-model="searchValue"
|
||||
@change="searchHandle"
|
||||
placeholder="按名称搜索"
|
||||
:placeholder="$t('views.application.applicationList.searchBar.placeholder')"
|
||||
prefix-icon="Search"
|
||||
class="w-240"
|
||||
clearable
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
>
|
||||
<el-row :gutter="15">
|
||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb-16">
|
||||
<CardAdd title="创建应用" @click="router.push({ path: '/application/create' })" />
|
||||
<CardAdd :title="$t('views.application.applicationList.card.createApplication')" @click="router.push({ path: '/application/create' })" />
|
||||
</el-col>
|
||||
<el-col
|
||||
:xs="24"
|
||||
|
|
@ -62,13 +62,13 @@
|
|||
|
||||
<template #footer>
|
||||
<div class="footer-content">
|
||||
<el-tooltip effect="dark" content="演示" placement="top">
|
||||
<el-tooltip effect="dark" :content="$t('views.application.applicationList.card.demo')" placement="top">
|
||||
<el-button text @click.stop @click="getAccessToken(item.id)">
|
||||
<AppIcon iconName="app-view"></AppIcon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<el-tooltip effect="dark" content="设置" placement="top">
|
||||
<el-tooltip effect="dark" :content="$t('views.application.applicationList.card.setting')" placement="top">
|
||||
<el-button
|
||||
text
|
||||
@click.stop="router.push({ path: `/application/${item.id}/setting` })"
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<el-tooltip effect="dark" content="删除" placement="top">
|
||||
<el-tooltip effect="dark" :content="$t('views.application.applicationList.card.delete.tooltip')" placement="top">
|
||||
<el-button text @click.stop="deleteApplication(item)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
|
|
@ -98,6 +98,7 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
|||
import { isAppIcon } from '@/utils/application'
|
||||
import { useRouter } from 'vue-router'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
const { application } = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
|
|
@ -126,15 +127,19 @@ function getAccessToken(id: string) {
|
|||
}
|
||||
|
||||
function deleteApplication(row: any) {
|
||||
MsgConfirm(`是否删除应用:${row.name} ?`, `删除后该应用将不再提供服务,请谨慎操作。`, {
|
||||
confirmButtonText: '删除',
|
||||
confirmButtonClass: 'danger'
|
||||
})
|
||||
MsgConfirm(
|
||||
// @ts-ignore
|
||||
`${t('views.application.applicationList.card.delete.confirmTitle')}:${row.name} ?`,
|
||||
t('views.application.applicationList.card.delete.confirmMessage'), {
|
||||
confirmButtonText: t('views.application.applicationList.card.delete.confirmButton'),
|
||||
cancelButtonText: t('views.application.applicationList.card.delete.cancelButton'),
|
||||
confirmButtonClass: 'danger'
|
||||
})
|
||||
.then(() => {
|
||||
applicationApi.delApplication(row.id, loading).then(() => {
|
||||
const index = applicationList.value.findIndex((v) => v.id === row.id)
|
||||
applicationList.value.splice(index, 1)
|
||||
MsgSuccess('删除成功')
|
||||
MsgSuccess(t('views.application.applicationList.card.delete.successMessage'))
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
|
|
|
|||
Loading…
Reference in New Issue