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.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({
|
const newService: AxiosInstance = axios.create({
|
||||||
// baseURL: 'http://192.168.3.95:8000/',
|
// baseURL: 'http://192.168.3.95:8000/',
|
||||||
// baseURL: 'http://192.168.3.49: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/',
|
// baseURL: 'http://192.168.3.200:8000/',
|
||||||
timeout: 50000,
|
timeout: 50000,
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|||||||
@@ -36,6 +36,19 @@
|
|||||||
提示:留空将使用系统默认提示词模板,创建后也可通过"配置提示词"按钮修改
|
提示:留空将使用系统默认提示词模板,创建后也可通过"配置提示词"按钮修改
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</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-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -62,6 +75,7 @@ interface DialogFormData {
|
|||||||
accountName: string;
|
accountName: string;
|
||||||
platform: string;
|
platform: string;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
opener?: string;
|
||||||
status: number;
|
status: number;
|
||||||
creator: '';
|
creator: '';
|
||||||
modifier: '';
|
modifier: '';
|
||||||
@@ -80,6 +94,7 @@ const state = reactive({
|
|||||||
accountName: '',
|
accountName: '',
|
||||||
platform: '',
|
platform: '',
|
||||||
prompt: '',
|
prompt: '',
|
||||||
|
opener: '',
|
||||||
status: 1,
|
status: 1,
|
||||||
creator: '',
|
creator: '',
|
||||||
modifier: '',
|
modifier: '',
|
||||||
@@ -175,6 +190,7 @@ const resetForm = () => {
|
|||||||
accountName: '',
|
accountName: '',
|
||||||
platform: '',
|
platform: '',
|
||||||
prompt: '',
|
prompt: '',
|
||||||
|
opener: '',
|
||||||
status: 1,
|
status: 1,
|
||||||
creator: '',
|
creator: '',
|
||||||
modifier: '',
|
modifier: '',
|
||||||
|
|||||||
@@ -20,30 +20,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-divider content-position="left">高级配置(可选)</el-divider>
|
<el-form-item label="开场白" prop="opener">
|
||||||
|
|
||||||
<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-input
|
<el-input
|
||||||
v-model="formData.emptyResponse"
|
v-model="formData.opener"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="3"
|
: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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@@ -67,10 +56,7 @@ interface PromptFormData {
|
|||||||
accountName: string;
|
accountName: string;
|
||||||
platform: string;
|
platform: string;
|
||||||
prompt: string;
|
prompt: string;
|
||||||
topN: number;
|
opener: string;
|
||||||
similarityThreshold: number;
|
|
||||||
keywordsSimilarityWeight: number;
|
|
||||||
emptyResponse: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -84,11 +70,8 @@ const state = reactive({
|
|||||||
accountName: '',
|
accountName: '',
|
||||||
platform: '',
|
platform: '',
|
||||||
prompt: '',
|
prompt: '',
|
||||||
topN: 8,
|
opener: '',
|
||||||
similarityThreshold: 0.2,
|
},
|
||||||
keywordsSimilarityWeight: 0.7,
|
|
||||||
emptyResponse: '',
|
|
||||||
} as PromptFormData,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultTemplate = `你是专业的客服顾问,负责帮助客户解答问题。
|
const defaultTemplate = `你是专业的客服顾问,负责帮助客户解答问题。
|
||||||
@@ -133,10 +116,7 @@ const openDialog = async (row: any) => {
|
|||||||
const res: any = await getRAGFlowConfig({ accountName: row.accountName });
|
const res: any = await getRAGFlowConfig({ accountName: row.accountName });
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
state.formData.prompt = res.data.prompt || '';
|
state.formData.prompt = res.data.prompt || '';
|
||||||
state.formData.topN = res.data.topN || 8;
|
state.formData.opener = res.data.opener || '';
|
||||||
state.formData.similarityThreshold = res.data.similarityThreshold || 0.2;
|
|
||||||
state.formData.keywordsSimilarityWeight = res.data.keywordsSimilarityWeight || 0.7;
|
|
||||||
state.formData.emptyResponse = res.data.emptyResponse || '';
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('获取配置失败,使用默认值', error);
|
console.log('获取配置失败,使用默认值', error);
|
||||||
@@ -164,18 +144,13 @@ const onSubmit = async () => {
|
|||||||
|
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
try {
|
try {
|
||||||
const params: any = {
|
const reqData = {
|
||||||
accountName: state.formData.accountName,
|
accountName: formData.value.accountName,
|
||||||
prompt: state.formData.prompt,
|
prompt: formData.value.prompt,
|
||||||
|
opener: formData.value.opener,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只传递非默认值的参数
|
const res: any = await updatePrompt(reqData);
|
||||||
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);
|
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
ElMessage.success('提示词配置成功');
|
ElMessage.success('提示词配置成功');
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ const tableData = reactive<TableState>({
|
|||||||
|
|
||||||
// 模板引用
|
// 模板引用
|
||||||
const editRoleRef = ref<InstanceType<typeof EditAccount>>();
|
const editRoleRef = ref<InstanceType<typeof EditAccount>>();
|
||||||
|
const promptConfigRef = ref<InstanceType<typeof PromptConfig>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取客服账号列表
|
* 获取客服账号列表
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
|
|||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
// target: 'http://192.168.3.200:8808',
|
// target: 'http://192.168.3.200:8808',
|
||||||
target: 'http://192.168.3.49:8808',
|
target: 'http://localhost:8808',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user