CzRger 3 dagar sedan
förälder
incheckning
f9bbf730c0

+ 1 - 0
src/out/config.js

@@ -1,6 +1,7 @@
 window.czrConfig = {
 window.czrConfig = {
   menuLayout: 'top-left', //  'left'-左侧,'top-left'-顶部左侧
   menuLayout: 'top-left', //  'left'-左侧,'top-left'-顶部左侧
   dify: {
   dify: {
+    // appId: '86945884-adf3-4e22-91b2-e48c38b44e9e'
     appId: 'b9aca5c8-f0bb-4313-965f-3375d7a55579'
     appId: 'b9aca5c8-f0bb-4313-965f-3375d7a55579'
   }
   }
 }
 }

+ 17 - 7
src/views/smart-ask-answer/assistant/chat.vue

@@ -13,6 +13,7 @@
             @onGood="onGood"
             @onGood="onGood"
             @onBad="onBad"
             @onBad="onBad"
             @onNormal="onNormal"
             @onNormal="onNormal"
+            @setText="val => setText(val.text, val.send)"
           />
           />
         </template>
         </template>
       </template>
       </template>
@@ -39,7 +40,7 @@
           </div>
           </div>
           <div class="cibo-split"/>
           <div class="cibo-split"/>
           <el-tooltip content="发送" placement="top">
           <el-tooltip content="发送" placement="top">
-            <div class="cibo-send __hover" @click="onSend">
+            <div class="cibo-send __hover" @click="$czrUtil.isValue(state.text.trim()) ? onSend() : undefined">
               <img src="@/views/smart-ask-answer/assistant/imgs/send.png"/>
               <img src="@/views/smart-ask-answer/assistant/imgs/send.png"/>
             </div>
             </div>
           </el-tooltip>
           </el-tooltip>
@@ -81,11 +82,15 @@ const state: any = reactive({
 const ref_text = ref()
 const ref_text = ref()
 const ref_chatMsg = ref()
 const ref_chatMsg = ref()
 const ref_auto = ref()
 const ref_auto = ref()
-const onSend = () => {
+const onSend = (text) => {
   state.loading = true
   state.loading = true
-  state.params.query = state.text + ''
+  if (text) {
+    state.params.query = text
+  } else {
+    state.params.query = state.text + ''
+    state.text = ''
+  }
   emit('getText', state.params.query)
   emit('getText', state.params.query)
-  state.text = ''
   const ask = {
   const ask = {
     type: 'ask',
     type: 'ask',
     content: state.params.query + ''
     content: state.params.query + ''
@@ -156,14 +161,19 @@ const initChat = () => {
         {
         {
           type: 'answer',
           type: 'answer',
           welcome: true,
           welcome: true,
-          content: res.opening_statement
+          content: res.opening_statement,
+          question: res.suggested_questions
         },
         },
       ]
       ]
     }
     }
   })
   })
 }
 }
-const setText = (text: string) => {
-  state.text = text
+const setText = (text: string, send = false) => {
+  if (send) {
+    onSend(text)
+  } else {
+    state.text = text
+  }
 }
 }
 const onGood = (item) => {
 const onGood = (item) => {
   updateFeedback({
   updateFeedback({

+ 1 - 2
src/views/smart-ask-answer/assistant/cms/api.ts

@@ -60,5 +60,4 @@ export const policyInfoQueryPolicyInfolist = (params) => post(
     }
     }
   },
   },
   'json'
   'json'
-)
-
+)

+ 20 - 2
src/views/smart-ask-answer/assistant/component/answer/index.vue

@@ -4,7 +4,14 @@
       <img src="@/views/smart-ask-answer/assistant/imgs/avatar.png"/>
       <img src="@/views/smart-ask-answer/assistant/imgs/avatar.png"/>
     </div>
     </div>
     <div class="answer-content">
     <div class="answer-content">
-      <template v-if="item.welcome">{{ item.content }}</template>
+      <template v-if="item.welcome">
+        <div class="answer-content-text">{{ item.content }}</div>
+        <div class="answer-content-question" v-if="item.question?.length > 0">
+          <template v-for="ques in item.question">
+            <div class="ques-item __hover" @click="$emit('setText', {text: ques, send: true})">{{ques}}</div>
+          </template>
+        </div>
+      </template>
       <template v-else>
       <template v-else>
         <template v-for="part in contentCpt">
         <template v-for="part in contentCpt">
           <template v-if="part.type === 'think'">
           <template v-if="part.type === 'think'">
@@ -160,7 +167,18 @@ const onCopy = (text) => {
     font-weight: 400;
     font-weight: 400;
     font-size: 16px;
     font-size: 16px;
     color: #111111;
     color: #111111;
-    .answer-markdown {
+    .answer-content-question {
+      margin-top: 10px;
+      display: flex;
+      flex-wrap: wrap;
+      gap: 4px;
+      .ques-item {
+        padding: 6px 14px;
+        border-radius: 8px;
+        border: 1px solid #10182824;
+        font-size: 14px;
+        color: #1D64FD;
+      }
     }
     }
   }
   }
   .answer-operation {
   .answer-operation {

+ 8 - 3
src/views/smart-ask-answer/assistant/index.vue

@@ -41,7 +41,7 @@
             <div class="list_1">
             <div class="list_1">
               <template v-for="item in state.hotList.question">
               <template v-for="item in state.hotList.question">
                 <div class="item">
                 <div class="item">
-                  <span class="__hover" @click="ref_chat.setText(item.hotContent)">{{item.hotContent}}</span>
+                  <span class="__hover" @click="ref_chat.setText(item.hotContent, true)">{{item.hotContent}}</span>
                 </div>
                 </div>
               </template>
               </template>
             </div>
             </div>
@@ -53,14 +53,14 @@
             <div class="options">
             <div class="options">
               <template v-for="(item, index) in state.adviseList.options">
               <template v-for="(item, index) in state.adviseList.options">
                 <div v-if="index > 0" class="split"/>
                 <div v-if="index > 0" class="split"/>
-                <div class="__hover" @click="state.adviseList.value = item.value">{{item.label}}</div>
+                <div class="text __hover" :class="{active: state.adviseList.value == item.value}" @click="state.adviseList.value = item.value">{{item.label}}</div>
               </template>
               </template>
             </div>
             </div>
           </div>
           </div>
           <div class="list_1">
           <div class="list_1">
             <template v-for="item in state.adviseList[state.adviseList.value]">
             <template v-for="item in state.adviseList[state.adviseList.value]">
               <div class="item">
               <div class="item">
-                <span class="__hover" @click="ref_chat.setText(item)">{{item}}</span>
+                <span class="__hover" @click="ref_chat.setText(item, true)">{{item}}</span>
               </div>
               </div>
             </template>
             </template>
           </div>
           </div>
@@ -503,6 +503,11 @@ onMounted(() => {
               height: 14px;
               height: 14px;
               background: #1D64FD;
               background: #1D64FD;
             }
             }
+            .text {
+              &.active {
+                color: #d32520;
+              }
+            }
           }
           }
         }
         }
       }
       }