Skip to content

Commit 42d7aeb

Browse files
perf: Generate prompt words to add copy
1 parent 42de3e0 commit 42d7aeb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ui/src/views/application/component/GeneratePromptDialog.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@
3232
{{ $t('views.application.generateDialog.title') }}
3333
</p>
3434
</el-scrollbar>
35+
3536
<div v-if="answer && !loading && !isStreaming && !showContinueButton" class="mt-8">
3637
<el-button type="primary" @click="() => emit('replace', answer)">
3738
{{ $t('views.application.generateDialog.replace') }}
3839
</el-button>
40+
<el-button @click="copyClick(answer)">
41+
{{ $t('common.copy') }}
42+
</el-button>
3943
<el-button @click="reAnswerClick" :disabled="!answer || loading" :loading="loading">
4044
{{ $t('views.application.generateDialog.remake') }}
4145
</el-button>
@@ -101,6 +105,7 @@ import { t } from '@/locales'
101105
import systemGeneratePromptAPI from '@/api/system-resource-management/application'
102106
import generatePromptAPI from '@/api/application/application'
103107
import useStore from '@/stores'
108+
import { copyClick } from '@/utils/clipboard'
104109
const emit = defineEmits(['replace'])
105110
const { user } = useStore()
106111
const route = useRoute()
@@ -209,10 +214,10 @@ const startStreamingOutput = () => {
209214
210215
streamTimer = setInterval(() => {
211216
if (isApiComplete.value && !isPaused.value) {
212-
// 更新显示内容
217+
// 更新显示内容
213218
const currentAnswer = chatMessages.value[chatMessages.value.length - 1]
214219
if (currentAnswer && currentAnswer.role === 'ai') {
215-
currentAnswer.content = fullContent .value
220+
currentAnswer.content = fullContent.value
216221
}
217222
stopStreaming()
218223
return
@@ -357,7 +362,7 @@ const showContinueButton = computed(() => {
357362
})
358363
359364
function generatePrompt(inputValue: any) {
360-
isApiComplete.value=false
365+
isApiComplete.value = false
361366
loading.value = true
362367
const workspaceId = user.getWorkspaceId() || 'default'
363368
chatMessages.value.push({ content: inputValue, role: 'user' })
@@ -397,7 +402,9 @@ function generatePrompt(inputValue: any) {
397402
// 重新生成点击
398403
const reAnswerClick = () => {
399404
if (originalUserInput.value) {
400-
generatePrompt(`上一次回答不满意。请针对原始问题"${originalUserInput.value}"并结合对话记录,严格按照格式规范重新生成。`)
405+
generatePrompt(
406+
`上一次回答不满意。请针对原始问题"${originalUserInput.value}"并结合对话记录,严格按照格式规范重新生成。`,
407+
)
401408
}
402409
}
403410

0 commit comments

Comments
 (0)