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

feat: 增加@选取智能体的功能

sunxiao преди 8 месеца
родител
ревизия
97ebc5b46c
променени са 3 файла, в които са добавени 12 реда и са изтрити 4 реда
  1. 9 1
      src/components/Chat/ChatInputCopy.vue
  2. 0 2
      src/views/analyse/WaterView.vue
  3. 3 1
      src/views/work/WorkView.vue

+ 9 - 1
src/components/Chat/ChatInputCopy.vue

@@ -10,6 +10,10 @@ const props = defineProps({
     type: Array,
     default: []
   },
+  activeItem: {
+    type: Object,
+    default: () => ({})
+  }
 });
 
 const emit = defineEmits(['onClick', 'onEnter']);
@@ -24,8 +28,8 @@ const inpRef = ref(null);
 const isFocusState = ref(false);
 
 const isOpen = ref(false);
-const selectedOption = ref(null);
 const highlightedIndex = ref(0);
+const selectedOption = ref(null);
 
 const popoverTriggerRef = ref(null);
 const popoverInnerRef = ref(null);
@@ -48,6 +52,10 @@ watch(inpVal, (curVal) => {
   // isOpen.value = (curVal === "@" && curVal.length === 1);
 })
 
+watch(() => props.activeItem, (curVal) => {
+  selectedOption.value = curVal?.tools ? curVal :  null;
+})
+
 const handleInpFocus = () => {
   inpRef.value?.focus();
 }

+ 0 - 2
src/views/analyse/WaterView.vue

@@ -86,8 +86,6 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   const showVal = JSON.parse(data.showVal);
   const { basic, jsData, csData } = showVal;
 
-  console.log( csData );
-
   try {
     const answer = JSON.parse(data.answer);
     const reportList = [];

+ 3 - 1
src/views/work/WorkView.vue

@@ -65,6 +65,7 @@ const handleChatDetail = async ({ sessionId }) => {
   const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
 
   chatDataSource.value = data.map(item => ({ ...item, loading: false, }));
+
   currenSessionId.value = sessionId;
 
   scrollToBottom();
@@ -74,7 +75,7 @@ const onRegenerate = async ({ question, tools }) => {
   controller = new AbortController();
 
   const sessionId = unref(currenSessionId);
-  
+
   const params = {
     data: {
       sessionId,
@@ -245,6 +246,7 @@ onUnmounted(() => {
       <template #footer>
         <ChatInputCopy
           :options="helperList"
+          :active-item="activeItem"
           ref="inputRef"
           v-model:loading="isLoading"
           v-model:switch="switchActive"