Преглед на файлове

feat: 新增只能工作智能体特殊处理

sunxiao преди 7 месеца
родител
ревизия
b903c10b28
променени са 7 файла, в които са добавени 41 реда и са изтрити 19 реда
  1. 6 1
      src/components/Chat/ChatAgentInput.vue
  2. 2 2
      src/components/Chat/index.js
  3. 8 8
      src/router/index.js
  4. 15 0
      src/utils/format.js
  5. 2 1
      src/utils/tools.js
  6. 3 3
      src/views/answer/AnswerView.vue
  7. 5 4
      src/views/work/WorkView.vue

+ 6 - 1
src/components/Chat/ChatInputCopy.vue → src/components/Chat/ChatAgentInput.vue

@@ -1,6 +1,8 @@
 <script setup>
 import { ref, unref, onMounted, onUnmounted, computed, watch } from 'vue';
 import { useMessage, NInput, NSwitch, NPopover, NScrollbar } from 'naive-ui';
+import dayjs from 'dayjs';
+import { getFormatYesterDay } from '@/utils/format';
 import { helperApi } from '@/api/helper';
 import SvgIcon from '@/components/SvgIcon';
 
@@ -176,7 +178,10 @@ const selectOption = (index) => {
 
 onMounted(async () => {
   const { data } = await helperApi.getHelperList();
-  helperList.value = data;
+  
+  const result = getFormatYesterDay(data)
+  console.log("result", result);
+  helperList.value = result;
   document.addEventListener('keydown', handleKeyDown);
   document.addEventListener('click', closePopoverOutside);
 })

+ 2 - 2
src/components/Chat/index.js

@@ -2,7 +2,7 @@ import ChatAsk from './ChatAsk';
 import ChatAnswer from './ChatAnswer';
 import ChatInput from './ChatInput';
 import ChatBaseCard from './ChatBaseCard';
-import ChatInputCopy from './ChatInputCopy';
+import ChatAgentInput from './ChatAgentInput';
 
 
 export { 
@@ -10,5 +10,5 @@ export {
   ChatAnswer,
   ChatInput,
   ChatBaseCard,
-  ChatInputCopy
+  ChatAgentInput
 };

+ 8 - 8
src/router/index.js

@@ -23,14 +23,14 @@ const constantRouterMap = [
    * 注释时间: 2024年08月05日15:03:02
    * 
    * */ 
-  // {
-  //   path: '/count1',
-  //   name: 'count1',
-  //   component: () => import('@/views/count/index1.vue'),
-  //   meta: {
-  //     title: "临时统计1"
-  //   }
-  // },
+  {
+    path: '/count1',
+    name: 'count1',
+    component: () => import('@/views/count/index1.vue'),
+    meta: {
+      title: "临时统计1"
+    }
+  },
   // {
   //   path: '/count2',
   //   name: 'count2',

+ 15 - 0
src/utils/format.js

@@ -1,3 +1,4 @@
+import dayjs from "dayjs";
 import { ORDER_OPTION_ENUM } from "./enum";
 
 
@@ -70,3 +71,17 @@ export const colorToRgba = (color, alpha) => {
 export const isNumberComprehensive = (value) => {
   return isFinite(value) && !isNaN(parseFloat(value));
 }
+
+
+// 获取昨日时间
+export const getFormatYesterDay = ( data ) => {
+  return data.map(item => {
+    const { tools } = item;
+    if ( tools === 'work_order' ) {
+      const yesterday = dayjs().subtract(1, 'day').format('M月D日');
+      item.content = `帮我生成${yesterday}的工单`;
+      item.prompt = `帮我生成${yesterday}的工单`;;
+    }
+    return item;
+  })
+}

+ 2 - 1
src/utils/tools.js

@@ -141,4 +141,5 @@ export const debounce = (func, wait) => {
       func.apply(context, args);
     }, wait);
   };
-}
+}
+

+ 3 - 3
src/views/answer/AnswerView.vue

@@ -3,7 +3,7 @@ import { ref, unref, computed, onMounted, onUnmounted } from 'vue';
 import { useMessage } from 'naive-ui';
 import { useChatStore } from '@/stores/modules/chatStore';
 import { BaseButton, RecodeCardItem, TheSubMenu, TheChatView, ChatWelcome } from '@/components';
-import { ChatAsk, ChatAnswer, ChatInputCopy } from '@/components/Chat';
+import { ChatAsk, ChatAnswer, ChatAgentInput } from '@/components/Chat';
 import { chatApi } from '@/api/chat';
 
 import { useInfinite, useScroll, useChat, useRecommend } from '@/composables';
@@ -232,14 +232,14 @@ onUnmounted(() => {
       </div>
 
       <template #footer>
-        <ChatInputCopy
+        <ChatAgentInput
           :active-item="activeItem"
           ref="inputRef"
           v-model:loading="isLoading"
           v-model:switch="switchActive"
           @on-click="handleSubmit"
           @on-enter="handleSubmit"
-        ></ChatInputCopy>
+        ></ChatAgentInput>
         <!-- <ChatInput ref="inputRef" v-model:loading="isLoading" v-model:switch="switchActive" @on-click="handleSubmit"
           @on-enter="handleSubmit"></ChatInput> -->
       </template>

+ 5 - 4
src/views/work/WorkView.vue

@@ -2,7 +2,8 @@
 import { ref, unref, computed, onMounted, onUnmounted } from 'vue';
 import { useMessage } from 'naive-ui';
 import { BaseButton, RecodeCardItem, TheSubMenu, TheChatView, ChatWelcome, SvgIcon } from '@/components';
-import { ChatAsk, ChatAnswer, ChatInputCopy } from '@/components/Chat';
+import { ChatAsk, ChatAnswer, ChatAgentInput } from '@/components/Chat';
+import { getFormatYesterDay } from '@/utils/format';
 import { chatApi } from '@/api/chat';
 import { helperApi } from '@/api/helper';
 
@@ -182,7 +183,7 @@ const handleback = async () => {
 
 onMounted(async () => {
   const { data } = await helperApi.getHelperList();
-  helperList.value = data;
+  helperList.value = getFormatYesterDay(data);
 })
 
 onUnmounted(() => {
@@ -244,14 +245,14 @@ onUnmounted(() => {
       </div>
 
       <template #footer>
-        <ChatInputCopy
+        <ChatAgentInput
           :active-item="activeItem"
           ref="inputRef"
           v-model:loading="isLoading"
           v-model:switch="switchActive"
           @on-click="handleSubmit"
           @on-enter="handleSubmit"
-        ></ChatInputCopy>
+        ></ChatAgentInput>
       </template>
     </TheChatView>
   </section>