From 8ac3cc9f9849199174ce9650eff7562c832005d8 Mon Sep 17 00:00:00 2001
From: cc500 <2014434568@qq.com>
Date: Mon, 20 Jan 2025 20:53:03 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/index.ts | 4 +-
src/apis/paths/api.ts | 71 +++++++++++++++++++
src/apis/paths/app.ts | 35 +++++++++
src/apis/paths/index.ts | 3 +
src/apis/paths/type.ts | 37 ++++++++++
src/store/conversation.ts | 3 +-
src/views/dialogue/Copilot.vue | 8 ++-
.../dialogue/components/DialogueAside.vue | 22 ++++--
8 files changed, 174 insertions(+), 9 deletions(-)
create mode 100644 src/apis/paths/api.ts
create mode 100644 src/apis/paths/app.ts
diff --git a/src/apis/index.ts b/src/apis/index.ts
index 19a573e..19d9c0f 100644
--- a/src/apis/index.ts
+++ b/src/apis/index.ts
@@ -7,7 +7,7 @@
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v2 for more details.
-import { accountApi, sessionApi, externalApi, apiKeyApi, knowledgeApi } from './paths';
+import { accountApi, sessionApi, externalApi, apiKeyApi, knowledgeApi, appApi, apiApi } from './paths';
export const api = {
...accountApi,
@@ -15,4 +15,6 @@ export const api = {
...externalApi,
...apiKeyApi,
...knowledgeApi,
+ ...appApi,
+ ...apiApi
};
diff --git a/src/apis/paths/api.ts b/src/apis/paths/api.ts
new file mode 100644
index 0000000..3a1bd8d
--- /dev/null
+++ b/src/apis/paths/api.ts
@@ -0,0 +1,71 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved.
+// licensed under the Mulan PSL v2.
+// You can use this software according to the terms and conditions of the Mulan PSL v2.
+// You may obtain a copy of Mulan PSL v2 at:
+// http://license.coscl.org.cn/MulanPSL2
+// THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+// PURPOSE.
+// See the Mulan PSL v2 for more details.
+import { get, post } from 'src/apis/server';
+import type { FcResponse } from 'src/apis/server';
+import { ApiMessage, Service } from './type';
+
+/**
+ * 查询服务下接口信息
+ * @returns
+ */
+export const getApiMessageByServiceId = (
+ serviceId: string,
+ page: number,
+ pageSize: number,
+): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ serviceId: string;
+ name: string;
+ apis:ApiMessage[];
+ }>
+ | undefined
+ )
+ ]
+> => {
+ return get(`/api/service/${serviceId}/key`,{page, pageSize});
+};
+
+/**
+ * USER登录
+ * @returns
+ */
+export const getApiMessageList = (params: {
+ createdByMe?: string;
+ favorited?: string;
+ searchType?: string;
+ keyword?: string;
+ page?: number;
+ pageSize?: number;
+}
+ ): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ services:Service[];
+ }>
+ | undefined
+ )
+ ]
+ > => {
+ return get('/api/auth/key',{
+ ...params
+ });
+ };
+
+
+
+export const apiApi = {
+ getApiMessageByServiceId,
+ getApiMessageList,
+};
diff --git a/src/apis/paths/app.ts b/src/apis/paths/app.ts
new file mode 100644
index 0000000..bc903f6
--- /dev/null
+++ b/src/apis/paths/app.ts
@@ -0,0 +1,35 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved.
+// licensed under the Mulan PSL v2.
+// You can use this software according to the terms and conditions of the Mulan PSL v2.
+// You may obtain a copy of Mulan PSL v2 at:
+// http://license.coscl.org.cn/MulanPSL2
+// THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+// PURPOSE.
+// See the Mulan PSL v2 for more details.
+import { get } from 'src/apis/server';
+import type { FcResponse } from 'src/apis/server';
+import { Application } from './type';
+
+type App = {
+ applications: Application[];
+}
+/**
+ * 获取最近 top5 应用
+ * @returns
+ */
+export const getTopFiveApp = (count: number): Promise<
+ [
+ any,
+ (
+ | FcResponse
+ | undefined
+ )
+ ]
+> => {
+ return get('/api/app/recent',{count});
+};
+
+export const appApi = {
+ getTopFiveApp,
+};
diff --git a/src/apis/paths/index.ts b/src/apis/paths/index.ts
index 191ea58..03028c2 100644
--- a/src/apis/paths/index.ts
+++ b/src/apis/paths/index.ts
@@ -12,4 +12,7 @@ export * from './conversation';
export * from './external';
export * from './apikey';
export * from './knowledge';
+export * from './app';
+export * from './api';
+
diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts
index 443fc29..8a0037f 100644
--- a/src/apis/paths/type.ts
+++ b/src/apis/paths/type.ts
@@ -87,3 +87,40 @@ export interface ConversationListItem {
export interface ConversationList {
conversations: Array;
}
+
+/*
+ * 应用数据结构
+ */
+export interface Application {
+ appId: string,
+ name: string,
+}
+
+/*
+ * 语意接口数据结构
+ */
+export interface ApiMessage {
+ apiId: string,
+ name: string,
+ type: string,
+ path: string,
+ description: string,
+}
+
+
+/*
+ * 语意接口数据结构
+ */
+export interface Service {
+ serviceId: string,
+ name: string,
+ icon: string,
+ author: string,
+ description: string,
+ favorite: boolean,
+}
+
+
+
+
+
diff --git a/src/store/conversation.ts b/src/store/conversation.ts
index aec2ae6..a250b93 100644
--- a/src/store/conversation.ts
+++ b/src/store/conversation.ts
@@ -23,6 +23,7 @@ import i18n from 'src/i18n';
import { ElMessageBox } from 'element-plus';
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
import { storeToRefs } from 'pinia';
+import { Application } from 'src/apis/paths/type';
const STREAM_URL = '/api/chat';
let controller = new AbortController();
@@ -70,7 +71,7 @@ export const useSessionStore = defineStore('conversation', () => {
// 会话列表
const conversationList = ref([]);
const app = ref({});
- const appList = ref([]);
+ const appList = ref();
// ai回复是否还在生成中
const isAnswerGenerating = ref(false);
/**
diff --git a/src/views/dialogue/Copilot.vue b/src/views/dialogue/Copilot.vue
index c161697..e7c9934 100644
--- a/src/views/dialogue/Copilot.vue
+++ b/src/views/dialogue/Copilot.vue
@@ -106,12 +106,16 @@ const handleSubmit = async () => {
dialogVisible.value = false;
};
-onMounted(() => {
+onMounted(async() => {
window.scrollTo({
top: 0,
left: 0,
});
- //获取 top5 list
+ //获取 top5 list
+ const [_, res] = await api.getTopFiveApp(5);
+ if(_ && res){
+ appList.value = res.result.applications;
+ }
});
watch(
diff --git a/src/views/dialogue/components/DialogueAside.vue b/src/views/dialogue/components/DialogueAside.vue
index 25bbb1b..b562f3b 100644
--- a/src/views/dialogue/components/DialogueAside.vue
+++ b/src/views/dialogue/components/DialogueAside.vue
@@ -20,6 +20,7 @@ import { successMsg } from 'src/components/Message';
import i18n from 'src/i18n';
import appIcon from '@/assets/images/app.png'
import { IconChevronUp } from '@computing/opendesign-icons';
+import { onMounted } from 'vue';
interface HistorySession {
conversation_id: string;
@@ -48,11 +49,11 @@ const isCollapsed = ref(false);
const selectedAppId = ref(null);
//
const apps = ref([
- { id: 1, name: '应用 1' },
- { id: 2, name: '应用 2' },
- { id: 3, name: '应用 3' },
- { id: 4, name: '应用 4' },
- { id: 5, name: '应用 5' },
+ { appId: "1", name: '应用 1' },
+ { appId: "2", name: '应用 2' },
+ { appId: "3", name: '应用 3' },
+ { appId: "4", name: '应用 4' },
+ { appId: "5", name: '应用 5' },
]);
const filteredHistorySessions = computed(() => {
@@ -238,6 +239,17 @@ function ensureAppAtFirstPosition() {
}
}
+onMounted(async() => {
+ //获取 top5 list
+ const [_, res] = await api.getTopFiveApp(5);
+ if(_ && res){
+ appList.value = res.result.applications;
+ }
+ else {
+ appList.value = apps.value;
+ }
+});
+
watch(
() => app,
() => {
--
Gitee
From 27cef3c419fc6249603e5f24292642b08f5adbeb Mon Sep 17 00:00:00 2001
From: cc500 <2014434568@qq.com>
Date: Tue, 21 Jan 2025 09:35:23 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E8=AF=AD=E4=B9=89=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E5=92=8C=E9=A6=96=E9=A1=B5api?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/paths/api.ts | 103 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 98 insertions(+), 5 deletions(-)
diff --git a/src/apis/paths/api.ts b/src/apis/paths/api.ts
index 3a1bd8d..18d1d8d 100644
--- a/src/apis/paths/api.ts
+++ b/src/apis/paths/api.ts
@@ -7,7 +7,7 @@
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v2 for more details.
-import { get, post } from 'src/apis/server';
+import { get, post, del, put } from 'src/apis/server';
import type { FcResponse } from 'src/apis/server';
import { ApiMessage, Service } from './type';
@@ -26,7 +26,7 @@ export const getApiMessageByServiceId = (
| FcResponse<{
serviceId: string;
name: string;
- apis:ApiMessage[];
+ apis: ApiMessage[];
}>
| undefined
)
@@ -36,7 +36,7 @@ export const getApiMessageByServiceId = (
};
/**
- * USER登录
+ * 查询语义服务列表
* @returns
*/
export const getApiMessageList = (params: {
@@ -52,7 +52,7 @@ export const getApiMessageList = (params: {
any,
(
| FcResponse<{
- services:Service[];
+ services: Service[];
}>
| undefined
)
@@ -62,10 +62,103 @@ export const getApiMessageList = (params: {
...params
});
};
-
+/**
+ * 通过上传 YAML 文本创建/编辑服务
+ * @returns
+ */
+export const uploadYAML = (params: {
+ serviceId?: string;
+ yaml: string;
+ }
+ ): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ serviceId: string;
+ name: string;
+ apis: ApiMessage[];
+ }>
+ | undefined
+ )
+ ]
+ > => {
+ return post('/api/service',{
+ ...params
+ });
+ };
+
+/**
+ * 获取指定服务的详细信息及 YAML 内容
+ * @returns
+ */
+export const getYAMLByServiceId = (params: {
+ serviceId: string;
+ }
+ ): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ serviceId: string;
+ name: string;
+ yaml: string;
+ }>
+ | undefined
+ )
+ ]
+ > => {
+ return get(`/api/service/${params.serviceId}`)
+ };
+
+/**
+ * 删除指定服务
+ * @returns
+ */
+export const deleteYAMLByServiceId = (params: {
+ serviceId: string;
+ }
+ ): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ serviceId: string;
+ }>
+ | undefined
+ )
+ ]
+ > => {
+ return del(`/api/service/${params.serviceId}`);
+ };
+
+/**
+ * 更改服务收藏状态
+ * @returns
+ */
+export const likeServiceByServiceId = (params: {
+ serviceId: string;
+ }
+ ): Promise<
+ [
+ any,
+ (
+ | FcResponse<{
+ serviceId: string;
+ }>
+ | undefined
+ )
+ ]
+ > => {
+ return put(`/api/service/${params.serviceId}`);
+ };
export const apiApi = {
getApiMessageByServiceId,
getApiMessageList,
+ uploadYAML,
+ getYAMLByServiceId,
+ deleteYAMLByServiceId,
+ likeServiceByServiceId,
};
--
Gitee
From b2543fe21bbe86bd98274d4222772a11205d1d27 Mon Sep 17 00:00:00 2001
From: cc500 <2014434568@qq.com>
Date: Tue, 21 Jan 2025 09:40:53 +0800
Subject: [PATCH 3/5] =?UTF-8?q?/chat=E6=8E=A5=E5=8F=A3=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E5=90=8D=E6=9B=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/paths/type.ts | 14 ++--
.../dialoguePanel/DialoguePanel.vue | 24 +++----
src/components/dialoguePanel/data.ts | 12 ++--
src/store/conversation.ts | 64 +++++++++----------
src/store/historySession.ts | 4 +-
src/views/dialogue/Copilot.vue | 2 +-
.../dialogue/components/DialogueSession.vue | 12 ++--
src/views/dialogue/types.ts | 2 +-
8 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts
index 8a0037f..8a53ea5 100644
--- a/src/apis/paths/type.ts
+++ b/src/apis/paths/type.ts
@@ -22,8 +22,8 @@ export interface Step {
// 定义流程信息的接口
export interface Flow {
- plugin_id: string;
- flow_id: string;
+ appId: string;
+ flowId: string;
steps: Step[];
}
@@ -44,7 +44,7 @@ export interface Metadata {
// 定义问答对数据结构
export interface ConversationRecord {
id: string;
- group_id: string;
+ groupId: string;
conversation_id: string;
task_id: string;
files: File[];
@@ -59,14 +59,14 @@ export interface ConversationRecordList {
}
/* 推荐问题的格式
- * "plugin_id": "aops-apollo", //推荐项关联的插件ID,若不关联则为空
- * "flow_id": "query_cve_info", //推荐项关联的工作流ID,若不关联则为空
+ * "appId": "aops-apollo", //推荐项关联的插件ID,若不关联则为空
+ * "flowId": "query_cve_info", //推荐项关联的工作流ID,若不关联则为空
* "flow_description": "查询机器192.168.10.1的CVE信息", //推荐项关联的工作流描述,若不关联则为空
* "question": "查询机器192.168.10.1的CVE信息", //推荐问题的内容
*/
export interface Suggest {
- plugin_id: string,
- flow_id: string,
+ appId: string,
+ flowId: string,
flow_description: string,
question: string,
}
diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue
index 5d955b6..fccc920 100644
--- a/src/components/dialoguePanel/DialoguePanel.vue
+++ b/src/components/dialoguePanel/DialoguePanel.vue
@@ -17,7 +17,7 @@ import { Linetooltip , Circlelegend } from './chartsCss'
import i18n from 'src/i18n';
import { storeToRefs } from 'pinia';
import { useLangStore } from 'src/store'
-const { user_selected_plugins } = storeToRefs(useHistorySessionStore());
+const { user_selected_app } = storeToRefs(useHistorySessionStore());
import { Suggest } from 'src/apis/paths/type';
const { params } = storeToRefs(useHistorySessionStore());
@@ -131,7 +131,7 @@ const handlePauseAndReGenerate = (cid?: number) => {
emits("clearSuggestion", props.key);
if (props.isFinish) {
// 重新生成
- reGenerateAnswer(cid, user_selected_plugins.value);
+ reGenerateAnswer(cid, user_selected_app.value);
} else {
// 停止生成
pausedStream(cid);
@@ -371,7 +371,7 @@ const zoom_out = () => {
const selectQuestion = (item:Suggest) => {
let question = item.question;
- let user_selected_flow = item.flow_id;
+ let user_selected_flow = item.flowId;
if(user_selected_flow){
emits('handleSendMessage',undefined,question,user_selected_flow);
}else{
@@ -400,27 +400,27 @@ const { sendQuestion } = useSessionStore();
const chatWithParams = async () => {
visible.value = false;
- // handleSendMessage(undefined,undefined,user_selected_plugins.value);
- // reGenerateAnswer(props.cid, user_selected_plugins.value,"params");
+ // handleSendMessage(undefined,undefined,user_selected_app.value);
+ // reGenerateAnswer(props.cid, user_selected_app.value,"params");
const language = localStorage.getItem('localeLang') === 'CN' ? 'zh' : 'en';
const len = conversationList.value.length;
const question = (conversationList.value[props.cid - 1]).message;
- const flow_id = (conversationList.value[props.cid]).flowdata.flow_id;
- await sendQuestion(undefined,question, user_selected_plugins.value, undefined, undefined, flow_id,params.value);
+ const flowId = (conversationList.value[props.cid]).flowdata.flowId;
+ await sendQuestion(undefined,question, user_selected_app.value, undefined, undefined, flowId,params.value);
}
-const searchPluginName = (plugin_id) => {
+const searchPluginName = (appId) => {
for(let item in props.modeOptions){
- if(props.modeOptions[item].value == plugin_id){
+ if(props.modeOptions[item].value == appId){
return props.modeOptions[item].label
}
}
return ''
}
-const handleSendMessage = async (question, user_selected_flow, user_selected_plugins) => {
+const handleSendMessage = async (question, user_selected_flow, user_selected_app) => {
visible.value = false;
- // handleSendMessage(undefined,undefined,user_selected_plugins.value);
+ // handleSendMessage(undefined,undefined,user_selected_app.value);
}
@@ -580,7 +580,7 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_plu
+ #{{searchPluginName(item.appId)}}
{{item.question}}
diff --git a/src/components/dialoguePanel/data.ts b/src/components/dialoguePanel/data.ts
index 17a34c4..76f7dcd 100644
--- a/src/components/dialoguePanel/data.ts
+++ b/src/components/dialoguePanel/data.ts
@@ -1,12 +1,12 @@
export const input = {
"event": "flow.start",
"id": "0f9d3e6b-7845-44ab-b247-35c522d38f13",
- "group_id": "09125776-ba69-4832-86c9-c5035f9343fd",
+ "groupId": "09125776-ba69-4832-86c9-c5035f9343fd",
"conversation_id": "eccb08c3-0621-4602-a4d2-4eaada892557",
"task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6",
"flow": {
- "plugin_id": "aops-cve",
- "flow_id": "query_cve_info",
+ "appId": "aops-cve",
+ "flowId": "query_cve_info",
"step_name": "开始",
"step_status": "finished",
"step_progress": "1/4"
@@ -26,12 +26,12 @@ export const input = {
export const output = {
"event": "flow.stop",
"id": "0f9d3e6b-7845-44ab-b247-35c522d38f13",
- "group_id": "09125776-ba69-4832-86c9-c5035f9343fd",
+ "groupId": "09125776-ba69-4832-86c9-c5035f9343fd",
"conversation_id": "eccb08c3-0621-4602-a4d2-4eaada892557",
"task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6",
"flow": {
- "plugin_id": "aops-cve",
- "flow_id": "query_cve_info",
+ "appId": "aops-cve",
+ "flowId": "query_cve_info",
"step_name": "开始",
"step_status": "finished",
"step_progress": "1/4"
diff --git a/src/store/conversation.ts b/src/store/conversation.ts
index a250b93..2dd5b22 100644
--- a/src/store/conversation.ts
+++ b/src/store/conversation.ts
@@ -82,11 +82,11 @@ export const useSessionStore = defineStore('conversation', () => {
const getStream = async (
params: {
question: string;
- user_selected_plugins?: any,
+ user_selected_app?: any,
conversation_id?: string;
qaRecordId?: string;
user_selected_flow?: string;
- group_id?: string;
+ groupId?: string;
params?: any;
},
ind?: number
@@ -124,11 +124,11 @@ export const useSessionStore = defineStore('conversation', () => {
question: params.question,
language,
conversation_id: params.conversation_id,
- group_id: params.group_id,
+ groupId: params.groupId,
// record_id: params.qaRecordId,
- plugins:[{
- plugin_id:params.user_selected_plugins[0],
- flow_id: params.user_selected_flow,
+ app:[{
+ appId:params.user_selected_app[0],
+ flowId: params.user_selected_flow,
params: pp,
auth:{},
}],
@@ -136,7 +136,7 @@ export const useSessionStore = defineStore('conversation', () => {
}),
});
}
- else if (params.user_selected_plugins) {
+ else if (params.user_selected_app) {
resp = await fetch(STREAM_URL, {
signal: controller.signal,
method: 'POST',
@@ -147,11 +147,11 @@ export const useSessionStore = defineStore('conversation', () => {
conversation_id: params.conversation_id,
record_id: params.qaRecordId,
language,
- group_id: params.group_id,
+ groupId: params.groupId,
// record_id: params.qaRecordId,
- plugins:[{
- plugin_id:params.user_selected_plugins[0],
- flow_id: "",
+ app:[{
+ appId:params.user_selected_app[0],
+ flowId: "",
params: pp,
auth:{},
}],
@@ -171,11 +171,11 @@ export const useSessionStore = defineStore('conversation', () => {
conversation_id: params.conversation_id,
record_id: params.qaRecordId,
language,
- group_id: params.group_id,
+ groupId: params.groupId,
// record_id: params.qaRecordId,
- plugins:[{
- plugin_id:"",
- flow_id: "",
+ app:[{
+ appId:"",
+ flowId: "",
params: {},
auth:{},
}],
@@ -255,7 +255,7 @@ export const useSessionStore = defineStore('conversation', () => {
//初始化获取 metadata
conversationItem.metadata = message.metadata;
conversationItem.createdAt = message.content.created_at;
- conversationItem.groupId = message.group_id;
+ conversationItem.groupId = message.groupId;
}
else if(message["event"] === "flow.start") {
//事件流开始
@@ -271,7 +271,7 @@ export const useSessionStore = defineStore('conversation', () => {
progress: flow?.step_progresss||"",
status:'running',
display:true,
- flow_id:flow?.flow_id||"",
+ flowId:flow?.flowId||"",
data:[[]],
}
}
@@ -451,15 +451,15 @@ export const useSessionStore = defineStore('conversation', () => {
* @param regenerateInd 重新生成的回答索引
*/
const sendQuestion = async (
- group_id:string|undefined,
+ groupId:string|undefined,
question: string,
- user_selected_plugins?: string[],
+ user_selected_app?: string[],
regenerateInd?: number,
qaRecordId?: string,
user_selected_flow?: string,
params?: any,
): Promise => {
- const groupId = group_id?group_id:"";
+ const groupId = groupId?groupId:"";
const { updateSessionTitle, currentSelectedSession } = useHistorySessionStore();
if (conversationList.value.length === 0) {
// 如果当前还没有对话记录,将第一个问题的questtion作为对话标题
@@ -498,25 +498,25 @@ export const useSessionStore = defineStore('conversation', () => {
}
isAnswerGenerating.value = true;
scrollBottom();
- if (user_selected_flow&&user_selected_plugins) {
+ if (user_selected_flow&&user_selected_app) {
await getStream(
{
question,
qaRecordId,
- user_selected_plugins:[...user_selected_plugins],
+ user_selected_app:[...user_selected_app],
user_selected_flow,
- group_id:groupId,
+ groupId:groupId,
params:params||undefined,
},
regenerateInd ?? undefined
)
- } else if (user_selected_plugins?.length) {
+ } else if (user_selected_app?.length) {
await getStream(
{
question,
qaRecordId,
- user_selected_plugins: [...user_selected_plugins],
- group_id:groupId,
+ user_selected_app: [...user_selected_app],
+ groupId:groupId,
params:params||undefined,
},
regenerateInd ?? undefined
@@ -526,7 +526,7 @@ export const useSessionStore = defineStore('conversation', () => {
{
question,
qaRecordId,
- group_id:groupId,
+ groupId:groupId,
},
regenerateInd ?? undefined
);
@@ -546,7 +546,7 @@ export const useSessionStore = defineStore('conversation', () => {
* 重新生成回答
* @param cid
*/
- const reGenerateAnswer = (cid: number, user_selected_plugins: any[],type?:string): void => {
+ const reGenerateAnswer = (cid: number, user_selected_app: any[],type?:string): void => {
const answerInd = conversationList.value.findIndex((val) => val.cid === cid);
const question = (conversationList.value[answerInd - 1] as UserConversationItem).message;
const recordId = (conversationList.value[answerInd] as RobotConversationItem).recordId;
@@ -560,7 +560,7 @@ export const useSessionStore = defineStore('conversation', () => {
if (!question) {
return;
}
- sendQuestion(groupId, question, user_selected_plugins, answerInd, recordId,"");
+ sendQuestion(groupId, question, user_selected_app, answerInd, recordId,"");
};
// #region ----------------------------------------< pagenation >--------------------------------------
@@ -609,11 +609,11 @@ export const useSessionStore = defineStore('conversation', () => {
res.result.records.forEach((record) => {
if (
(conversationList.value as RobotConversationItem[]).find(
- (i) => i.groupId === record.group_id
+ (i) => i.groupId === record.groupId
)
) {
const re = (conversationList.value as RobotConversationItem[]).find(
- (i) => i.groupId === record.group_id
+ (i) => i.groupId === record.groupId
);
re?.message.push(record.content.answer);
if (typeof (re?.message) !== 'string') {
@@ -644,7 +644,7 @@ export const useSessionStore = defineStore('conversation', () => {
isFinish: true,
recordId: record.id,
conversation_id: record.conversation_id,
- groupId: record.group_id,
+ groupId: record.groupId,
metadata: record.metadata,
}
);
diff --git a/src/store/historySession.ts b/src/store/historySession.ts
index 0e96d65..5d4adde 100644
--- a/src/store/historySession.ts
+++ b/src/store/historySession.ts
@@ -27,7 +27,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => {
// 历史会话列表
const historySession = ref([]);
const params = ref();
- const user_selected_plugins = ref([]);
+ const user_selected_app = ref([]);
const selectMode = ref([])
const currentSelectedSession = ref('');
/**
@@ -195,7 +195,7 @@ export const useHistorySessionStore = defineStore('sessionStore', () => {
createNewSession,
initSessionList,
generateSession,
- user_selected_plugins,
+ user_selected_app,
selectMode,
};
});
diff --git a/src/views/dialogue/Copilot.vue b/src/views/dialogue/Copilot.vue
index e7c9934..024d5ad 100644
--- a/src/views/dialogue/Copilot.vue
+++ b/src/views/dialogue/Copilot.vue
@@ -31,7 +31,7 @@ const modeOptions = reactive([
const setPlugins = async () => {
const [_, res] = await api.getRecognitionMode();
if (!_ && res) {
- res.result.plugins.forEach(item => {
+ res.result.app.forEach(item => {
const opt = {
label: item.name,
value: item.id,
diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue
index e76aced..598bff9 100644
--- a/src/views/dialogue/components/DialogueSession.vue
+++ b/src/views/dialogue/components/DialogueSession.vue
@@ -19,7 +19,7 @@ import { AttachAddon } from 'xterm-addon-attach';
import { Terminal } from 'xterm';
import 'xterm/css/xterm.css';
import i18n from 'src/i18n';
-const { user_selected_plugins, selectMode } = storeToRefs(useHistorySessionStore());
+const { user_selected_app, selectMode } = storeToRefs(useHistorySessionStore());
const { getHistorySession } = useHistorySessionStore();
const session = useSessionStore();
@@ -183,7 +183,7 @@ const handleSendMessage = async (groupId: string | undefined, question: string,
if (user_selected_flow) {
await sendQuestion(groupId, question, undefined, undefined, undefined, user_selected_flow, undefined);
} else {
- await sendQuestion(groupId, question, user_selected_plugins.value, undefined, undefined, undefined, undefined);
+ await sendQuestion(groupId, question, user_selected_app.value, undefined, undefined, undefined, undefined);
}
};
@@ -711,17 +711,17 @@ watch(
watch(selectMode, (newValue, oldValue) => {
setOptionDisabled();
- user_selected_plugins.value = [];
+ user_selected_app.value = [];
let first = true;
if (selectMode.value.length !== 0) {
if (selectMode.value[0] === 'auto') {
- user_selected_plugins.value.push('auto');
+ user_selected_app.value.push('auto');
} else {
selectMode.value.forEach(item => {
const plugin = {
plugin_name: item,
};
- user_selected_plugins.value.push(plugin.plugin_name);
+ user_selected_app.value.push(plugin.plugin_name);
});
}
}
@@ -800,7 +800,7 @@ const handlePauseAndReGenerate = (cid?: number) => {
:created-at="item.createdAt"
:current-selected="item.currentInd"
:need-regernerate="item.cid === conversationList.slice(-1)[0].cid"
- :user-selected-plugins="user_selected_plugins"
+ :user-selected-app="user_selected_app"
:search_suggestions="getItem(item, 'search_suggestions')"
:paramsList="getItem(item, 'paramsList')"
:modeOptions="modeOptions"
diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts
index 4034e3e..99d4162 100644
--- a/src/views/dialogue/types.ts
+++ b/src/views/dialogue/types.ts
@@ -67,7 +67,7 @@ export interface FlowType {
data:any,
display:boolean,
progress:string,
- flow_id?:string,
+ flowId?:string,
}
export interface FlowDataType {
--
Gitee
From 35b6d4d9a806ef4ae6c7165fbf2b80d287348956 Mon Sep 17 00:00:00 2001
From: cc500 <2014434568@qq.com>
Date: Tue, 21 Jan 2025 09:44:45 +0800
Subject: [PATCH 4/5] =?UTF-8?q?/chat=E6=8E=A5=E5=8F=A3=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E5=90=8D=E6=9B=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/dialoguePanel/DialoguePanel.vue | 6 +++---
src/views/dialogue/Copilot.vue | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue
index fccc920..1d68433 100644
--- a/src/components/dialoguePanel/DialoguePanel.vue
+++ b/src/components/dialoguePanel/DialoguePanel.vue
@@ -48,7 +48,7 @@ export interface DialoguePanelProps {
// 是否需要重新生成
needRegernerate?: boolean;
// 是否选择插件
- userSelectedPlugins?: any;
+ userSelectedApp?: any;
//
recordList?: string[] | undefined;
//
@@ -409,7 +409,7 @@ const chatWithParams = async () => {
await sendQuestion(undefined,question, user_selected_app.value, undefined, undefined, flowId,params.value);
}
-const searchPluginName = (appId) => {
+const searchAppName = (appId) => {
for(let item in props.modeOptions){
if(props.modeOptions[item].value == appId){
return props.modeOptions[item].label
@@ -580,7 +580,7 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_app
-
-
#{{searchPluginName(item.appId)}}
{{item.question}}
+ #{{searchAppName(item.appId)}}
{{item.question}}
diff --git a/src/views/dialogue/Copilot.vue b/src/views/dialogue/Copilot.vue
index 024d5ad..68073e6 100644
--- a/src/views/dialogue/Copilot.vue
+++ b/src/views/dialogue/Copilot.vue
@@ -28,7 +28,7 @@ const modeOptions = reactive([
},
]);
-const setPlugins = async () => {
+const setApps = async () => {
const [_, res] = await api.getRecognitionMode();
if (!_ && res) {
res.result.app.forEach(item => {
@@ -57,7 +57,7 @@ const initCopilot = async (): Promise => {
await api.getRecognitionMode();
await api.stopGeneration();
await getHistorySession();
- setPlugins();
+ setApps();
}
return;
} else if (currRoute.value.query.id) {
--
Gitee
From c90889292c5d16ee0fd37fcb20e6b63140ebeab2 Mon Sep 17 00:00:00 2001
From: cc500 <2014434568@qq.com>
Date: Tue, 21 Jan 2025 09:49:00 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/paths/index.ts | 4 +---
src/apis/paths/type.ts | 8 +-------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/apis/paths/index.ts b/src/apis/paths/index.ts
index 03028c2..0b0570c 100644
--- a/src/apis/paths/index.ts
+++ b/src/apis/paths/index.ts
@@ -13,6 +13,4 @@ export * from './external';
export * from './apikey';
export * from './knowledge';
export * from './app';
-export * from './api';
-
-
+export * from './api';
\ No newline at end of file
diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts
index 8a53ea5..d25c76e 100644
--- a/src/apis/paths/type.ts
+++ b/src/apis/paths/type.ts
@@ -107,7 +107,6 @@ export interface ApiMessage {
description: string,
}
-
/*
* 语意接口数据结构
*/
@@ -118,9 +117,4 @@ export interface Service {
author: string,
description: string,
favorite: boolean,
-}
-
-
-
-
-
+}
\ No newline at end of file
--
Gitee