Merge branch 'dev' of https://gitee.com/red-future---jilin-g/admin-ui into dev
This commit is contained in:
@@ -3,5 +3,5 @@ ENV = 'development'
|
||||
|
||||
# 本地环境接口地址
|
||||
# VITE_API_URL = 'http://192.168.3.200:8808/'
|
||||
VITE_API_URL = 'http://192.168.3.11:8808/'
|
||||
VITE_API_URL = 'http://localhost:8808/'
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const service: AxiosInstance = axios.create({
|
||||
const newService: AxiosInstance = axios.create({
|
||||
// baseURL: 'http://192.168.3.95:8000/',
|
||||
// baseURL: 'http://192.168.3.49:8000/',
|
||||
baseURL: 'http://192.168.3.11:8000/',
|
||||
baseURL: 'http://localhost:8000/',
|
||||
// baseURL: 'http://192.168.3.200:8000/',
|
||||
timeout: 50000,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
@@ -36,6 +36,19 @@
|
||||
提示:留空将使用系统默认提示词模板,创建后也可通过"配置提示词"按钮修改
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="开场白" prop="opener">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="formData.opener"
|
||||
:rows="3"
|
||||
placeholder="留空则使用默认开场白,用户进入对话时首先显示的内容"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
<div style="color: #909399; font-size: 12px; margin-top: 5px;">
|
||||
提示:留空将使用默认开场白,创建后也可通过"配置提示词"按钮修改
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-form>
|
||||
@@ -62,6 +75,7 @@ interface DialogFormData {
|
||||
accountName: string;
|
||||
platform: string;
|
||||
prompt?: string;
|
||||
opener?: string;
|
||||
status: number;
|
||||
creator: '';
|
||||
modifier: '';
|
||||
@@ -80,6 +94,7 @@ const state = reactive({
|
||||
accountName: '',
|
||||
platform: '',
|
||||
prompt: '',
|
||||
opener: '',
|
||||
status: 1,
|
||||
creator: '',
|
||||
modifier: '',
|
||||
@@ -175,6 +190,7 @@ const resetForm = () => {
|
||||
accountName: '',
|
||||
platform: '',
|
||||
prompt: '',
|
||||
opener: '',
|
||||
status: 1,
|
||||
creator: '',
|
||||
modifier: '',
|
||||
|
||||
@@ -20,30 +20,19 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-divider content-position="left">高级配置(可选)</el-divider>
|
||||
|
||||
<el-form-item label="返回chunk数量" prop="topN">
|
||||
<el-input-number v-model="formData.topN" :min="1" :max="20" :step="1" />
|
||||
<span class="form-tip ml10">建议范围:5-20,默认8</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="相似度阈值" prop="similarityThreshold">
|
||||
<el-input-number v-model="formData.similarityThreshold" :min="0" :max="1" :step="0.1" :precision="1" />
|
||||
<span class="form-tip ml10">范围:0-1,越大越严格,默认0.2</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关键词权重" prop="keywordsSimilarityWeight">
|
||||
<el-input-number v-model="formData.keywordsSimilarityWeight" :min="0" :max="1" :step="0.1" :precision="1" />
|
||||
<span class="form-tip ml10">范围:0-1,越大越依赖关键词,默认0.7</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="无匹配时回复" prop="emptyResponse">
|
||||
<el-form-item label="开场白" prop="opener">
|
||||
<el-input
|
||||
v-model="formData.emptyResponse"
|
||||
v-model="formData.opener"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="知识库无匹配时的回复(推荐留空,让LLM基于提示词自由发挥)"
|
||||
placeholder="请输入开场白,用户进入对话时首先显示的内容"
|
||||
show-word-limit
|
||||
maxlength="200"
|
||||
/>
|
||||
<div class="form-tip">
|
||||
<el-icon><ele-InfoFilled /></el-icon>
|
||||
提示:开场白会在用户进入对话时自动发送
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -67,10 +56,7 @@ interface PromptFormData {
|
||||
accountName: string;
|
||||
platform: string;
|
||||
prompt: string;
|
||||
topN: number;
|
||||
similarityThreshold: number;
|
||||
keywordsSimilarityWeight: number;
|
||||
emptyResponse: string;
|
||||
opener: string;
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -84,11 +70,8 @@ const state = reactive({
|
||||
accountName: '',
|
||||
platform: '',
|
||||
prompt: '',
|
||||
topN: 8,
|
||||
similarityThreshold: 0.2,
|
||||
keywordsSimilarityWeight: 0.7,
|
||||
emptyResponse: '',
|
||||
} as PromptFormData,
|
||||
opener: '',
|
||||
},
|
||||
});
|
||||
|
||||
const defaultTemplate = `你是专业的客服顾问,负责帮助客户解答问题。
|
||||
@@ -133,10 +116,7 @@ const openDialog = async (row: any) => {
|
||||
const res: any = await getRAGFlowConfig({ accountName: row.accountName });
|
||||
if (res.code === 0 && res.data) {
|
||||
state.formData.prompt = res.data.prompt || '';
|
||||
state.formData.topN = res.data.topN || 8;
|
||||
state.formData.similarityThreshold = res.data.similarityThreshold || 0.2;
|
||||
state.formData.keywordsSimilarityWeight = res.data.keywordsSimilarityWeight || 0.7;
|
||||
state.formData.emptyResponse = res.data.emptyResponse || '';
|
||||
state.formData.opener = res.data.opener || '';
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取配置失败,使用默认值', error);
|
||||
@@ -164,18 +144,13 @@ const onSubmit = async () => {
|
||||
|
||||
state.loading = true;
|
||||
try {
|
||||
const params: any = {
|
||||
accountName: state.formData.accountName,
|
||||
prompt: state.formData.prompt,
|
||||
const reqData = {
|
||||
accountName: formData.value.accountName,
|
||||
prompt: formData.value.prompt,
|
||||
opener: formData.value.opener,
|
||||
};
|
||||
|
||||
// 只传递非默认值的参数
|
||||
if (state.formData.topN !== 8) params.topN = state.formData.topN;
|
||||
if (state.formData.similarityThreshold !== 0.2) params.similarityThreshold = state.formData.similarityThreshold;
|
||||
if (state.formData.keywordsSimilarityWeight !== 0.7) params.keywordsSimilarityWeight = state.formData.keywordsSimilarityWeight;
|
||||
if (state.formData.emptyResponse) params.emptyResponse = state.formData.emptyResponse;
|
||||
|
||||
const res: any = await updatePrompt(params);
|
||||
const res: any = await updatePrompt(reqData);
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('提示词配置成功');
|
||||
closeDialog();
|
||||
|
||||
@@ -148,6 +148,7 @@ const tableData = reactive<TableState>({
|
||||
|
||||
// 模板引用
|
||||
const editRoleRef = ref<InstanceType<typeof EditAccount>>();
|
||||
const promptConfigRef = ref<InstanceType<typeof PromptConfig>>();
|
||||
|
||||
/**
|
||||
* 获取客服账号列表
|
||||
|
||||
@@ -55,7 +55,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
|
||||
proxy: {
|
||||
'/api': {
|
||||
// target: 'http://192.168.3.200:8808',
|
||||
target: 'http://192.168.3.49:8808',
|
||||
target: 'http://localhost:8808',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user