diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index dc946a04dd20b928aa58a48c7ec2a61f1ee79eb6..90308eb942c9ebf51dbf688ec96f70d21bef4597 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -22,7 +22,7 @@ export const stopGeneration = (): Promise< any, ( | FcResponse<{ - // conversation_id: string; + // conversationId: string; }> | undefined ) @@ -56,7 +56,7 @@ export const createSession = (): Promise< any, ( | FcResponse<{ - conversation_id: string; + conversationId: string; }> | undefined ) @@ -68,14 +68,14 @@ export const createSession = (): Promise< * 更新会话标题 * @param params * { - * conversation_id:(number)会话id + * conversationId:(number)会话id * title:(string)会话标题 * } * @returns */ export const updateSession = ( params: { - conversation_id: string, + conversationId: string, title: string, }, ): Promise< @@ -84,7 +84,7 @@ export const updateSession = ( ( | FcResponse< Array<{ - conversation_id: string; + conversationId: string; }> > | undefined @@ -94,7 +94,7 @@ export const updateSession = ( return put(BASE_URL, { title: params.title, }, { - conversation_id: params.conversation_id, + conversationId: params.conversationId, }); }; @@ -104,18 +104,18 @@ export const updateSession = ( * @returns */ export const deleteSession = (data: { - conversation_list: string[]; -}): Promise<[any, FcResponse> | undefined]> => { + conversationList: string[]; +}): Promise<[any, FcResponse> | undefined]> => { return del(`${BASE_URL}`, data); }; /** * 获取会话历史对话记录 - * @param conversation_id + * @param conversationId * GET /api/record/eccb08c3-0621-4602-a4d2-4eaada892557 */ export const getHistoryConversation = ( - conversation_id: string + conversationId: string ): Promise< [ any, @@ -125,8 +125,8 @@ export const getHistoryConversation = ( ) ] > => { - // return get('/api/record', { conversation_id: conversation_id }); - return get('/api/record/'+ conversation_id); + // return get('/api/record', { conversationId: conversationId }); + return get('/api/record/'+ conversationId); // 修改 chat 格式 }; diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index d25c76ed4f1e63ab557bd1ac8ec4753466fa6838..3fbfbb6284796cacb530ae7973035379007625b1 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -45,8 +45,7 @@ export interface Metadata { export interface ConversationRecord { id: string; groupId: string; - conversation_id: string; - task_id: string; + conversationId: string; files: File[]; flow: Flow; content: Content; @@ -75,8 +74,8 @@ export interface Suggest { * 问答列表内项的数据结构 */ export interface ConversationListItem { - conversation_id: string, - created_time: string, + conversationId: string, + createdTime: string, doc_count: number, title: string, } diff --git a/src/components/Message.ts b/src/components/Message.ts index 421170f8f8792bb51495f11d393bf974e263275d..56d318fda68d0645ae287e2c1b946eb9ad367a8a 100644 --- a/src/components/Message.ts +++ b/src/components/Message.ts @@ -3,7 +3,7 @@ import { ElMessage } from "element-plus"; export const infoMsg = (msgInfo:string) => { ElMessage({ type:"info", - showClose:true, + // showClose:true, dangerouslyUseHTMLString:true, message:msgInfo, }) @@ -11,9 +11,9 @@ export const infoMsg = (msgInfo:string) => { export const successMsg = (msgInfo:string) => { ElMessage({ - customClass:"el-message--success", + // customClass:"el-message--success", type:"success", - showClose:true, + // showClose:true, class:"el-message--success", message:msgInfo, }) @@ -21,7 +21,7 @@ export const successMsg = (msgInfo:string) => { export const warningMsg = (msgInfo:string) => { ElMessage({ type:"warning", - showClose:true, + // showClose:true, class:"el-message--warning", message:msgInfo, }) @@ -30,7 +30,7 @@ export const warningMsg = (msgInfo:string) => { export const errorMsg = (msgInfo:string) => { ElMessage({ type:"error", - showClose:true, + // showClose:true, class:"el-message--error", message:msgInfo, }) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 1d684336cc8cf41fe6f07bc6cf6d35d29a747941..91eb9fd2bd65bb515c02d14560ccaaa8746a31be 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -20,7 +20,7 @@ import { useLangStore } from 'src/store' const { user_selected_app } = storeToRefs(useHistorySessionStore()); import { Suggest } from 'src/apis/paths/type'; const { params } = storeToRefs(useHistorySessionStore()); - +const { app } = storeToRefs(useSessionStore()); const { language } = storeToRefs(useLangStore()); const { changeLanguage } = useLangStore(); const echartsDraw = ref(); @@ -395,9 +395,10 @@ const popperSize = () => { return size } } -const { conversationList, isAnswerGenerating, dialogueRef } = storeToRefs(useSessionStore()); +const { conversationList } = storeToRefs(useSessionStore()); const { sendQuestion } = useSessionStore(); + const chatWithParams = async () => { visible.value = false; // handleSendMessage(undefined,undefined,user_selected_app.value); diff --git a/src/components/dialoguePanel/data.ts b/src/components/dialoguePanel/data.ts index 76f7dcde63b056a9328121d5bb658e6adc9f3787..95409242dd21aa9db644088e63b43536da508df2 100644 --- a/src/components/dialoguePanel/data.ts +++ b/src/components/dialoguePanel/data.ts @@ -2,7 +2,7 @@ export const input = { "event": "flow.start", "id": "0f9d3e6b-7845-44ab-b247-35c522d38f13", "groupId": "09125776-ba69-4832-86c9-c5035f9343fd", - "conversation_id": "eccb08c3-0621-4602-a4d2-4eaada892557", + "conversationId": "eccb08c3-0621-4602-a4d2-4eaada892557", "task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6", "flow": { "appId": "aops-cve", @@ -27,7 +27,7 @@ export const output = { "event": "flow.stop", "id": "0f9d3e6b-7845-44ab-b247-35c522d38f13", "groupId": "09125776-ba69-4832-86c9-c5035f9343fd", - "conversation_id": "eccb08c3-0621-4602-a4d2-4eaada892557", + "conversationId": "eccb08c3-0621-4602-a4d2-4eaada892557", "task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6", "flow": { "appId": "aops-cve", diff --git a/src/components/sessionCard/SessionCard.vue b/src/components/sessionCard/SessionCard.vue index d3a13e456ca964025818dc290f7a2e5019bc8bee..f74406c17650ad55fb5fd29d6c7104bad843f5a9 100644 --- a/src/components/sessionCard/SessionCard.vue +++ b/src/components/sessionCard/SessionCard.vue @@ -47,7 +47,7 @@ const isImageVisible = computed(() => { const handleHover = async () => { // 接口获取列表数据 - const [_, response] = await api.getUploadFiles(props.conversation.conversation_id, true, false); + const [_, response] = await api.getUploadFiles(props.conversation.conversationId, true, false); if (!_ && response) { hoverFiles.value = response.result.documents; hoverFiles.value.sort((pre, cur) => pre.created_at - cur.created_at); @@ -98,9 +98,9 @@ const cancelChangeTitle = (): void => { }; const bool = ref(false); -const select = (conversation_id: string) => { - bool.value = selectedSessionIds.value.includes(conversation_id); - return selectedSessionIds.value.includes(conversation_id); +const select = (conversationId: string) => { + bool.value = selectedSessionIds.value.includes(conversationId); + return selectedSessionIds.value.includes(conversationId); }; const deleteOne = (name: string, list: string[]) => { @@ -119,22 +119,22 @@ const deleteOne = (name: string, list: string[]) => { class="checkbox" v-if="deletion" v-model="bool" - @change="selectSession(conversation.conversation_id)" - :checked="select(conversation.conversation_id)" + @change="selectSession(conversation.conversationId)" + :checked="select(conversation.conversationId)" />
{ v-if="themeStore.theme === 'dark'" class="conversation-title__svg" src="@/assets/svgs/dark_delete.svg" - @click="deleteOne(conversation.title, [conversation.conversation_id])" + @click="deleteOne(conversation.title, [conversation.conversationId])" />
diff --git a/src/components/sessionCard/type.ts b/src/components/sessionCard/type.ts index 24b1ea52791d123b2ed58b9a414c6ed3ab3f36e4..a6d0d04d9db020044383ce2503292dcf344a6265 100644 --- a/src/components/sessionCard/type.ts +++ b/src/components/sessionCard/type.ts @@ -8,7 +8,7 @@ // PURPOSE. // See the Mulan PSL v2 for more details. export interface SessionItem { - conversation_id: string; + conversationId: string; title: string; createdTime?: string | Date; docCount?: number; diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 5e0971838137d0491e412adb65fd33ee660ab70a..ef4c3ebd6afbead83b2570687d4f4dfd711eb405 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -83,7 +83,7 @@ export const useSessionStore = defineStore('conversation', () => { params: { question: string; user_selected_app?: any, - conversation_id?: string; + conversationId?: string; qaRecordId?: string; user_selected_flow?: string; groupId?: string; @@ -93,7 +93,7 @@ export const useSessionStore = defineStore('conversation', () => { ): Promise => { const language = localStorage.getItem('localeLang') === 'EN' ? 'en' : 'zh'; const { currentSelectedSession } = useHistorySessionStore(); - params.conversation_id = currentSelectedSession; + params.conversationId = currentSelectedSession; // 当前问答在整个问答记录中的索引 const answerIndex = ind ?? conversationList.value.length - 1; const conversationItem = conversationList.value[answerIndex] as RobotConversationItem; @@ -123,7 +123,7 @@ export const useSessionStore = defineStore('conversation', () => { body: JSON.stringify({ question: params.question, language, - conversation_id: params.conversation_id, + conversationId: params.conversationId, groupId: params.groupId, // record_id: params.qaRecordId, app:[{ @@ -144,7 +144,7 @@ export const useSessionStore = defineStore('conversation', () => { headers: headers, body: JSON.stringify({ question: params.question, - conversation_id: params.conversation_id, + conversationId: params.conversationId, record_id: params.qaRecordId, language, groupId: params.groupId, @@ -168,7 +168,7 @@ export const useSessionStore = defineStore('conversation', () => { headers: headers, body: JSON.stringify({ question: params.question, - conversation_id: params.conversation_id, + conversationId: params.conversationId, record_id: params.qaRecordId, language, groupId: params.groupId, @@ -374,7 +374,7 @@ export const useSessionStore = defineStore('conversation', () => { status: number, params: { question: string; - conversation_id?: string; + conversationId?: string; qaRecordId?: string; }, ind?: number @@ -459,10 +459,11 @@ export const useSessionStore = defineStore('conversation', () => { user_selected_flow?: string, params?: any, ): Promise => { + console.log(`sendQyuestion`); const { updateSessionTitle, currentSelectedSession } = useHistorySessionStore(); if (conversationList.value.length === 0) { // 如果当前还没有对话记录,将第一个问题的questtion作为对话标题 - updateSessionTitle({ conversation_id: currentSelectedSession, title: question.slice(0, 20) }); + updateSessionTitle({ conversationId: currentSelectedSession, title: question.slice(0, 20) }); } if (regenerateInd) { // 重新生成,指定某个回答,修改默认索引 @@ -490,7 +491,7 @@ export const useSessionStore = defineStore('conversation', () => { isFinish: false, recordId: '', groupId: '', - conversation_id: '', + conversationId: '', // createdAt: Date.now(), } ); @@ -596,12 +597,12 @@ export const useSessionStore = defineStore('conversation', () => { /** * 获取历史对话数据 - * @param conversation_id + * @param conversationId */ - const getConversation = async (conversation_id: string): Promise => { - const [_, res] = await api.getHistoryConversation(conversation_id); + const getConversation = async (conversationId: string): Promise => { + const [_, res] = await api.getHistoryConversation(conversationId); //解析读取 records字段得到对话数组列表 - // const [_, res] = await api.getHistoryConversation(conversation_id).records; + // const [_, res] = await api.getHistoryConversation(conversationId).records; if (!_ && res) { conversationList.value = []; @@ -642,7 +643,7 @@ export const useSessionStore = defineStore('conversation', () => { isSupport: false, isFinish: true, recordId: record.id, - conversation_id: record.conversation_id, + conversationId: record.conversationId, groupId: record.groupId, metadata: record.metadata, } diff --git a/src/store/historySession.ts b/src/store/historySession.ts index 5d4addecdc1b56e414e4e9f00596997313b3df57..3a109a2c1bc4666845c5a51650dad7e3afd4980b 100644 --- a/src/store/historySession.ts +++ b/src/store/historySession.ts @@ -17,7 +17,7 @@ import { successMsg } from 'src/components/Message'; import i18n from 'src/i18n'; export interface HistorySessionItem { - conversation_id: string; + conversationId: string; title: string; createdTime: string | Date; docCount: number; @@ -32,14 +32,14 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { const currentSelectedSession = ref(''); /** * 选择历史会话 - * @param conversation_id 会话id + * @param conversationId 会话id */ - const changeSession = async (conversation_id: string): Promise => { + const changeSession = async (conversationId: string): Promise => { const { isAnswerGenerating } = useSessionStore(); - if (currentSelectedSession.value === conversation_id || isAnswerGenerating) { + if (currentSelectedSession.value === conversationId || isAnswerGenerating) { return; } - currentSelectedSession.value = conversation_id; + currentSelectedSession.value = conversationId; const { getConversation } = useSessionStore(); await getConversation(currentSelectedSession.value).then(()=> { const a = document.getElementsByClassName('draw'); @@ -65,20 +65,20 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { */ const selectAllSession = (): void => { if (isSelectedAll.value) { - selectedSessionIds.value = historySession.value.map((item) => item.conversation_id); + selectedSessionIds.value = historySession.value.map((item) => item.conversationId); } else { selectedSessionIds.value = []; } }; /** * 选中某个会话 - * @param conversation_id 会话id + * @param conversationId 会话id */ - const selectSession = (conversation_id: string): void => { - if (selectedSessionIds.value.includes(conversation_id)) { - selectedSessionIds.value = selectedSessionIds.value.filter((val) => val !== conversation_id); + const selectSession = (conversationId: string): void => { + if (selectedSessionIds.value.includes(conversationId)) { + selectedSessionIds.value = selectedSessionIds.value.filter((val) => val !== conversationId); } else { - selectedSessionIds.value.push(conversation_id); + selectedSessionIds.value.push(conversationId); } // 更新isSelectedAll的值 if (selectedSessionIds.value.length === historySession.value.length) { @@ -91,7 +91,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { /** * 清空选择会话列表 - * @param conversation_id 会话id + * @param conversationId 会话id */ const initSessionList = (): void => { selectedSessionIds.value = []; @@ -105,8 +105,8 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { const { conversationList } = storeToRefs(useSessionStore()); if (!err && res) { historySession.value = res.result.conversations.reverse().map((item) => ({ - conversation_id: item.conversation_id, - createdTime: item.created_time, + conversationId: item.conversationId, + createdTime: item.createdTime, title: item.title, docCount: item.doc_count || 0, })); @@ -114,7 +114,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { await generateSession(); } if (!currentSelectedSession.value) { - currentSelectedSession.value = res.result.conversations[0]?.conversation_id; + currentSelectedSession.value = res.result.conversations[0]?.conversationId; } if (currentSelectedSession.value) { const { getConversation, isAnswerGenerating } = useSessionStore(); @@ -138,7 +138,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { const updateSessionTitle = async (conversation: SessionItem): Promise => { const [_] = await api.updateSession( { - conversation_id: conversation.conversation_id, + conversationId: conversation.conversationId, title: conversation.title, } ); @@ -153,7 +153,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { * 创建新会话 */ const createNewSession = async (): Promise => { - const sId = historySession.value.length === 0 ? null : historySession.value[0]?.conversation_id; + const sId = historySession.value.length === 0 ? null : historySession.value[0]?.conversationId; if (sId) { const [, cov] = await api.getHistoryConversation(sId); if (cov && cov.result.records.length === 0) { @@ -175,7 +175,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => { const generateSession = async (): Promise => { const [_, res] = await api.createSession(); if (!_ && res) { - currentSelectedSession.value = res.result.conversation_id; + currentSelectedSession.value = res.result.conversationId; await getHistorySession(); } }; diff --git a/src/views/dialogue/Copilot.vue b/src/views/dialogue/Copilot.vue index 68073e6844b9094c37b9c34edfeccc7219dece09..8ca447b3855b0c0d5a1155682589f978366bfb90 100644 --- a/src/views/dialogue/Copilot.vue +++ b/src/views/dialogue/Copilot.vue @@ -52,13 +52,13 @@ const initCopilot = async (): Promise => { userinfo.value.organization = type; const currRoute = router.currentRoute; if (currRoute.value.path === '/') { - const isLogin = await getUserInfo(); - if (isLogin) { + // const isLogin = await getUserInfo(); + // if (isLogin) { await api.getRecognitionMode(); await api.stopGeneration(); await getHistorySession(); setApps(); - } + // } return; } else if (currRoute.value.query.id) { app.value = { diff --git a/src/views/dialogue/components/DialogueAside.vue b/src/views/dialogue/components/DialogueAside.vue index b562f3bea271a59798bb17a11ec6a1aeb0e77810..b2e1333a4a1827fa1420a2e08b2dcea868994650 100644 --- a/src/views/dialogue/components/DialogueAside.vue +++ b/src/views/dialogue/components/DialogueAside.vue @@ -23,7 +23,7 @@ import { IconChevronUp } from '@computing/opendesign-icons'; import { onMounted } from 'vue'; interface HistorySession { - conversation_id: string; + conversationId: string; title: string; createdTime: string | Date; } @@ -152,8 +152,8 @@ const isBatchDeletion = ref(false); */ const deleteSession = async () => { dialogVisible.value = false; - const conversation_list = deleteType.value ? selectedSessionIds.value : sessionList.value; - const [, res] = await api.deleteSession({ conversation_list }); + const conversationList = deleteType.value ? selectedSessionIds.value : sessionList.value; + const [, res] = await api.deleteSession({ conversationList }); if (res) { selectedSessionIds.value = []; currentSelectedSession.value = ''; @@ -192,7 +192,7 @@ function cancelDeleteSession(): void { */ function selectAllSession(): void { isSelectedAll.value - ? (selectedSessionIds.value = historySession.value.map(item => item.conversation_id)) + ? (selectedSessionIds.value = historySession.value.map(item => item.conversationId)) : (selectedSessionIds.value = []); } @@ -229,8 +229,7 @@ function ensureAppAtFirstPosition() { return; } const newApp = app.value; - const index = apps.value.findIndex(app => app.id === newApp.id); - selectApp(newApp.id); + const index = apps.value.findIndex(app => app.appId === newApp.appId); if (index !== -1 && index !== 0) { const [item] = apps.value.splice(index, 1); apps.value.unshift(item); @@ -281,9 +280,9 @@ watch(
  • {{ app.name }}
  • @@ -327,12 +326,11 @@ watch( @change="selectAllSession" />
-