@ibiz-template/vue3-components 0.7.41-alpha.124 → 0.7.41-alpha.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ defineComponent({
13
13
  const ns = useNamespace("embed-ai-chat");
14
14
  const c = props.controller;
15
15
  const ctrl = c.ctrl;
16
+ const agentMap = /* @__PURE__ */ new Map();
17
+ const knowledgeMap = /* @__PURE__ */ new Map();
16
18
  const aiChatElementRef = ref(null);
17
19
  let mountedFlag = false;
18
20
  const mountedAIChat = async () => {
@@ -103,6 +105,22 @@ const IBizEmbedAIChat = /* @__PURE__ */ defineComponent({
103
105
  ...chatOptions,
104
106
  sessionid,
105
107
  isSimple: c.isSimple,
108
+ fetchAgentList: async (query) => {
109
+ let agent = agentMap.get(query);
110
+ if (agent == null ? void 0 : agent.length)
111
+ return agent;
112
+ agent = await chatOptions.fetchAgentList(query);
113
+ agentMap.set(query, agent);
114
+ return agent;
115
+ },
116
+ fetchKnowledgeBaseList: async (query) => {
117
+ let knowledge = knowledgeMap.get(query);
118
+ if (knowledge == null ? void 0 : knowledge.length)
119
+ return knowledge;
120
+ knowledge = await chatOptions.fetchKnowledgeBaseList(query);
121
+ knowledgeMap.set(query, knowledge);
122
+ return knowledge;
123
+ },
106
124
  action: (action, message) => {
107
125
  if (action === "send")
108
126
  ctrl.evt.emit("onFormDetailEvent", {
@@ -15,6 +15,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ vue.defineComponent({
15
15
  const ns = vue3Util.useNamespace("embed-ai-chat");
16
16
  const c = props.controller;
17
17
  const ctrl = c.ctrl;
18
+ const agentMap = /* @__PURE__ */ new Map();
19
+ const knowledgeMap = /* @__PURE__ */ new Map();
18
20
  const aiChatElementRef = vue.ref(null);
19
21
  let mountedFlag = false;
20
22
  const mountedAIChat = async () => {
@@ -105,6 +107,22 @@ const IBizEmbedAIChat = /* @__PURE__ */ vue.defineComponent({
105
107
  ...chatOptions,
106
108
  sessionid,
107
109
  isSimple: c.isSimple,
110
+ fetchAgentList: async (query) => {
111
+ let agent = agentMap.get(query);
112
+ if (agent == null ? void 0 : agent.length)
113
+ return agent;
114
+ agent = await chatOptions.fetchAgentList(query);
115
+ agentMap.set(query, agent);
116
+ return agent;
117
+ },
118
+ fetchKnowledgeBaseList: async (query) => {
119
+ let knowledge = knowledgeMap.get(query);
120
+ if (knowledge == null ? void 0 : knowledge.length)
121
+ return knowledge;
122
+ knowledge = await chatOptions.fetchKnowledgeBaseList(query);
123
+ knowledgeMap.set(query, knowledge);
124
+ return knowledge;
125
+ },
108
126
  action: (action, message) => {
109
127
  if (action === "send")
110
128
  ctrl.evt.emit("onFormDetailEvent", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.124",
3
+ "version": "0.7.41-alpha.125",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@amap/amap-jsapi-loader": "^1.0.1",
33
33
  "@floating-ui/dom": "^1.5.3",
34
- "@ibiz-template-plugin/ai-chat": "^0.0.95",
34
+ "@ibiz-template-plugin/ai-chat": "^0.0.96",
35
35
  "@ibiz-template-plugin/gantt": "0.1.8-alpha.468",
36
36
  "@ibiz-template-plugin/bi-report": "0.0.32",
37
37
  "@ibiz-template-plugin/data-view": "0.0.8",
@@ -25,6 +25,8 @@ export const IBizEmbedAIChat = defineComponent({
25
25
  const ns = useNamespace('embed-ai-chat');
26
26
  const c = props.controller;
27
27
  const ctrl = c.ctrl as EditFormController;
28
+ const agentMap: Map<string | undefined, IData[]> = new Map();
29
+ const knowledgeMap: Map<string | undefined, IData[]> = new Map();
28
30
 
29
31
  // AI聊天框挂载元素
30
32
  const aiChatElementRef: Ref<HTMLElement | null> = ref(null);
@@ -135,6 +137,20 @@ export const IBizEmbedAIChat = defineComponent({
135
137
  ...chatOptions,
136
138
  sessionid,
137
139
  isSimple: c.isSimple,
140
+ fetchAgentList: async (query?: string) => {
141
+ let agent = agentMap.get(query);
142
+ if (agent?.length) return agent;
143
+ agent = await chatOptions.fetchAgentList(query);
144
+ agentMap.set(query, agent as IData[]);
145
+ return agent;
146
+ },
147
+ fetchKnowledgeBaseList: async (query?: string) => {
148
+ let knowledge = knowledgeMap.get(query);
149
+ if (knowledge?.length) return knowledge;
150
+ knowledge = await chatOptions.fetchKnowledgeBaseList(query);
151
+ knowledgeMap.set(query, knowledge as IData[]);
152
+ return knowledge;
153
+ },
138
154
  action: (action: string, message: IData) => {
139
155
  if (action === 'send')
140
156
  ctrl.evt.emit('onFormDetailEvent', {