|
@@ -5,6 +5,7 @@ import moment from 'moment'
|
|
|
|
|
|
|
|
const PromptdialogVisible = ref(false)
|
|
const PromptdialogVisible = ref(false)
|
|
|
const testquestionvalue = ref('')
|
|
const testquestionvalue = ref('')
|
|
|
|
|
+const previewLoading = ref(false)
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
prompttext: {
|
|
prompttext: {
|
|
@@ -35,11 +36,8 @@ watch(
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-const emits = defineEmits(['handleprompt'])
|
|
|
|
|
-
|
|
|
|
|
const handleclickprompt = () => {
|
|
const handleclickprompt = () => {
|
|
|
PromptdialogVisible.value = true
|
|
PromptdialogVisible.value = true
|
|
|
- emits('handleprompt')
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 导出为txt
|
|
// 导出为txt
|
|
@@ -64,18 +62,22 @@ const unformattedJson = ref({})
|
|
|
|
|
|
|
|
const PromptAITest = (val:any) => {
|
|
const PromptAITest = (val:any) => {
|
|
|
if(testquestion.value == false) {
|
|
if(testquestion.value == false) {
|
|
|
|
|
+ unformattedJson.value = {}
|
|
|
|
|
+ previewLoading.value = true
|
|
|
$api.PromptAITest({
|
|
$api.PromptAITest({
|
|
|
test_ai_method: val,
|
|
test_ai_method: val,
|
|
|
test_question: testquestionvalue.value,
|
|
test_question: testquestionvalue.value,
|
|
|
prompt: prompttext.value
|
|
prompt: prompttext.value
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
|
|
+ previewLoading.value = false
|
|
|
unformattedJson.value = res.data
|
|
unformattedJson.value = res.data
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -129,7 +131,7 @@ const PromptAITest = (val:any) => {
|
|
|
<div class="test_title">
|
|
<div class="test_title">
|
|
|
测试结果
|
|
测试结果
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="test_result">
|
|
|
|
|
|
|
+ <div class="test_result" v-vloading="previewLoading">
|
|
|
<div v-if="Object.keys(unformattedJson).length == 0" class="test_result_text">暂无数据</div>
|
|
<div v-if="Object.keys(unformattedJson).length == 0" class="test_result_text">暂无数据</div>
|
|
|
<CodeBlock v-else language="json" :raw-code="JSON.stringify(unformattedJson)">
|
|
<CodeBlock v-else language="json" :raw-code="JSON.stringify(unformattedJson)">
|
|
|
</CodeBlock>
|
|
</CodeBlock>
|
|
@@ -212,6 +214,7 @@ const PromptAITest = (val:any) => {
|
|
|
color: rgba(240, 241, 243, 0.30);
|
|
color: rgba(240, 241, 243, 0.30);
|
|
|
border:1px solid var(--color-border);
|
|
border:1px solid var(--color-border);
|
|
|
border-radius: 6px;
|
|
border-radius: 6px;
|
|
|
|
|
+ position: relative;
|
|
|
}
|
|
}
|
|
|
.test_result_text {
|
|
.test_result_text {
|
|
|
color: rgba(240, 241, 243, 0.30);
|
|
color: rgba(240, 241, 243, 0.30);
|
|
@@ -261,4 +264,11 @@ const PromptAITest = (val:any) => {
|
|
|
padding: 0;
|
|
padding: 0;
|
|
|
height: 48px;
|
|
height: 48px;
|
|
|
}
|
|
}
|
|
|
|
|
+:deep(.v-loading-spinner) {
|
|
|
|
|
+ transform: translateY(30%);
|
|
|
|
|
+}
|
|
|
|
|
+:deep(.circular) {
|
|
|
|
|
+ width: 30px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|