|
32 | 32 | {{ $t('views.application.generateDialog.title') }} |
33 | 33 | </p> |
34 | 34 | </el-scrollbar> |
| 35 | + |
35 | 36 | <div v-if="answer && !loading && !isStreaming && !showContinueButton" class="mt-8"> |
36 | 37 | <el-button type="primary" @click="() => emit('replace', answer)"> |
37 | 38 | {{ $t('views.application.generateDialog.replace') }} |
38 | 39 | </el-button> |
| 40 | + <el-button @click="copyClick(answer)"> |
| 41 | + {{ $t('common.copy') }} |
| 42 | + </el-button> |
39 | 43 | <el-button @click="reAnswerClick" :disabled="!answer || loading" :loading="loading"> |
40 | 44 | {{ $t('views.application.generateDialog.remake') }} |
41 | 45 | </el-button> |
@@ -101,6 +105,7 @@ import { t } from '@/locales' |
101 | 105 | import systemGeneratePromptAPI from '@/api/system-resource-management/application' |
102 | 106 | import generatePromptAPI from '@/api/application/application' |
103 | 107 | import useStore from '@/stores' |
| 108 | +import { copyClick } from '@/utils/clipboard' |
104 | 109 | const emit = defineEmits(['replace']) |
105 | 110 | const { user } = useStore() |
106 | 111 | const route = useRoute() |
@@ -209,10 +214,10 @@ const startStreamingOutput = () => { |
209 | 214 |
|
210 | 215 | streamTimer = setInterval(() => { |
211 | 216 | if (isApiComplete.value && !isPaused.value) { |
212 | | - // 更新显示内容 |
| 217 | + // 更新显示内容 |
213 | 218 | const currentAnswer = chatMessages.value[chatMessages.value.length - 1] |
214 | 219 | if (currentAnswer && currentAnswer.role === 'ai') { |
215 | | - currentAnswer.content = fullContent .value |
| 220 | + currentAnswer.content = fullContent.value |
216 | 221 | } |
217 | 222 | stopStreaming() |
218 | 223 | return |
@@ -357,7 +362,7 @@ const showContinueButton = computed(() => { |
357 | 362 | }) |
358 | 363 |
|
359 | 364 | function generatePrompt(inputValue: any) { |
360 | | - isApiComplete.value=false |
| 365 | + isApiComplete.value = false |
361 | 366 | loading.value = true |
362 | 367 | const workspaceId = user.getWorkspaceId() || 'default' |
363 | 368 | chatMessages.value.push({ content: inputValue, role: 'user' }) |
@@ -397,7 +402,9 @@ function generatePrompt(inputValue: any) { |
397 | 402 | // 重新生成点击 |
398 | 403 | const reAnswerClick = () => { |
399 | 404 | if (originalUserInput.value) { |
400 | | - generatePrompt(`上一次回答不满意。请针对原始问题"${originalUserInput.value}"并结合对话记录,严格按照格式规范重新生成。`) |
| 405 | + generatePrompt( |
| 406 | + `上一次回答不满意。请针对原始问题"${originalUserInput.value}"并结合对话记录,严格按照格式规范重新生成。`, |
| 407 | + ) |
401 | 408 | } |
402 | 409 | } |
403 | 410 |
|
|
0 commit comments