@ibiz-template/vue3-components 0.7.41-alpha.51 → 0.7.41-alpha.52
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.
- package/dist/{index-CXaTaGlg.js → index-DFvp2f5r.js} +3 -3
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-Bcmawui0.js → wang-editor-BbR16ZTX.js} +1 -1
- package/dist/{xlsx-util-fU5jMSIx.js → xlsx-util-BkJoKKKt.js} +1 -1
- package/es/control/form/form-detail/form-button/form-button.css +1 -1
- package/es/control/form/form-detail/form-button/form-button.mjs +1 -1
- package/es/util/ai-chat-util/ai-chat-util.mjs +8 -10
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +29 -16
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +10 -11
- package/lib/control/form/form-detail/form-button/form-button.cjs +1 -1
- package/lib/control/form/form-detail/form-button/form-button.css +1 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +8 -10
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +10 -11
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +28 -15
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-form-button{--ibiz-form-button-icon-margin:var(--ibiz-spacing-extra-tight);--ibiz-form-button-icon-max-width:var(--ibiz-width-icon-medium);--ibiz-form-button-icon-max-height:var(--ibiz-width-icon-medium);width:100%;height:100%;padding:var(--ibiz-spacing-tight);overflow:hidden}.ibiz-form-button .el-button{width:100%;height:100%}.ibiz-form-button .el-button .ibiz-form-button-content{display:flex;align-items:center;justify-content:flex-start}.ibiz-form-button .el-button .ibiz-form-button-content i,.ibiz-form-button .el-button .ibiz-form-button-content img{display:inline-block;max-width:var(--ibiz-form-button-icon-max-width);max-height:var(--ibiz-form-button-icon-max-height)}.ibiz-form-button .el-button .ibiz-form-button-content .ibiz-icon+.ibiz-form-button-content--caption{margin-left:var(--ibiz-form-button-icon-margin)}.ibiz-form-button.is-loading .el-button .ibiz-icon{display:none}
|
|
1
|
+
.ibiz-form-button{--ibiz-form-button-icon-margin:var(--ibiz-spacing-extra-tight);--ibiz-form-button-icon-max-width:var(--ibiz-width-icon-medium);--ibiz-form-button-icon-max-height:var(--ibiz-width-icon-medium);width:100%;height:100%;padding:var(--ibiz-spacing-tight);overflow:hidden}.ibiz-form-button .el-button{width:100%;height:100%}.ibiz-form-button .el-button .ibiz-form-button-content{display:flex;align-items:center;justify-content:flex-start}.ibiz-form-button .el-button .ibiz-form-button-content i,.ibiz-form-button .el-button .ibiz-form-button-content img{display:inline-block;max-width:var(--ibiz-form-button-icon-max-width);max-height:var(--ibiz-form-button-icon-max-height)}.ibiz-form-button .el-button .ibiz-form-button-content .ibiz-icon+.ibiz-form-button-content--caption{margin-left:var(--ibiz-form-button-icon-margin)}.ibiz-form-button.is-loading .el-button .ibiz-icon{display:none}.ibiz-form-button.is-readonly{display:none}
|
|
@@ -41,7 +41,7 @@ const FormButton = /* @__PURE__ */ defineComponent({
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
return createVNode("div", {
|
|
44
|
-
"class": [this.ns.b(), this.ns.m(this.modelData.codeName), this.ns.is("loading", this.controller.state.loading), this.modelData.detailStyle && this.ns.m(this.modelData.detailStyle.toLowerCase()), ...this.controller.containerClass]
|
|
44
|
+
"class": [this.ns.b(), this.ns.m(this.modelData.codeName), this.ns.is("loading", this.controller.state.loading), this.ns.is("readonly", this.controller.state.readonly), this.modelData.detailStyle && this.ns.m(this.modelData.detailStyle.toLowerCase()), ...this.controller.containerClass]
|
|
45
45
|
}, [createVNode(resolveComponent("el-button"), {
|
|
46
46
|
"sime": "small",
|
|
47
47
|
"onClick": this.controller.onClick.bind(this.controller),
|
|
@@ -79,12 +79,9 @@ class AIChatUtil {
|
|
|
79
79
|
if (editorParams.srfaiagent) {
|
|
80
80
|
chatOptions.activeAIAgentID = editorParams.srfaiagent;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
context,
|
|
84
|
-
|
|
85
|
-
editorParams
|
|
86
|
-
);
|
|
87
|
-
chatOptions.aiAgentlist = aiAgentlist;
|
|
82
|
+
chatOptions.fetchAgentList = () => {
|
|
83
|
+
return this.getAIAgentList(context, params, editorParams);
|
|
84
|
+
};
|
|
88
85
|
if (deACMode) {
|
|
89
86
|
const {
|
|
90
87
|
contentToolbarItems,
|
|
@@ -308,7 +305,7 @@ class AIChatUtil {
|
|
|
308
305
|
if (isPluginApp) {
|
|
309
306
|
const mainApp = ibiz.hub.getApp();
|
|
310
307
|
const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
|
|
311
|
-
(subAppRef) => subAppRef.appId.endsWith(appId)
|
|
308
|
+
(subAppRef) => subAppRef.appId.endsWith("__".concat(appId))
|
|
312
309
|
);
|
|
313
310
|
if (targetApp) {
|
|
314
311
|
const targetAppId = targetApp.appId;
|
|
@@ -462,8 +459,9 @@ class AIChatUtil {
|
|
|
462
459
|
delete params.srfenableaiagentchange;
|
|
463
460
|
}
|
|
464
461
|
chatOptions.enableAIAgentChange = enableAIAgentChange;
|
|
465
|
-
|
|
466
|
-
|
|
462
|
+
chatOptions.fetchAgentList = () => {
|
|
463
|
+
return this.getAIAgentList(context, params);
|
|
464
|
+
};
|
|
467
465
|
if (deACMode) {
|
|
468
466
|
const {
|
|
469
467
|
contentToolbarItems,
|
|
@@ -685,7 +683,7 @@ class AIChatUtil {
|
|
|
685
683
|
if (isPluginApp) {
|
|
686
684
|
const mainApp = ibiz.hub.getApp();
|
|
687
685
|
const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
|
|
688
|
-
(subAppRef) => subAppRef.appId.endsWith(appId)
|
|
686
|
+
(subAppRef) => subAppRef.appId.endsWith("__".concat(appId))
|
|
689
687
|
);
|
|
690
688
|
if (targetApp) {
|
|
691
689
|
const targetAppId = targetApp.appId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import qs from 'qs';
|
|
2
2
|
import { notNilEmpty } from 'qx-util';
|
|
3
3
|
import { useUIStore } from '@ibiz-template/vue3-util';
|
|
4
|
-
import { onMounted, onUnmounted, ref,
|
|
4
|
+
import { onMounted, onUnmounted, ref, watch, nextTick } from 'vue';
|
|
5
5
|
import { calcResPath } from '@ibiz-template/runtime';
|
|
6
6
|
import { RegenerateIcon, insertTextIcon, ReplaceTextIcon, CopyTextIcon, CancelIcon } from './icon.mjs';
|
|
7
7
|
|
|
@@ -24,9 +24,9 @@ const computedInLineAIParams = (props) => {
|
|
|
24
24
|
inlinecompletionmode: (_g = (_f = params.inlinecompletionmode) != null ? _f : editorParams.inlinecompletionmode) != null ? _g : "async"
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
const useInLineAIContainerClick = (props,
|
|
27
|
+
const useInLineAIContainerClick = (props, opts) => {
|
|
28
|
+
const { message, isLoading, stopAsk } = opts;
|
|
28
29
|
const handMousedown = async (evt) => {
|
|
29
|
-
var _a;
|
|
30
30
|
const target = evt.target;
|
|
31
31
|
if (!target.closest(".ibiz-inline-ai-textarea-container") && !target.closest(".ibiz-inline-ai-alert")) {
|
|
32
32
|
const isChange = props.content !== message.value.content;
|
|
@@ -40,12 +40,8 @@ const useInLineAIContainerClick = (props, message, isLoading, abortController) =
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
if (isClose)
|
|
44
|
-
|
|
45
|
-
(_a = abortController.value) == null ? void 0 : _a.abort();
|
|
46
|
-
}
|
|
47
|
-
props.unMountAIChat();
|
|
48
|
-
}
|
|
43
|
+
if (isClose)
|
|
44
|
+
await stopAsk();
|
|
49
45
|
}
|
|
50
46
|
};
|
|
51
47
|
onMounted(() => {
|
|
@@ -93,7 +89,6 @@ const useAI = (props, opts) => {
|
|
|
93
89
|
);
|
|
94
90
|
}
|
|
95
91
|
};
|
|
96
|
-
const abortController = ref();
|
|
97
92
|
const attachUrlParam = (url) => {
|
|
98
93
|
{
|
|
99
94
|
const urlSplit = url.split("?");
|
|
@@ -172,6 +167,8 @@ const useAI = (props, opts) => {
|
|
|
172
167
|
}
|
|
173
168
|
return { think, content, toolcalls };
|
|
174
169
|
};
|
|
170
|
+
let asyncacitonid;
|
|
171
|
+
const abortController = ref();
|
|
175
172
|
const asyncAskAI = (question, callBack, errorBack) => {
|
|
176
173
|
return new Promise((resolve) => {
|
|
177
174
|
abortController.value = new AbortController();
|
|
@@ -187,6 +184,8 @@ const useAI = (props, opts) => {
|
|
|
187
184
|
if (e.data) {
|
|
188
185
|
const msg = JSON.parse(e.data);
|
|
189
186
|
let content = msg.actionresult || "";
|
|
187
|
+
if (msg.actionstate === 20)
|
|
188
|
+
asyncacitonid = msg.asyncacitonid;
|
|
190
189
|
if (msg.actionstate === 30 && content)
|
|
191
190
|
content = (_a = JSON.parse(content).choices) == null ? void 0 : _a[0].content;
|
|
192
191
|
callBack({ state: msg.actionstate, content });
|
|
@@ -233,12 +232,28 @@ const useAI = (props, opts) => {
|
|
|
233
232
|
return answer;
|
|
234
233
|
}
|
|
235
234
|
};
|
|
235
|
+
const stopAsk = async () => {
|
|
236
|
+
var _a;
|
|
237
|
+
(_a = abortController.value) == null ? void 0 : _a.abort();
|
|
238
|
+
if (asyncacitonid) {
|
|
239
|
+
const deService = await app.deService.getService(
|
|
240
|
+
context,
|
|
241
|
+
deACMode.appDataEntityId
|
|
242
|
+
);
|
|
243
|
+
await deService.aiChatCancel(context, params, {
|
|
244
|
+
asyncacitonid,
|
|
245
|
+
sessionid
|
|
246
|
+
});
|
|
247
|
+
asyncacitonid = void 0;
|
|
248
|
+
}
|
|
249
|
+
props.unMountAIChat();
|
|
250
|
+
};
|
|
236
251
|
return {
|
|
252
|
+
stopAsk,
|
|
237
253
|
syncAskAI,
|
|
238
254
|
asyncAskAI,
|
|
239
255
|
parseContent,
|
|
240
|
-
loadAiHistory
|
|
241
|
-
abortController
|
|
256
|
+
loadAiHistory
|
|
242
257
|
};
|
|
243
258
|
};
|
|
244
259
|
const useBase = (props, element, message) => {
|
|
@@ -295,11 +310,8 @@ const useBase = (props, element, message) => {
|
|
|
295
310
|
height: options.height ? "".concat(options.height, "px") : "auto",
|
|
296
311
|
"max-height": "".concat(options.maxHeight || (options.height && options.height > 300 ? options.height : 300), "px")
|
|
297
312
|
});
|
|
298
|
-
const toolcalls = computed(() => {
|
|
299
|
-
return message.value.toolcalls || [];
|
|
300
|
-
});
|
|
301
313
|
watch(
|
|
302
|
-
() =>
|
|
314
|
+
() => message.value,
|
|
303
315
|
() => {
|
|
304
316
|
nextTick(() => {
|
|
305
317
|
if (!textareaRef.value)
|
|
@@ -310,6 +322,7 @@ const useBase = (props, element, message) => {
|
|
|
310
322
|
});
|
|
311
323
|
},
|
|
312
324
|
{
|
|
325
|
+
deep: true,
|
|
313
326
|
immediate: true
|
|
314
327
|
}
|
|
315
328
|
);
|
|
@@ -96,22 +96,21 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
|
|
|
96
96
|
textareaRef
|
|
97
97
|
}, message);
|
|
98
98
|
const {
|
|
99
|
+
stopAsk,
|
|
99
100
|
syncAskAI,
|
|
100
101
|
asyncAskAI,
|
|
101
102
|
parseContent,
|
|
102
|
-
loadAiHistory
|
|
103
|
-
abortController
|
|
103
|
+
loadAiHistory
|
|
104
104
|
} = useAI(props, {
|
|
105
105
|
srfmode,
|
|
106
106
|
srfaiagent,
|
|
107
107
|
srfaiappendcurdata
|
|
108
108
|
});
|
|
109
|
-
useInLineAIContainerClick(props,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
109
|
+
useInLineAIContainerClick(props, {
|
|
110
|
+
message,
|
|
111
|
+
isLoading,
|
|
112
|
+
stopAsk
|
|
113
|
+
});
|
|
115
114
|
const handleAnswer = (answer) => {
|
|
116
115
|
switch (answer.state) {
|
|
117
116
|
case 20:
|
|
@@ -253,12 +252,12 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
|
|
|
253
252
|
containerRef,
|
|
254
253
|
contentStyle,
|
|
255
254
|
containerStyle,
|
|
255
|
+
stopAsk,
|
|
256
256
|
onKeydown,
|
|
257
257
|
renderError,
|
|
258
258
|
sendQuestion,
|
|
259
259
|
handleAction,
|
|
260
|
-
renderLoading
|
|
261
|
-
stopQuestionAndClose
|
|
260
|
+
renderLoading
|
|
262
261
|
};
|
|
263
262
|
},
|
|
264
263
|
render() {
|
|
@@ -296,7 +295,7 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
|
|
|
296
295
|
"class": this.ns.em("content", "suffix")
|
|
297
296
|
}, [this.isLoading && createVNode("div", {
|
|
298
297
|
"class": this.ns.em("content", "stop-icon"),
|
|
299
|
-
"onClick": () => this.
|
|
298
|
+
"onClick": () => this.stopAsk()
|
|
300
299
|
}, [StopIcon, createVNode("span", null, [ibiz.i18n.t("util.inlineAiUtil.stopEdit")])]), !this.disabled && createVNode("div", {
|
|
301
300
|
"class": this.ns.em("content", "sand-icon"),
|
|
302
301
|
"onClick": () => this.sendQuestion(this.message.content)
|
|
@@ -45,7 +45,7 @@ const FormButton = /* @__PURE__ */ vue.defineComponent({
|
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
return vue.createVNode("div", {
|
|
48
|
-
"class": [this.ns.b(), this.ns.m(this.modelData.codeName), this.ns.is("loading", this.controller.state.loading), this.modelData.detailStyle && this.ns.m(this.modelData.detailStyle.toLowerCase()), ...this.controller.containerClass]
|
|
48
|
+
"class": [this.ns.b(), this.ns.m(this.modelData.codeName), this.ns.is("loading", this.controller.state.loading), this.ns.is("readonly", this.controller.state.readonly), this.modelData.detailStyle && this.ns.m(this.modelData.detailStyle.toLowerCase()), ...this.controller.containerClass]
|
|
49
49
|
}, [vue.createVNode(vue.resolveComponent("el-button"), {
|
|
50
50
|
"sime": "small",
|
|
51
51
|
"onClick": this.controller.onClick.bind(this.controller),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-form-button{--ibiz-form-button-icon-margin:var(--ibiz-spacing-extra-tight);--ibiz-form-button-icon-max-width:var(--ibiz-width-icon-medium);--ibiz-form-button-icon-max-height:var(--ibiz-width-icon-medium);width:100%;height:100%;padding:var(--ibiz-spacing-tight);overflow:hidden}.ibiz-form-button .el-button{width:100%;height:100%}.ibiz-form-button .el-button .ibiz-form-button-content{display:flex;align-items:center;justify-content:flex-start}.ibiz-form-button .el-button .ibiz-form-button-content i,.ibiz-form-button .el-button .ibiz-form-button-content img{display:inline-block;max-width:var(--ibiz-form-button-icon-max-width);max-height:var(--ibiz-form-button-icon-max-height)}.ibiz-form-button .el-button .ibiz-form-button-content .ibiz-icon+.ibiz-form-button-content--caption{margin-left:var(--ibiz-form-button-icon-margin)}.ibiz-form-button.is-loading .el-button .ibiz-icon{display:none}
|
|
1
|
+
.ibiz-form-button{--ibiz-form-button-icon-margin:var(--ibiz-spacing-extra-tight);--ibiz-form-button-icon-max-width:var(--ibiz-width-icon-medium);--ibiz-form-button-icon-max-height:var(--ibiz-width-icon-medium);width:100%;height:100%;padding:var(--ibiz-spacing-tight);overflow:hidden}.ibiz-form-button .el-button{width:100%;height:100%}.ibiz-form-button .el-button .ibiz-form-button-content{display:flex;align-items:center;justify-content:flex-start}.ibiz-form-button .el-button .ibiz-form-button-content i,.ibiz-form-button .el-button .ibiz-form-button-content img{display:inline-block;max-width:var(--ibiz-form-button-icon-max-width);max-height:var(--ibiz-form-button-icon-max-height)}.ibiz-form-button .el-button .ibiz-form-button-content .ibiz-icon+.ibiz-form-button-content--caption{margin-left:var(--ibiz-form-button-icon-margin)}.ibiz-form-button.is-loading .el-button .ibiz-icon{display:none}.ibiz-form-button.is-readonly{display:none}
|
|
@@ -81,12 +81,9 @@ class AIChatUtil {
|
|
|
81
81
|
if (editorParams.srfaiagent) {
|
|
82
82
|
chatOptions.activeAIAgentID = editorParams.srfaiagent;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
context,
|
|
86
|
-
|
|
87
|
-
editorParams
|
|
88
|
-
);
|
|
89
|
-
chatOptions.aiAgentlist = aiAgentlist;
|
|
84
|
+
chatOptions.fetchAgentList = () => {
|
|
85
|
+
return this.getAIAgentList(context, params, editorParams);
|
|
86
|
+
};
|
|
90
87
|
if (deACMode) {
|
|
91
88
|
const {
|
|
92
89
|
contentToolbarItems,
|
|
@@ -310,7 +307,7 @@ class AIChatUtil {
|
|
|
310
307
|
if (isPluginApp) {
|
|
311
308
|
const mainApp = ibiz.hub.getApp();
|
|
312
309
|
const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
|
|
313
|
-
(subAppRef) => subAppRef.appId.endsWith(appId)
|
|
310
|
+
(subAppRef) => subAppRef.appId.endsWith("__".concat(appId))
|
|
314
311
|
);
|
|
315
312
|
if (targetApp) {
|
|
316
313
|
const targetAppId = targetApp.appId;
|
|
@@ -464,8 +461,9 @@ class AIChatUtil {
|
|
|
464
461
|
delete params.srfenableaiagentchange;
|
|
465
462
|
}
|
|
466
463
|
chatOptions.enableAIAgentChange = enableAIAgentChange;
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
chatOptions.fetchAgentList = () => {
|
|
465
|
+
return this.getAIAgentList(context, params);
|
|
466
|
+
};
|
|
469
467
|
if (deACMode) {
|
|
470
468
|
const {
|
|
471
469
|
contentToolbarItems,
|
|
@@ -687,7 +685,7 @@ class AIChatUtil {
|
|
|
687
685
|
if (isPluginApp) {
|
|
688
686
|
const mainApp = ibiz.hub.getApp();
|
|
689
687
|
const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
|
|
690
|
-
(subAppRef) => subAppRef.appId.endsWith(appId)
|
|
688
|
+
(subAppRef) => subAppRef.appId.endsWith("__".concat(appId))
|
|
691
689
|
);
|
|
692
690
|
if (targetApp) {
|
|
693
691
|
const targetAppId = targetApp.appId;
|
|
@@ -98,22 +98,21 @@ const InlineAITextArea = /* @__PURE__ */ vue.defineComponent({
|
|
|
98
98
|
textareaRef
|
|
99
99
|
}, message);
|
|
100
100
|
const {
|
|
101
|
+
stopAsk,
|
|
101
102
|
syncAskAI,
|
|
102
103
|
asyncAskAI,
|
|
103
104
|
parseContent,
|
|
104
|
-
loadAiHistory
|
|
105
|
-
abortController
|
|
105
|
+
loadAiHistory
|
|
106
106
|
} = inlineAiTextarea_hook.useAI(props, {
|
|
107
107
|
srfmode,
|
|
108
108
|
srfaiagent,
|
|
109
109
|
srfaiappendcurdata
|
|
110
110
|
});
|
|
111
|
-
inlineAiTextarea_hook.useInLineAIContainerClick(props,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
111
|
+
inlineAiTextarea_hook.useInLineAIContainerClick(props, {
|
|
112
|
+
message,
|
|
113
|
+
isLoading,
|
|
114
|
+
stopAsk
|
|
115
|
+
});
|
|
117
116
|
const handleAnswer = (answer) => {
|
|
118
117
|
switch (answer.state) {
|
|
119
118
|
case 20:
|
|
@@ -255,12 +254,12 @@ const InlineAITextArea = /* @__PURE__ */ vue.defineComponent({
|
|
|
255
254
|
containerRef,
|
|
256
255
|
contentStyle,
|
|
257
256
|
containerStyle,
|
|
257
|
+
stopAsk,
|
|
258
258
|
onKeydown,
|
|
259
259
|
renderError,
|
|
260
260
|
sendQuestion,
|
|
261
261
|
handleAction,
|
|
262
|
-
renderLoading
|
|
263
|
-
stopQuestionAndClose
|
|
262
|
+
renderLoading
|
|
264
263
|
};
|
|
265
264
|
},
|
|
266
265
|
render() {
|
|
@@ -298,7 +297,7 @@ const InlineAITextArea = /* @__PURE__ */ vue.defineComponent({
|
|
|
298
297
|
"class": this.ns.em("content", "suffix")
|
|
299
298
|
}, [this.isLoading && vue.createVNode("div", {
|
|
300
299
|
"class": this.ns.em("content", "stop-icon"),
|
|
301
|
-
"onClick": () => this.
|
|
300
|
+
"onClick": () => this.stopAsk()
|
|
302
301
|
}, [icon.StopIcon, vue.createVNode("span", null, [ibiz.i18n.t("util.inlineAiUtil.stopEdit")])]), !this.disabled && vue.createVNode("div", {
|
|
303
302
|
"class": this.ns.em("content", "sand-icon"),
|
|
304
303
|
"onClick": () => this.sendQuestion(this.message.content)
|
|
@@ -26,9 +26,9 @@ const computedInLineAIParams = (props) => {
|
|
|
26
26
|
inlinecompletionmode: (_g = (_f = params.inlinecompletionmode) != null ? _f : editorParams.inlinecompletionmode) != null ? _g : "async"
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
const useInLineAIContainerClick = (props,
|
|
29
|
+
const useInLineAIContainerClick = (props, opts) => {
|
|
30
|
+
const { message, isLoading, stopAsk } = opts;
|
|
30
31
|
const handMousedown = async (evt) => {
|
|
31
|
-
var _a;
|
|
32
32
|
const target = evt.target;
|
|
33
33
|
if (!target.closest(".ibiz-inline-ai-textarea-container") && !target.closest(".ibiz-inline-ai-alert")) {
|
|
34
34
|
const isChange = props.content !== message.value.content;
|
|
@@ -42,12 +42,8 @@ const useInLineAIContainerClick = (props, message, isLoading, abortController) =
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
if (isClose)
|
|
46
|
-
|
|
47
|
-
(_a = abortController.value) == null ? void 0 : _a.abort();
|
|
48
|
-
}
|
|
49
|
-
props.unMountAIChat();
|
|
50
|
-
}
|
|
45
|
+
if (isClose)
|
|
46
|
+
await stopAsk();
|
|
51
47
|
}
|
|
52
48
|
};
|
|
53
49
|
vue.onMounted(() => {
|
|
@@ -95,7 +91,6 @@ const useAI = (props, opts) => {
|
|
|
95
91
|
);
|
|
96
92
|
}
|
|
97
93
|
};
|
|
98
|
-
const abortController = vue.ref();
|
|
99
94
|
const attachUrlParam = (url) => {
|
|
100
95
|
{
|
|
101
96
|
const urlSplit = url.split("?");
|
|
@@ -174,6 +169,8 @@ const useAI = (props, opts) => {
|
|
|
174
169
|
}
|
|
175
170
|
return { think, content, toolcalls };
|
|
176
171
|
};
|
|
172
|
+
let asyncacitonid;
|
|
173
|
+
const abortController = vue.ref();
|
|
177
174
|
const asyncAskAI = (question, callBack, errorBack) => {
|
|
178
175
|
return new Promise((resolve) => {
|
|
179
176
|
abortController.value = new AbortController();
|
|
@@ -189,6 +186,8 @@ const useAI = (props, opts) => {
|
|
|
189
186
|
if (e.data) {
|
|
190
187
|
const msg = JSON.parse(e.data);
|
|
191
188
|
let content = msg.actionresult || "";
|
|
189
|
+
if (msg.actionstate === 20)
|
|
190
|
+
asyncacitonid = msg.asyncacitonid;
|
|
192
191
|
if (msg.actionstate === 30 && content)
|
|
193
192
|
content = (_a = JSON.parse(content).choices) == null ? void 0 : _a[0].content;
|
|
194
193
|
callBack({ state: msg.actionstate, content });
|
|
@@ -235,12 +234,28 @@ const useAI = (props, opts) => {
|
|
|
235
234
|
return answer;
|
|
236
235
|
}
|
|
237
236
|
};
|
|
237
|
+
const stopAsk = async () => {
|
|
238
|
+
var _a;
|
|
239
|
+
(_a = abortController.value) == null ? void 0 : _a.abort();
|
|
240
|
+
if (asyncacitonid) {
|
|
241
|
+
const deService = await app.deService.getService(
|
|
242
|
+
context,
|
|
243
|
+
deACMode.appDataEntityId
|
|
244
|
+
);
|
|
245
|
+
await deService.aiChatCancel(context, params, {
|
|
246
|
+
asyncacitonid,
|
|
247
|
+
sessionid
|
|
248
|
+
});
|
|
249
|
+
asyncacitonid = void 0;
|
|
250
|
+
}
|
|
251
|
+
props.unMountAIChat();
|
|
252
|
+
};
|
|
238
253
|
return {
|
|
254
|
+
stopAsk,
|
|
239
255
|
syncAskAI,
|
|
240
256
|
asyncAskAI,
|
|
241
257
|
parseContent,
|
|
242
|
-
loadAiHistory
|
|
243
|
-
abortController
|
|
258
|
+
loadAiHistory
|
|
244
259
|
};
|
|
245
260
|
};
|
|
246
261
|
const useBase = (props, element, message) => {
|
|
@@ -297,11 +312,8 @@ const useBase = (props, element, message) => {
|
|
|
297
312
|
height: options.height ? "".concat(options.height, "px") : "auto",
|
|
298
313
|
"max-height": "".concat(options.maxHeight || (options.height && options.height > 300 ? options.height : 300), "px")
|
|
299
314
|
});
|
|
300
|
-
const toolcalls = vue.computed(() => {
|
|
301
|
-
return message.value.toolcalls || [];
|
|
302
|
-
});
|
|
303
315
|
vue.watch(
|
|
304
|
-
() =>
|
|
316
|
+
() => message.value,
|
|
305
317
|
() => {
|
|
306
318
|
vue.nextTick(() => {
|
|
307
319
|
if (!textareaRef.value)
|
|
@@ -312,6 +324,7 @@ const useBase = (props, element, message) => {
|
|
|
312
324
|
});
|
|
313
325
|
},
|
|
314
326
|
{
|
|
327
|
+
deep: true,
|
|
315
328
|
immediate: true
|
|
316
329
|
}
|
|
317
330
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/vue3-components",
|
|
3
|
-
"version": "0.7.41-alpha.
|
|
3
|
+
"version": "0.7.41-alpha.52",
|
|
4
4
|
"description": "web端组件库(vue3)",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
32
32
|
"@floating-ui/dom": "^1.5.3",
|
|
33
|
-
"@ibiz-template-plugin/ai-chat": "^0.0.
|
|
33
|
+
"@ibiz-template-plugin/ai-chat": "^0.0.43",
|
|
34
34
|
"@ibiz-template-plugin/gantt": "0.1.8-alpha.378",
|
|
35
35
|
"@ibiz-template-plugin/bi-report": "0.0.30",
|
|
36
36
|
"@ibiz-template-plugin/data-view": "0.0.6",
|
|
37
37
|
"@ibiz-template/core": "0.7.41-alpha.53",
|
|
38
38
|
"@ibiz-template/devtool": "0.0.13",
|
|
39
|
-
"@ibiz-template/model-helper": "0.7.41-alpha.
|
|
40
|
-
"@ibiz-template/runtime": "0.7.41-alpha.
|
|
39
|
+
"@ibiz-template/model-helper": "0.7.41-alpha.54",
|
|
40
|
+
"@ibiz-template/runtime": "0.7.41-alpha.54",
|
|
41
41
|
"@ibiz-template/theme": "0.7.39",
|
|
42
|
-
"@ibiz-template/vue3-util": "0.7.41-alpha.
|
|
42
|
+
"@ibiz-template/vue3-util": "0.7.41-alpha.54",
|
|
43
43
|
"@ibiz-template/web-theme": "3.10.0",
|
|
44
44
|
"@ibiz/model-core": "^0.1.84",
|
|
45
45
|
"@imengyu/vue3-context-menu": "^1.3.5",
|