添加意见反馈配置,控制对话评价是否显示
This commit is contained in:
1 parent
ef0ae7fe08
commit
2bd27ed70d
2 files changed
+10
-9
No files matched your search
@@ -1,4 +1,4 @@
|
||||
export const config = {
|
||||
export const config = {
|
||||
appTitle: 'AI工作台',
|
||||
auth: {
|
||||
wecom: {
|
||||
@@ -12,13 +12,14 @@ export const config = {
|
||||
}
|
||||
},
|
||||
workspace: {
|
||||
enableFeedback: true,
|
||||
// true 显示评分区;false 隐藏评分区
|
||||
showChatRating: false,
|
||||
// 聊天窗口“源文件展示”开关配置
|
||||
sourceFiles: {
|
||||
// 是否显示源文件区域(包含上方文件按钮 + 下方“源文档”详情)
|
||||
showSourceFiles: true,
|
||||
// 是否显示 MD 源文件(文件名后缀为 .md/.markdown)
|
||||
showMdFiles: true,
|
||||
showMdFiles: false,
|
||||
// 当 showMdFiles=true 时,MD 源文件是否默认展开“源文档”详情
|
||||
expandMdByDefault: false,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
@@ -528,17 +528,17 @@ onMounted(async () => {
|
||||
handleSend();
|
||||
}
|
||||
// Use config from config.ts instead of API
|
||||
enableFeedback.value = config.workspace.enableFeedback;
|
||||
showChatRating.value = config.workspace.showChatRating;
|
||||
});
|
||||
|
||||
/**
|
||||
* 反馈相关状态
|
||||
* enableFeedback:是否启用评分功能(后续可接入配置)
|
||||
* showChatRating:是否启用评分功能(后续可接入配置)
|
||||
* rating:用户选择的评分(1-5)
|
||||
* feedbackComment:用户输入的文字意见
|
||||
* feedbackSubmitted:是否已经提交反馈
|
||||
*/
|
||||
const enableFeedback = ref(true);
|
||||
const showChatRating = ref(false);
|
||||
const rating = ref<number | null>(null);
|
||||
const feedbackComment = ref('');
|
||||
const feedbackSubmitted = ref(false);
|
||||
@@ -548,7 +548,7 @@ const feedbackSubmitted = ref(false);
|
||||
* 用途:将评分与评论提交到后端 /api/chat/feedback
|
||||
*/
|
||||
const submitFeedback = async () => {
|
||||
if (!enableFeedback.value || feedbackSubmitted.value) return;
|
||||
if (!showChatRating.value || feedbackSubmitted.value) return;
|
||||
if (!rating.value) {
|
||||
showMessageDialog('warning', t('chat.feedback.selectRating'));
|
||||
return;
|
||||
@@ -841,7 +841,7 @@ const submitFeedback = async () => {
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="enableFeedback && messages.length > 0 && !isThinking"
|
||||
v-if="showChatRating && messages.length > 0 && !isThinking"
|
||||
class="mx-auto mt-8 max-w-5xl border-t border-slate-200/80 pt-8 dark:border-slate-700/70"
|
||||
>
|
||||
<div class="glass-panel flex flex-col items-center gap-4 rounded-2xl p-6">
|
||||
|
||||
Reference in new issue
Block a user