wujingjing
2024-11-26 53cdd3803e13b033919a8e5787bf30ca77f140af
Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.V1.0 into test
已修改4个文件
97 ■■■■ 文件已修改
src/api/ai/chat.ts 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/Chat.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/component/sidebar/SidebarOther.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/component/sidebar/components/ChatRecord.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/ai/chat.ts
@@ -300,7 +300,7 @@
        },
    });
};
//修改对话分组列表标题
export const setHistoryGroupTitle = async (params, req: any = request) => {
    return req({
        url: 'history/set_history_group_title',
@@ -502,3 +502,5 @@
            'Content-Type': 'application/x-www-form-urlencoded',
        },
    });
src/components/chat/Chat.vue
@@ -275,15 +275,7 @@
            <div class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center" v-if="isShareCheck"></div>
        </div>
        <CustomDrawer v-model:isShow="drawerIsShow" @updateChatInput="updateChatInput" />
        <el-dialog
            title="分享链接"
            v-model="shareCodeIsShow"
            width="25%"
            center
            modal-append-to-body
            lock-scroll
            :before-close="closeShareClick"
        >
        <el-dialog title="分享链接" v-model="shareCodeIsShow" width="25%" modal-append-to-body lock-scroll :before-close="closeShareClick">
            <div class="w100 h100 flex justify-center items-center flex-col">
                <div class="qrcode h100" ref="qrcodeRef"></div>
                <div class="h100 w100 flex flex-col justify-center items-center">
src/layout/component/sidebar/SidebarOther.vue
@@ -41,6 +41,12 @@
                        <span class="use_name">登</span>
                    </div>
                </div>
                <!-- <div class="agent_line"></div>
                <div class="nav__chat" @click="newChatRoomClick()">
                    <div class="nav__chat-icon">
                        <span class="chat_img ywifont ywicon-weixin !text-[26px] text-[#fff]"></span>
                    </div>
                </div> -->
            </div>
        </div>
        <div class="nav_history_list bg-[#1c1e1d]" v-show="isShowHistoryChatRoom" ref="historyChatRoomRef">
@@ -81,6 +87,7 @@
                        <div class="ywifont ywicon-xiaoxi1 flex-0 mr-2.5"></div>
                        <div class="flex-auto text-ellipsis text-nowrap text-sm group-hover:text-[#0084ff]">{{ item.title }}</div>
                        <div class="text-gray-100 flex items-center space-x-2 ml-1">
                            <div class="ywifont invisible ywicon-bianji group-hover:visible !text-sm" @click="editChat(item)"></div>
                            <el-popconfirm title="确定删除聊天记录?" @confirm.stop="confirmDeleteChatRoom(item)" width="180">
                                <template #reference>
                                    <div class="ywifont invisible ywicon-shanchu3 group-hover:visible"></div>
@@ -108,10 +115,11 @@
<script setup lang="ts">
import { onClickOutside } from '@vueuse/core';
import { ElMessage, ElMessageBox } from 'element-plus';
import moment from 'moment';
import { computed, onMounted, ref, watch, watchEffect } from 'vue';
import type { ChatRoomItem } from './components/types';
import { DeleteHistoryGroups } from '/@/api/ai/chat';
import { DeleteHistoryGroups, setHistoryGroupTitle } from '/@/api/ai/chat';
import { useSearch } from '/@/hooks/useSearch';
import { DateFilter, dateFilterMap } from '/@/model/types/date';
import {
@@ -165,10 +173,41 @@
    roomClick(chatRoomList.value[0]);
    chatRoomRef.value.firstElementChild?.scrollIntoView();
};
onClickOutside(historyChatRoomRef, () => {
    isShowHistoryChatRoom.value = false;
});
const editChat = (room: ChatRoomItem) => {
    ElMessageBox.prompt('', '重命名', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/,
        inputValue: room.title,
        inputErrorMessage: '请输入新的名称',
    })
        .then(async (edit) => {
            const res = await setHistoryGroupTitle({
                history_group_id: room.id,
                title: edit.value,
            });
            if (res.json_ok) {
                const foundIndex = chatRoomList.value.findIndex((item) => item.id === activeRoomId.value);
                chatRoomList.value[foundIndex].title = edit.value;
                chatRoomRef.value.firstElementChild?.scrollIntoView();
            }
        })
        .catch(({ value }) => {
            ElMessage({
                type: 'info',
                message: '取消修改',
            });
        });
};
onClickOutside(
    historyChatRoomRef,
    () => {
        isShowHistoryChatRoom.value = false;
    },
    {
        ignore: ['.el-message-box', '.el-popper'],
    }
);
//#endregion
//#region ====================== 公司信息 ======================
const companyClick = () => {
src/layout/component/sidebar/components/ChatRecord.vue
@@ -49,8 +49,7 @@
                    <div class="ywifont ywicon-xiaoxi1 flex-0 mr-2.5"></div>
                    <div class="flex-auto text-ellipsis text-nowrap text-sm group-hover:text-[#0084ff]">{{ item.title }}</div>
                    <div class="text-gray-100 flex items-center space-x-2 ml-1">
                        <!-- <div class="ywifont invisible ywicon-bianji group-hover:visible !text-sm"></div> -->
                        <div class="ywifont invisible ywicon-bianji group-hover:visible !text-sm" @click.stop="editChat(item)"></div>
                        <el-popconfirm title="确定删除聊天记录?" @confirm.stop="confirmDeleteChatRoom(item)" width="180">
                            <template #reference>
                                <div class="ywifont invisible ywicon-shanchu3 group-hover:visible"></div>
@@ -65,15 +64,15 @@
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import moment from 'moment';
import { computed, onMounted, ref, watch } from 'vue';
import type { ChatRoomItem } from './types';
import { DeleteHistoryGroups } from '/@/api/ai/chat';
import { DeleteHistoryGroups, setHistoryGroupTitle } from '/@/api/ai/chat';
import { useSearch } from '/@/hooks/useSearch';
import { DateFilter, dateFilterMap } from '/@/model/types/date';
import { activeRoomId, chatRoomList, gotoAnswerPage, newChatRoomClick } from '/@/stores/chatRoom';
import { debounce, getRecentDateRange } from '/@/utils/util';
const chatRoomRef = ref<HTMLDivElement>(null);
const queryParams = ref({
    title: '',
@@ -99,7 +98,32 @@
    roomClick(chatRoomList.value[0]);
    chatRoomRef.value.firstElementChild?.scrollIntoView();
};
const editChat = (room: ChatRoomItem) => {
    ElMessageBox.prompt('', '重命名', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/,
        inputValue: room.title,
        inputErrorMessage: '请输入新的名称',
    })
        .then(async (edit) => {
            const res = await setHistoryGroupTitle({
                history_group_id: room.id,
                title: edit.value,
            });
            if (res.json_ok) {
                const foundIndex = chatRoomList.value.findIndex((item) => item.id === room.id);
                chatRoomList.value[foundIndex].title = edit.value;
                chatRoomRef.value.firstElementChild?.scrollIntoView();
            }
        })
        .catch(({ value }) => {
            ElMessage({
                type: 'info',
                message: '取消修改',
            });
        });
};
//#region ====================== 日期筛选 ======================
const activeDateFilter = ref<DateFilter>(DateFilter.All);