|
@@ -7,12 +7,21 @@ import PreviewTesting from './components/PreviewTesting.vue'
|
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
|
|
|
|
|
|
const rolename = ref('')
|
|
const rolename = ref('')
|
|
|
|
|
+const tablename = ref('')
|
|
|
const professionalfield = ref('')
|
|
const professionalfield = ref('')
|
|
|
|
|
+const tabledescription = ref('')
|
|
|
const maintasks = ref('')
|
|
const maintasks = ref('')
|
|
|
|
|
+const outputvalue = ref('')
|
|
|
|
|
+const prompttextvalue = ref('')
|
|
|
const TableConfigurationref = ref()
|
|
const TableConfigurationref = ref()
|
|
|
const RespnseConfigurationref = ref()
|
|
const RespnseConfigurationref = ref()
|
|
|
|
|
+const tableDataList = ref([])
|
|
|
|
|
+const stepData = ref([])
|
|
|
|
|
+const formatList = ref([])
|
|
|
|
|
+const promptValue = ref([])
|
|
|
const PromptdialogVisible = ref(false)
|
|
const PromptdialogVisible = ref(false)
|
|
|
const PromptdialogInnerVisible = ref(false)
|
|
const PromptdialogInnerVisible = ref(false)
|
|
|
|
|
+const testquestion = ref(false)
|
|
|
const ChangeLogList = ref([
|
|
const ChangeLogList = ref([
|
|
|
{
|
|
{
|
|
|
time: '2025-04-23 09:30 Prompt1',
|
|
time: '2025-04-23 09:30 Prompt1',
|
|
@@ -65,23 +74,48 @@ const addstepdata = () => {
|
|
|
RespnseConfigurationref.value.addstepdata()
|
|
RespnseConfigurationref.value.addstepdata()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const stepData = ref([
|
|
|
|
|
- {
|
|
|
|
|
- description: '分析用户的具体问题,确定是否可以通过现有的表字段进行查询。'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- description: '如果查询可行,根据确定的条件生成可直接执行的SQL语句。'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- description: '如果因为表的字段未覆盖不能查询,说明原因,并联网查询该用户问题,并以KLN公司业务代表的角度回答问题,放在response里,如果回复要使用公司名称,请使用:KLN。'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- description: '如果不能查询是因为问题缺失具体条件,请在response里面反馈让客户输入具体的reference number来进行查询。'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- description: '请使用与用户消息相同的语言回复。如果用户使用中文提问,请用中文回答;如果用户使用英文提问,请使用英文回答;以此类推。始终以用户实际使用的语言为准,不要参考system prompt的语言。'
|
|
|
|
|
- }
|
|
|
|
|
-])
|
|
|
|
|
|
|
+const getPromptConfiguration = () => {
|
|
|
|
|
+ $api.getPromptConfiguration().then((res) => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ rolename.value = res.data.character_name
|
|
|
|
|
+ professionalfield.value = res.data.professional_field
|
|
|
|
|
+ maintasks.value = res.data.main_tasks
|
|
|
|
|
+ tablename.value = res.data.table_name
|
|
|
|
|
+ tabledescription.value = res.data.table_description
|
|
|
|
|
+ tableDataList.value = res.data.tableData
|
|
|
|
|
+ stepData.value = res.data.stepData
|
|
|
|
|
+ formatList.value = res.data.formatList
|
|
|
|
|
+ outputvalue.value = res.data.formatListType
|
|
|
|
|
+ prompttextvalue.value = res.data.complete_prompt
|
|
|
|
|
+ promptValue.value = res.data['Prompt summary']
|
|
|
|
|
+ if(rolename.value != '' && professionalfield.value != '' && maintasks.value != '' && professionalfield.value != '' && tableDataList.value.length != 0 && stepData.value.length != 0 && formatList.value.length != 0 && outputvalue.value != '' && prompttextvalue.value != '') {
|
|
|
|
|
+ testquestion.value = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ testquestion.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 保存
|
|
|
|
|
+const SavePromptConfiguration = () => {
|
|
|
|
|
+ $api.SavePromptConfiguration({
|
|
|
|
|
+ role_name: rolename.value,
|
|
|
|
|
+ professional_field: professionalfield.value,
|
|
|
|
|
+ main_tasks: maintasks.value,
|
|
|
|
|
+ table_name: tablename.value,
|
|
|
|
|
+ table_description: tabledescription.value,
|
|
|
|
|
+ tableDataList: tableDataList.value,
|
|
|
|
|
+ stepData: stepData.value,
|
|
|
|
|
+ formatList: formatList.value,
|
|
|
|
|
+ outputvalue: outputvalue.value,
|
|
|
|
|
+ prompttextvalue: prompttextvalue.value
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ console.log(res.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 导出为txt
|
|
// 导出为txt
|
|
|
const exporttxt = () => {
|
|
const exporttxt = () => {
|
|
@@ -103,7 +137,6 @@ const exporttxt = () => {
|
|
|
|
|
|
|
|
// 查看日志
|
|
// 查看日志
|
|
|
const ViewPrompt = (item: any) => {
|
|
const ViewPrompt = (item: any) => {
|
|
|
- console.log(item)
|
|
|
|
|
PromptdialogInnerVisible.value = true
|
|
PromptdialogInnerVisible.value = true
|
|
|
prompttext.value = item
|
|
prompttext.value = item
|
|
|
}
|
|
}
|
|
@@ -113,6 +146,9 @@ const Backprompt = () => {
|
|
|
PromptdialogInnerVisible.value = false
|
|
PromptdialogInnerVisible.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ getPromptConfiguration()
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -120,7 +156,7 @@ const Backprompt = () => {
|
|
|
<div>Prompt Configuration</div>
|
|
<div>Prompt Configuration</div>
|
|
|
<div>
|
|
<div>
|
|
|
<el-button class="el-button--default title-button" style="margin-right: 8px;" @click="PromptdialogVisible = true"><span class="font_family icon-icon_dashboard_b icon_dark" style="margin-right: 5px;"></span>变更日志查看</el-button>
|
|
<el-button class="el-button--default title-button" style="margin-right: 8px;" @click="PromptdialogVisible = true"><span class="font_family icon-icon_dashboard_b icon_dark" style="margin-right: 5px;"></span>变更日志查看</el-button>
|
|
|
- <el-button class="el-button--main title-button"><span class="font_family icon-icon_save_b icon_dark" style="margin-right: 5px;"></span>保存生效</el-button>
|
|
|
|
|
|
|
+ <el-button class="el-button--main title-button" @click="SavePromptConfiguration"><span class="font_family icon-icon_save_b icon_dark" style="margin-right: 5px;"></span>保存生效</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<el-dialog
|
|
<el-dialog
|
|
@@ -195,16 +231,16 @@ const Backprompt = () => {
|
|
|
<div class="flex">
|
|
<div class="flex">
|
|
|
<div style="width: 50%; margin-right: 8px;">
|
|
<div style="width: 50%; margin-right: 8px;">
|
|
|
<div class="little-title"><span class="stars_red">*</span>表名</div>
|
|
<div class="little-title"><span class="stars_red">*</span>表名</div>
|
|
|
- <el-input v-model="rolename" placeholder="创建一个表名" class="input-name"></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="tablename" placeholder="创建一个表名" class="input-name"></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
<div style="width: 50%;">
|
|
<div style="width: 50%;">
|
|
|
<div class="little-title">表描述</div>
|
|
<div class="little-title">表描述</div>
|
|
|
- <el-input v-model="professionalfield" placeholder="简要描述表的用途" class="input-name"></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="tabledescription" placeholder="简要描述表的用途" class="input-name"></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div style="margin-top: 16px;">
|
|
<div style="margin-top: 16px;">
|
|
|
<el-button class="el-button--noborder--configuration prompt-button" @click="AddTableConfiguration">+ 添加字段</el-button>
|
|
<el-button class="el-button--noborder--configuration prompt-button" @click="AddTableConfiguration">+ 添加字段</el-button>
|
|
|
- <TableConfiguration ref="TableConfigurationref"></TableConfiguration>
|
|
|
|
|
|
|
+ <TableConfiguration ref="TableConfigurationref" :tableDataList="tableDataList"></TableConfiguration>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 响应规则配置 -->
|
|
<!-- 响应规则配置 -->
|
|
@@ -219,17 +255,17 @@ const Backprompt = () => {
|
|
|
<div class="prompt-border">
|
|
<div class="prompt-border">
|
|
|
<div class="prompt-title">输出格式配置</div>
|
|
<div class="prompt-title">输出格式配置</div>
|
|
|
<div style="margin-top: 16px;">
|
|
<div style="margin-top: 16px;">
|
|
|
- <OutputConfiguration ref="OutputConfigurationref"></OutputConfiguration>
|
|
|
|
|
|
|
+ <OutputConfiguration ref="OutputConfigurationref" :formatList="formatList" :outputvalue="outputvalue"></OutputConfiguration>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 预览与测试 -->
|
|
<!-- 预览与测试 -->
|
|
|
<div class="propmt-border-colorful">
|
|
<div class="propmt-border-colorful">
|
|
|
<div class="prompt-title" style="padding: 0 14px;">预览与测试</div>
|
|
<div class="prompt-title" style="padding: 0 14px;">预览与测试</div>
|
|
|
<div style="margin-top: 16px;">
|
|
<div style="margin-top: 16px;">
|
|
|
- <PreviewTesting ref="PreviewTestingref"></PreviewTesting>
|
|
|
|
|
|
|
+ <PreviewTesting ref="PreviewTestingref" :prompttext="prompttextvalue" :testquestion="testquestion" :promptValue="promptValue"></PreviewTesting>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="propmt-save"><el-button class="el-button--main"><span class="font_family icon-icon_save_b icon_dark" style="margin-right: 5px;"></span>保存生效</el-button></div>
|
|
|
|
|
|
|
+ <div class="propmt-save"><el-button class="el-button--main" @click="SavePromptConfiguration"><span class="font_family icon-icon_save_b icon_dark" style="margin-right: 5px;"></span>保存生效</el-button></div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|