|
@@ -1,6 +1,6 @@
|
|
<script setup>
|
|
<script setup>
|
|
import { ref, unref, onMounted, onUnmounted, computed, watch } from 'vue';
|
|
import { ref, unref, onMounted, onUnmounted, computed, watch } from 'vue';
|
|
-import { useMessage, NInput, NSwitch, NPopover, NScrollbar, NUpload, NTooltip, NProgress, NButton } from 'naive-ui';
|
|
|
|
|
|
+import { useMessage, NInput, NPopover, NScrollbar, NUpload, NTooltip, NProgress, NButton } from 'naive-ui';
|
|
import { useUserStore } from '@/stores/modules/userStore';
|
|
import { useUserStore } from '@/stores/modules/userStore';
|
|
import { baseURL } from '@/utils/request';
|
|
import { baseURL } from '@/utils/request';
|
|
import { getFormatYesterDay } from '@/utils/format';
|
|
import { getFormatYesterDay } from '@/utils/format';
|
|
@@ -24,16 +24,15 @@ const MAX_NUM = 5;
|
|
const useStore = useUserStore();
|
|
const useStore = useUserStore();
|
|
|
|
|
|
const modelLoading = defineModel('loading');
|
|
const modelLoading = defineModel('loading');
|
|
|
|
+const modelOnline = defineModel('online');
|
|
|
|
+const switchStatus = defineModel('switch');
|
|
|
|
|
|
const selectOptions = [
|
|
const selectOptions = [
|
|
{ title: 'LibraAl', subTitle: '水务行业专家', value: 0 },
|
|
{ title: 'LibraAl', subTitle: '水务行业专家', value: 0 },
|
|
{ title: 'Deepseek', subTitle: '适合深度思考', value: 1 },
|
|
{ title: 'Deepseek', subTitle: '适合深度思考', value: 1 },
|
|
]
|
|
]
|
|
|
|
|
|
-const switchStatus = defineModel('switch');
|
|
|
|
-
|
|
|
|
const message = useMessage();
|
|
const message = useMessage();
|
|
-const isTempActiveStatus = ref(false);
|
|
|
|
|
|
|
|
const inpVal = ref('');
|
|
const inpVal = ref('');
|
|
const inpRef = ref(null);
|
|
const inpRef = ref(null);
|
|
@@ -72,7 +71,15 @@ watch(inpVal, (curVal) => {
|
|
})
|
|
})
|
|
|
|
|
|
watch(() => props.activeItem, (curVal) => {
|
|
watch(() => props.activeItem, (curVal) => {
|
|
- selectedOption.value = curVal?.tools ? curVal : null;
|
|
|
|
|
|
+ // console.log(curVal);
|
|
|
|
+ selectedOption.value = curVal?.tools ? curVal : null;
|
|
|
|
+ // TODO: 这里后续大概率要删除
|
|
|
|
+ if ( curVal?.tools ) {
|
|
|
|
+ // 选中智能体,没有联网搜索
|
|
|
|
+ modelOnline.value = false;
|
|
|
|
+ // 选中智能体,需要使用默认的libraAi
|
|
|
|
+ switchStatus.value = 0;
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
|
|
const handleInpFocus = () => {
|
|
const handleInpFocus = () => {
|
|
@@ -204,6 +211,10 @@ const selectOption = (index) => {
|
|
highlightedIndex.value = index;
|
|
highlightedIndex.value = index;
|
|
isOpen.value = false;
|
|
isOpen.value = false;
|
|
inpVal.value = selectedOption.value.content;
|
|
inpVal.value = selectedOption.value.content;
|
|
|
|
+ // 选中智能体,没有联网搜索
|
|
|
|
+ modelOnline.value = false;
|
|
|
|
+ // 选中智能体,需要使用默认的libraAi
|
|
|
|
+ switchStatus.value = 0;
|
|
}
|
|
}
|
|
|
|
|
|
const beforeUpload = ({ file }) => {
|
|
const beforeUpload = ({ file }) => {
|
|
@@ -272,6 +283,7 @@ const clearFileList = () => {
|
|
// 切换智能体
|
|
// 切换智能体
|
|
const onChangeAgent = ({ value }) => {
|
|
const onChangeAgent = ({ value }) => {
|
|
switchStatus.value = value;
|
|
switchStatus.value = value;
|
|
|
|
+ modelOnline.value = false;
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
@@ -311,7 +323,7 @@ defineExpose({
|
|
<div class="chat-inp-outer border-[1px]" :class="[{ 'border-[#2454FF]': isFocusState }]">
|
|
<div class="chat-inp-outer border-[1px]" :class="[{ 'border-[#2454FF]': isFocusState }]">
|
|
<ul class="chat-tools-inner py-[10px] px-[10px] bg-[#fcfcfc]" v-show="selectedOption">
|
|
<ul class="chat-tools-inner py-[10px] px-[10px] bg-[#fcfcfc]" v-show="selectedOption">
|
|
<li class="tools-tips space-x-[10px]">
|
|
<li class="tools-tips space-x-[10px]">
|
|
- <span>与</span>
|
|
|
|
|
|
+ <span>与</span>
|
|
<p class="agent-name space-x-[5px]" @click="isOpen = true">
|
|
<p class="agent-name space-x-[5px]" @click="isOpen = true">
|
|
<img src="https://static.fuxicarbon.com/userupload/db77ffe0cef843278a23b0d2db9505fa.png" alt="">
|
|
<img src="https://static.fuxicarbon.com/userupload/db77ffe0cef843278a23b0d2db9505fa.png" alt="">
|
|
<span>{{ selectedOption?.title }}</span>
|
|
<span>{{ selectedOption?.title }}</span>
|
|
@@ -378,7 +390,7 @@ defineExpose({
|
|
size="medium"
|
|
size="medium"
|
|
placeholder="输入@,召唤智能体"
|
|
placeholder="输入@,召唤智能体"
|
|
v-model:value="inpVal"
|
|
v-model:value="inpVal"
|
|
- :autosize="{ minRows: 1, maxRows: 3 }"
|
|
|
|
|
|
+ :autosize="{ minRows: 2, maxRows: 4 }"
|
|
@focus="focusInput"
|
|
@focus="focusInput"
|
|
@blur="blurInput"
|
|
@blur="blurInput"
|
|
@keypress="handleInpEnter"
|
|
@keypress="handleInpEnter"
|
|
@@ -388,11 +400,22 @@ defineExpose({
|
|
|
|
|
|
<div class="option-wrapper">
|
|
<div class="option-wrapper">
|
|
<div class="option-list space-x-[10px]">
|
|
<div class="option-list space-x-[10px]">
|
|
- <n-popover trigger="focus" to=".option-wrapper" raw :show-arrow="false" placement="top-start" :width="150" content-class="content-class" content-style="padding: 0;">
|
|
|
|
|
|
+ <n-popover
|
|
|
|
+ trigger="focus"
|
|
|
|
+ to=".option-wrapper"
|
|
|
|
+ raw
|
|
|
|
+ :show-arrow="false"
|
|
|
|
+ placement="top-start"
|
|
|
|
+ :width="150"
|
|
|
|
+ content-class="content-class"
|
|
|
|
+ content-style="padding: 0;"
|
|
|
|
+ isOpen
|
|
|
|
+ :disabled="selectedOption"
|
|
|
|
+ >
|
|
<template #trigger>
|
|
<template #trigger>
|
|
<n-button text>
|
|
<n-button text>
|
|
<div class="switch-agent option">
|
|
<div class="switch-agent option">
|
|
- <span>{{ selectOptions[switchStatus].title }}</span>
|
|
|
|
|
|
+ <span>{{ selectOptions[switchStatus]?.title }}</span>
|
|
<i class="n-base-icon n-base-suffix__arrow"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z" fill="currentColor"></path></svg></i>
|
|
<i class="n-base-icon n-base-suffix__arrow"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z" fill="currentColor"></path></svg></i>
|
|
</div>
|
|
</div>
|
|
</n-button>
|
|
</n-button>
|
|
@@ -408,8 +431,12 @@ defineExpose({
|
|
</ul>
|
|
</ul>
|
|
</n-popover>
|
|
</n-popover>
|
|
|
|
|
|
- <div class="internet-agent option space-x-[4px]" :class="{'agent-active': isTempActiveStatus}" @click="isTempActiveStatus = !isTempActiveStatus">
|
|
|
|
- <!-- <SvgIcon name="chat-icon-internet"></SvgIcon> -->
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="internet-agent option space-x-[4px]"
|
|
|
|
+ :class="{'agent-active': modelOnline}"
|
|
|
|
+ @click="modelOnline = !modelOnline"
|
|
|
|
+ v-show="switchStatus == 1"
|
|
|
|
+ >
|
|
<span class="icon"></span>
|
|
<span class="icon"></span>
|
|
<span>联网搜索</span>
|
|
<span>联网搜索</span>
|
|
<span class="circle"></span>
|
|
<span class="circle"></span>
|
|
@@ -509,7 +536,7 @@ defineExpose({
|
|
|
|
|
|
.inp-wrapper {
|
|
.inp-wrapper {
|
|
@include flex(x, start, center);
|
|
@include flex(x, start, center);
|
|
- margin-bottom: 30px;
|
|
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
|
|
.upload-inner {
|
|
.upload-inner {
|
|
width: 30px;
|
|
width: 30px;
|