|
|
@@ -4,6 +4,7 @@ import TableConfiguration from './components/TableConfiguration.vue'
|
|
|
import RespnseConfiguration from './components/RespnseConfiguration.vue'
|
|
|
import OutputConfiguration from './components/OutputConfiguration.vue'
|
|
|
import PreviewTesting from './components/PreviewTesting.vue'
|
|
|
+import submitsucessful from './images/icon_success_big@2x.png'
|
|
|
import moment from 'moment'
|
|
|
|
|
|
const rolename = ref('')
|
|
|
@@ -12,6 +13,7 @@ const professionalfield = ref('')
|
|
|
const tabledescription = ref('')
|
|
|
const maintasks = ref('')
|
|
|
const outputvalue = ref('')
|
|
|
+const editid = ref('')
|
|
|
const prompttextvalue = ref('')
|
|
|
const TableConfigurationref = ref()
|
|
|
const RespnseConfigurationref = ref()
|
|
|
@@ -22,48 +24,9 @@ const promptValue = ref([])
|
|
|
const PromptdialogVisible = ref(false)
|
|
|
const PromptdialogInnerVisible = ref(false)
|
|
|
const testquestion = ref(false)
|
|
|
-const ChangeLogList = ref([
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt1',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL1...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt2',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL2...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt3',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL3...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt4',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL4...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt5',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL5...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt6',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL6...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt7',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL7...'
|
|
|
- },
|
|
|
- {
|
|
|
- time: '2025-04-23 09:30 Prompt8',
|
|
|
- person: '提交人:caroline@kln.com',
|
|
|
- text: '您是专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL专家顾问专門从事货运代理行业的SQL8...'
|
|
|
- }
|
|
|
-])
|
|
|
+const UnableSaveVisible = ref(false)
|
|
|
+const SaveedVisible = ref(false)
|
|
|
+const ChangeLogList = ref([])
|
|
|
const prompttext = ref('')
|
|
|
|
|
|
const AddTableConfiguration = () => {
|
|
|
@@ -87,7 +50,9 @@ const getPromptConfiguration = () => {
|
|
|
formatList.value = res.data.formatList
|
|
|
outputvalue.value = res.data.formatListType
|
|
|
prompttextvalue.value = res.data.complete_prompt
|
|
|
- promptValue.value = res.data['Prompt summary']
|
|
|
+ promptValue.value = res.data.prompt_summary
|
|
|
+ editid.value = res.data.id
|
|
|
+ ChangeLogList.value = res.data.prompt_log_record
|
|
|
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 {
|
|
|
@@ -96,25 +61,68 @@ const getPromptConfiguration = () => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
// 保存
|
|
|
+const missingmessage = ref()
|
|
|
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)
|
|
|
+ missingmessage.value = ''
|
|
|
+ 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 != '') {
|
|
|
+ $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,
|
|
|
+ id: editid.value
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ SaveedVisible.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ window.location.reload()
|
|
|
+ }, 3000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if(rolename.value == '' || professionalfield.value == '' || maintasks.value == '') {
|
|
|
+ missingmessage.value += '系统角色配置, '
|
|
|
}
|
|
|
- })
|
|
|
+ if(tablename.value == '' || tableDataList.value.length == 0) {
|
|
|
+ missingmessage.value += '表结构配置, '
|
|
|
+ }
|
|
|
+ if(stepData.value.length == 0) {
|
|
|
+ missingmessage.value += '响应规则配置, '
|
|
|
+ }
|
|
|
+ if(formatList.value.length == 0 || outputvalue.value == '') {
|
|
|
+ missingmessage.value += '输出格式配置, '
|
|
|
+ }
|
|
|
+ missingmessage.value = missingmessage.value.substring(0, missingmessage.value.length - 2)
|
|
|
+ UnableSaveVisible.value = true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const EditPrompt = () => {
|
|
|
+ $api.EditPrompt({
|
|
|
+ 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,
|
|
|
+ id: editid.value
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ prompttextvalue.value = res.data.complete_prompt
|
|
|
+ promptValue.value = res.data.prompt_summary
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 导出为txt
|
|
|
@@ -202,9 +210,9 @@ onMounted(() => {
|
|
|
<el-button class="el-button--default" @click="exporttxt"><span class="font_family icon-icon_import_b icon_dark" style="margin-right: 5px;" ></span>导出完整日志</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <div class="diaolog-content">
|
|
|
+ <pre class="diaolog-content">
|
|
|
{{ prompttext }}
|
|
|
- </div>
|
|
|
+ </pre>
|
|
|
</el-dialog>
|
|
|
<div class="prompt-content">
|
|
|
<!-- 系统角色设置 -->
|
|
|
@@ -262,10 +270,41 @@ onMounted(() => {
|
|
|
<div class="propmt-border-colorful">
|
|
|
<div class="prompt-title" style="padding: 0 14px;">预览与测试</div>
|
|
|
<div style="margin-top: 16px;">
|
|
|
- <PreviewTesting ref="PreviewTestingref" :prompttext="prompttextvalue" :testquestion="testquestion" :promptValue="promptValue"></PreviewTesting>
|
|
|
+ <PreviewTesting ref="PreviewTestingref" :prompttext="prompttextvalue" :testquestion="testquestion" :promptValue="promptValue" @handleprompt="EditPrompt"></PreviewTesting>
|
|
|
</div>
|
|
|
</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>
|
|
|
+ <!-- 保存失败 -->
|
|
|
+ <el-dialog v-model="UnableSaveVisible" width="480">
|
|
|
+ <div>{{ missingmessage }} missing.</div>
|
|
|
+ <div>Please complete all required fields.</div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button
|
|
|
+ class="el-button--danger"
|
|
|
+ @click="UnableSaveVisible = false"
|
|
|
+ style="width: 100px"
|
|
|
+ >
|
|
|
+ OK
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #header>
|
|
|
+ <div class="cancel_header">
|
|
|
+ <span class="iconfont_icon iconfont_warning">
|
|
|
+ <svg class="iconfont icon_danger" aria-hidden="true">
|
|
|
+ <use xlink:href="#icon-icon_fail_fill_b"></use>
|
|
|
+ </svg>
|
|
|
+ </span>
|
|
|
+ Unable to Save
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 保存成功 -->
|
|
|
+ <el-dialog v-model="SaveedVisible" width="320" style="height: 212px">
|
|
|
+ <div style="text-align: center"><el-image :src="submitsucessful" style="width: 64px;" /></div>
|
|
|
+ <div style="text-align: center; margin-top: 20px">Saved successfully</div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -362,6 +401,8 @@ onMounted(() => {
|
|
|
padding: 16px;
|
|
|
margin-bottom: 8px;
|
|
|
border-radius: 6px;
|
|
|
+ line-height: 21px;
|
|
|
+ white-space: break-spaces;
|
|
|
}
|
|
|
.diaolog-flex {
|
|
|
display: flex;
|
|
|
@@ -416,4 +457,18 @@ onMounted(() => {
|
|
|
color: var(--color-theme);
|
|
|
}
|
|
|
}
|
|
|
+.cancel_header {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: var(--color-neutral-1);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.icon_danger {
|
|
|
+ fill: var(--color-btn-danger-bg);
|
|
|
+}
|
|
|
+.iconfont_warning {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
</style>
|