@done-coding/forge-kit-agent 0.0.0-stage → 0.100.0
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/LICENSE +21 -0
- package/README.md +53 -2
- package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/es/components/bubble/AiBubbleContent.vue.mjs +7 -0
- package/es/components/bubble/AiBubbleContent.vue2.mjs +209 -0
- package/es/components/bubble/AiBubbleFooter.vue.mjs +7 -0
- package/es/components/bubble/AiBubbleFooter.vue2.mjs +91 -0
- package/es/components/bubble/AiCodeHeaderControl.vue.mjs +7 -0
- package/es/components/bubble/AiCodeHeaderControl.vue2.mjs +97 -0
- package/es/components/bubble/AiContentSplit.vue.mjs +70 -0
- package/es/components/bubble/AiContentSplit.vue2.mjs +4 -0
- package/es/components/bubble/AiPartRenderer.vue.mjs +7 -0
- package/es/components/bubble/AiPartRenderer.vue2.mjs +184 -0
- package/es/components/bubble/AiThinkBox.vue.mjs +7 -0
- package/es/components/bubble/AiThinkBox.vue2.mjs +155 -0
- package/es/components/bubble/AiTypewriter.vue.mjs +81 -0
- package/es/components/bubble/AiTypewriter.vue2.mjs +4 -0
- package/es/components/config/AiConfigProvider.vue.mjs +31 -0
- package/es/components/config/AiConfigProvider.vue2.mjs +4 -0
- package/es/components/dialogue/AiDialogue.vue.mjs +7 -0
- package/es/components/dialogue/AiDialogue.vue2.mjs +242 -0
- package/es/components/dialogue/AiDialogueGroup.vue.mjs +7 -0
- package/es/components/dialogue/AiDialogueGroup.vue2.mjs +133 -0
- package/es/components/dialogue/AiDialogueWrap.vue.mjs +7 -0
- package/es/components/dialogue/AiDialogueWrap.vue2.mjs +73 -0
- package/es/components/dialogue/AiMessageList.vue.mjs +7 -0
- package/es/components/dialogue/AiMessageList.vue2.mjs +111 -0
- package/es/components/json-trigger/LlmJsonTrigger.vue.mjs +7 -0
- package/es/components/json-trigger/LlmJsonTrigger.vue2.mjs +130 -0
- package/es/components/operation/AiOperationBar.vue.mjs +7 -0
- package/es/components/operation/AiOperationBar.vue2.mjs +174 -0
- package/es/components/operation/AiOperationBtns.vue.mjs +7 -0
- package/es/components/operation/AiOperationBtns.vue2.mjs +140 -0
- package/es/components/sender/AiSender.vue.mjs +7 -0
- package/es/components/sender/AiSender.vue2.mjs +74 -0
- package/es/components/sender/AiSenderHeader.vue.mjs +7 -0
- package/es/components/sender/AiSenderHeader.vue2.mjs +78 -0
- package/es/hooks/CodeXSlot.mjs +20 -0
- package/es/hooks/SessionExpose.mjs +81 -0
- package/es/hooks/agent-tools.mjs +95 -0
- package/es/hooks/agent.mjs +143 -0
- package/es/hooks/bubble-list.mjs +64 -0
- package/es/hooks/expose.mjs +133 -0
- package/es/hooks/fix-bubble-list-bug.mjs +65 -0
- package/es/hooks/sender-history.mjs +28 -0
- package/es/hooks/sender.mjs +197 -0
- package/es/hooks/session-list.mjs +154 -0
- package/es/hooks/sse.mjs +401 -0
- package/es/hooks/storage.mjs +217 -0
- package/es/hooks/theme.mjs +253 -0
- package/es/hooks/use-density.mjs +100 -0
- package/es/hooks/use-empty-state-center.mjs +40 -0
- package/es/hooks/use-keyboard-inset.mjs +87 -0
- package/es/index.mjs +68 -0
- package/es/style.css +836 -0
- package/es/types/index.mjs +54 -0
- package/es/utils/index.mjs +34 -0
- package/es/utils/json-from-llm.mjs +26 -0
- package/es/utils/request-llm.mjs +60 -0
- package/package.json +83 -4
- package/types/bridge/config-hook.d.ts +21 -0
- package/types/bridge/index.d.ts +69 -0
- package/types/bridge/plugin.d.ts +39 -0
- package/types/bridge/state.d.ts +26 -0
- package/types/bridge/storage.d.ts +10 -0
- package/types/components/bubble/AiBubbleContent.vue.d.ts +57 -0
- package/types/components/bubble/AiBubbleFooter.vue.d.ts +6 -0
- package/types/components/bubble/AiCodeHeaderControl.vue.d.ts +7 -0
- package/types/components/bubble/AiContentSplit.vue.d.ts +36 -0
- package/types/components/bubble/AiPartRenderer.vue.d.ts +9 -0
- package/types/components/bubble/AiThinkBox.vue.d.ts +31 -0
- package/types/components/bubble/AiTypewriter.vue.d.ts +28 -0
- package/types/components/config/AiConfigProvider.vue.d.ts +28 -0
- package/types/components/dialogue/AiDialogue.vue.d.ts +546 -0
- package/types/components/dialogue/AiDialogueGroup.vue.d.ts +49 -0
- package/types/components/dialogue/AiDialogueWrap.vue.d.ts +38 -0
- package/types/components/dialogue/AiMessageList.vue.d.ts +65 -0
- package/types/components/json-trigger/LlmJsonTrigger.vue.d.ts +43 -0
- package/types/components/json-trigger/types.d.ts +12 -0
- package/types/components/operation/AiOperationBar.vue.d.ts +36 -0
- package/types/components/operation/AiOperationBtns.vue.d.ts +27 -0
- package/types/components/sender/AiSender.vue.d.ts +38 -0
- package/types/components/sender/AiSenderHeader.vue.d.ts +28 -0
- package/types/hooks/CodeXSlot.d.ts +7 -0
- package/types/hooks/SessionExpose.d.ts +20 -0
- package/types/hooks/agent-tools.d.ts +67 -0
- package/types/hooks/agent.d.ts +43 -0
- package/types/hooks/bubble-list.d.ts +22 -0
- package/types/hooks/expose.d.ts +111 -0
- package/types/hooks/fix-bubble-list-bug.d.ts +8 -0
- package/types/hooks/sender-history.d.ts +41 -0
- package/types/hooks/sender.d.ts +101 -0
- package/types/hooks/session-list.d.ts +36 -0
- package/types/hooks/sse.d.ts +239 -0
- package/types/hooks/storage.d.ts +70 -0
- package/types/hooks/theme.d.ts +37 -0
- package/types/hooks/use-density.d.ts +66 -0
- package/types/hooks/use-empty-state-center.d.ts +23 -0
- package/types/hooks/use-keyboard-inset.d.ts +37 -0
- package/types/index.d.ts +26 -0
- package/types/inject/key.d.ts +20 -0
- package/types/types/index.d.ts +612 -0
- package/types/utils/index.d.ts +29 -0
- package/types/utils/json-from-llm.d.ts +35 -0
- package/types/utils/request-llm.d.ts +44 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, withKeys, withModifiers, createElementBlock, toDisplayString, createCommentVNode, createTextVNode, renderSlot } from "vue";
|
|
2
|
+
import { ElPopover, ElInput, ElButton } from "element-plus";
|
|
3
|
+
import { MagicStick } from "@element-plus/icons-vue";
|
|
4
|
+
import { getJsonFromLlm } from "../../utils/json-from-llm.mjs";
|
|
5
|
+
const _hoisted_1 = { class: "ai-llm-json-trigger" };
|
|
6
|
+
const _hoisted_2 = { class: "ai-llm-json-trigger-panel" };
|
|
7
|
+
const _hoisted_3 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "ai-llm-json-trigger-error"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_4 = { class: "ai-llm-json-trigger-actions" };
|
|
12
|
+
const _hoisted_5 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "ai-llm-json-trigger-result"
|
|
15
|
+
};
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...{ name: "LlmJsonTrigger", inheritAttrs: false },
|
|
18
|
+
__name: "LlmJsonTrigger",
|
|
19
|
+
props: {
|
|
20
|
+
getSchema: {},
|
|
21
|
+
onData: {},
|
|
22
|
+
sseUrl: {},
|
|
23
|
+
model: { default: void 0 },
|
|
24
|
+
headers: { type: [Object, Function], default: void 0 },
|
|
25
|
+
body: { default: void 0 },
|
|
26
|
+
systemPrompt: { default: void 0 },
|
|
27
|
+
placeholder: { default: "粘贴一段文本(邮件 / 工单 / 发票…)或说「模拟一份…」,回车填充,Shift+Enter 换行" }
|
|
28
|
+
},
|
|
29
|
+
setup(__props) {
|
|
30
|
+
const props = __props;
|
|
31
|
+
const triggerPrompt = ref("");
|
|
32
|
+
const triggerLoading = ref(false);
|
|
33
|
+
const triggerError = ref("");
|
|
34
|
+
const triggerApplied = ref(null);
|
|
35
|
+
const onTriggerSubmit = async () => {
|
|
36
|
+
const prompt = triggerPrompt.value.trim();
|
|
37
|
+
if (!prompt || triggerLoading.value) return;
|
|
38
|
+
triggerError.value = "";
|
|
39
|
+
triggerLoading.value = true;
|
|
40
|
+
try {
|
|
41
|
+
const schema = await props.getSchema();
|
|
42
|
+
const data = await getJsonFromLlm({
|
|
43
|
+
sseUrl: props.sseUrl,
|
|
44
|
+
model: props.model,
|
|
45
|
+
headers: props.headers,
|
|
46
|
+
body: props.body,
|
|
47
|
+
systemPrompt: props.systemPrompt,
|
|
48
|
+
schema,
|
|
49
|
+
prompt
|
|
50
|
+
});
|
|
51
|
+
triggerApplied.value = props.onData(data);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
triggerError.value = error instanceof Error && error.message ? error.message : "填充失败";
|
|
54
|
+
} finally {
|
|
55
|
+
triggerLoading.value = false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const onTriggerUndo = () => {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = triggerApplied.value) == null ? void 0 : _a.undo();
|
|
61
|
+
triggerApplied.value = null;
|
|
62
|
+
};
|
|
63
|
+
return (_ctx, _cache) => {
|
|
64
|
+
return openBlock(), createBlock(unref(ElPopover), {
|
|
65
|
+
trigger: "click",
|
|
66
|
+
"show-arrow": false,
|
|
67
|
+
width: "340",
|
|
68
|
+
placement: "bottom-end",
|
|
69
|
+
"popper-class": "ai-llm-json-trigger-popper"
|
|
70
|
+
}, {
|
|
71
|
+
reference: withCtx(() => [
|
|
72
|
+
createElementVNode("span", _hoisted_1, [
|
|
73
|
+
renderSlot(_ctx.$slots, "trigger", {}, () => [
|
|
74
|
+
createVNode(unref(ElButton), {
|
|
75
|
+
circle: "",
|
|
76
|
+
size: "small",
|
|
77
|
+
icon: unref(MagicStick),
|
|
78
|
+
title: "AI 填充"
|
|
79
|
+
}, null, 8, ["icon"])
|
|
80
|
+
], true)
|
|
81
|
+
])
|
|
82
|
+
]),
|
|
83
|
+
default: withCtx(() => [
|
|
84
|
+
createElementVNode("div", _hoisted_2, [
|
|
85
|
+
createVNode(unref(ElInput), {
|
|
86
|
+
modelValue: triggerPrompt.value,
|
|
87
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => triggerPrompt.value = $event),
|
|
88
|
+
type: "textarea",
|
|
89
|
+
rows: 4,
|
|
90
|
+
resize: "none",
|
|
91
|
+
disabled: triggerLoading.value,
|
|
92
|
+
placeholder: __props.placeholder,
|
|
93
|
+
onKeydown: withKeys(withModifiers(onTriggerSubmit, ["exact", "prevent"]), ["enter"])
|
|
94
|
+
}, null, 8, ["modelValue", "disabled", "placeholder", "onKeydown"]),
|
|
95
|
+
triggerError.value ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(triggerError.value), 1)) : createCommentVNode("", true),
|
|
96
|
+
createElementVNode("div", _hoisted_4, [
|
|
97
|
+
triggerApplied.value ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(triggerApplied.value.appliedCount > 0 ? `已应用 ${triggerApplied.value.appliedCount} 项` : "没有可填的内容——试试粘贴一段含信息的文本,或说「模拟一份…」"), 1)) : createCommentVNode("", true),
|
|
98
|
+
triggerApplied.value && triggerApplied.value.appliedCount > 0 ? (openBlock(), createBlock(unref(ElButton), {
|
|
99
|
+
key: 1,
|
|
100
|
+
size: "small",
|
|
101
|
+
text: "",
|
|
102
|
+
onClick: onTriggerUndo
|
|
103
|
+
}, {
|
|
104
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
105
|
+
createTextVNode("撤销", -1)
|
|
106
|
+
])]),
|
|
107
|
+
_: 1
|
|
108
|
+
})) : createCommentVNode("", true),
|
|
109
|
+
createVNode(unref(ElButton), {
|
|
110
|
+
size: "small",
|
|
111
|
+
type: "primary",
|
|
112
|
+
loading: triggerLoading.value,
|
|
113
|
+
onClick: onTriggerSubmit
|
|
114
|
+
}, {
|
|
115
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
116
|
+
createTextVNode("填充", -1)
|
|
117
|
+
])]),
|
|
118
|
+
_: 1
|
|
119
|
+
}, 8, ["loading"])
|
|
120
|
+
])
|
|
121
|
+
])
|
|
122
|
+
]),
|
|
123
|
+
_: 3
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
export {
|
|
129
|
+
_sfc_main as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./AiOperationBar.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const AiOperationBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cda039aa"]]);
|
|
5
|
+
export {
|
|
6
|
+
AiOperationBar as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, useModel, ref, computed, watch, nextTick, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, renderSlot, normalizeStyle, createBlock, unref, createTextVNode, toDisplayString, mergeModels } from "vue";
|
|
2
|
+
import { ElText } from "element-plus";
|
|
3
|
+
import { Conversations } from "vue-element-plus-x";
|
|
4
|
+
import { useAiExposeInject } from "../../hooks/expose.mjs";
|
|
5
|
+
import AiOperationBtns from "./AiOperationBtns.vue.mjs";
|
|
6
|
+
import { getCssWithUnit, formatTimestamp } from "../../utils/index.mjs";
|
|
7
|
+
const _hoisted_1 = { class: "ai-operation-bar-btns" };
|
|
8
|
+
const _hoisted_2 = { class: "session-group" };
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "ai-operation-bar-empty"
|
|
12
|
+
};
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "AiOperationBar",
|
|
15
|
+
props: /* @__PURE__ */ mergeModels({
|
|
16
|
+
position: { default: "right" },
|
|
17
|
+
collapsedWidth: { default: 50 },
|
|
18
|
+
unCollapseWidth: { default: 200 },
|
|
19
|
+
list: {},
|
|
20
|
+
sessionListLoadMoreLoading: { type: Boolean },
|
|
21
|
+
onClose: {},
|
|
22
|
+
logoUrl: {}
|
|
23
|
+
}, {
|
|
24
|
+
"activeSessionId": {},
|
|
25
|
+
"activeSessionIdModifiers": {},
|
|
26
|
+
"isCollapsed": { type: Boolean, ...{
|
|
27
|
+
default: true
|
|
28
|
+
} },
|
|
29
|
+
"isCollapsedModifiers": {}
|
|
30
|
+
}),
|
|
31
|
+
emits: /* @__PURE__ */ mergeModels(["sessionListLodeMore"], ["update:activeSessionId", "update:isCollapsed"]),
|
|
32
|
+
setup(__props, { emit: __emit }) {
|
|
33
|
+
useCssVars((_ctx) => ({
|
|
34
|
+
"v62cdf769": shimWidthPx.value,
|
|
35
|
+
"v6630809c": unCollapseWidthPx.value
|
|
36
|
+
}));
|
|
37
|
+
const props = __props;
|
|
38
|
+
const emits = __emit;
|
|
39
|
+
const activeSessionId = useModel(__props, "activeSessionId");
|
|
40
|
+
const isCollapsed = useModel(__props, "isCollapsed");
|
|
41
|
+
const getDate = (time = Date.now()) => formatTimestamp(time, "YYYY-MM-DD");
|
|
42
|
+
const todayDate = ref(getDate());
|
|
43
|
+
const conversationsListStyle = computed(() => {
|
|
44
|
+
return {
|
|
45
|
+
width: isCollapsed.value ? "0px" : "auto"
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const unCollapseWidthPx = computed(() => getCssWithUnit(props.unCollapseWidth));
|
|
49
|
+
const collapsedWidthPx = computed(() => getCssWithUnit(props.collapsedWidth));
|
|
50
|
+
const position = computed(() => props.position);
|
|
51
|
+
const tooltipPlacement = computed(() => {
|
|
52
|
+
return {
|
|
53
|
+
left: "right",
|
|
54
|
+
right: "left"
|
|
55
|
+
}[position.value];
|
|
56
|
+
});
|
|
57
|
+
const shimWidthPx = computed(
|
|
58
|
+
() => isCollapsed.value ? collapsedWidthPx.value : unCollapseWidthPx.value
|
|
59
|
+
);
|
|
60
|
+
const { aiExpose } = useAiExposeInject();
|
|
61
|
+
const hideBar = () => {
|
|
62
|
+
isCollapsed.value = true;
|
|
63
|
+
};
|
|
64
|
+
const handleCreateSession = () => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
hideBar();
|
|
67
|
+
activeSessionId.value = void 0;
|
|
68
|
+
(_b = (_a = aiExpose == null ? void 0 : aiExpose.value) == null ? void 0 : _a.sender) == null ? void 0 : _b.focus();
|
|
69
|
+
};
|
|
70
|
+
const handleToggleCollapsed = () => {
|
|
71
|
+
isCollapsed.value = !isCollapsed.value;
|
|
72
|
+
};
|
|
73
|
+
const handleLoadMore = () => {
|
|
74
|
+
emits("sessionListLodeMore");
|
|
75
|
+
};
|
|
76
|
+
const getGroupTitle = (title) => {
|
|
77
|
+
return title === todayDate.value ? "今天" : title;
|
|
78
|
+
};
|
|
79
|
+
const groupList = computed(() => {
|
|
80
|
+
return props.list.map((item) => {
|
|
81
|
+
return {
|
|
82
|
+
...item,
|
|
83
|
+
group: getDate(item.lastMsgCreatedAt)
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
watch(activeSessionId, () => {
|
|
88
|
+
nextTick(() => {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
(_b = (_a = aiExpose == null ? void 0 : aiExpose.value) == null ? void 0 : _a.sender) == null ? void 0 : _b.focus();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
watch(
|
|
94
|
+
groupList,
|
|
95
|
+
() => {
|
|
96
|
+
todayDate.value = getDate();
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
immediate: true
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
return (_ctx, _cache) => {
|
|
103
|
+
return openBlock(), createElementBlock("div", {
|
|
104
|
+
class: normalizeClass(["ai-operation-bar", {
|
|
105
|
+
[`ai-operation-bar_${position.value}`]: true
|
|
106
|
+
}])
|
|
107
|
+
}, [
|
|
108
|
+
createElementVNode("div", {
|
|
109
|
+
class: normalizeClass(["ai-operation-bar-shim", {
|
|
110
|
+
[`ai-operation-bar-shim_${position.value}`]: true
|
|
111
|
+
}])
|
|
112
|
+
}, [
|
|
113
|
+
createElementVNode("div", _hoisted_1, [
|
|
114
|
+
createVNode(AiOperationBtns, {
|
|
115
|
+
"is-collapsed": isCollapsed.value,
|
|
116
|
+
"onUpdate:isCollapsed": _cache[0] || (_cache[0] = ($event) => isCollapsed.value = $event),
|
|
117
|
+
"tooltip-placement": tooltipPlacement.value,
|
|
118
|
+
"on-close": __props.onClose,
|
|
119
|
+
"logo-url": __props.logoUrl,
|
|
120
|
+
onCreateSession: handleCreateSession,
|
|
121
|
+
onToggleCollapsed: handleToggleCollapsed
|
|
122
|
+
}, {
|
|
123
|
+
logo: withCtx(() => [
|
|
124
|
+
renderSlot(_ctx.$slots, "logo", {}, void 0, true)
|
|
125
|
+
]),
|
|
126
|
+
_: 3
|
|
127
|
+
}, 8, ["is-collapsed", "tooltip-placement", "on-close", "logo-url"])
|
|
128
|
+
]),
|
|
129
|
+
createElementVNode("div", {
|
|
130
|
+
class: "ai-operation-bar-session-list",
|
|
131
|
+
style: normalizeStyle(conversationsListStyle.value)
|
|
132
|
+
}, [
|
|
133
|
+
__props.list.length ? (openBlock(), createBlock(unref(Conversations), {
|
|
134
|
+
key: 0,
|
|
135
|
+
active: activeSessionId.value,
|
|
136
|
+
"onUpdate:active": [
|
|
137
|
+
_cache[1] || (_cache[1] = ($event) => activeSessionId.value = $event),
|
|
138
|
+
hideBar
|
|
139
|
+
],
|
|
140
|
+
class: "ai-operation-bar-conversations",
|
|
141
|
+
items: groupList.value,
|
|
142
|
+
"show-tooltip": false,
|
|
143
|
+
"row-key": "id",
|
|
144
|
+
groupable: "",
|
|
145
|
+
showToTopBtn: "",
|
|
146
|
+
showBuiltInMenu: false,
|
|
147
|
+
"load-more": handleLoadMore,
|
|
148
|
+
loadMoreLoading: __props.sessionListLoadMoreLoading
|
|
149
|
+
}, {
|
|
150
|
+
groupTitle: withCtx(({ group }) => [
|
|
151
|
+
createElementVNode("div", _hoisted_2, toDisplayString(getGroupTitle(group.title)), 1)
|
|
152
|
+
]),
|
|
153
|
+
label: withCtx(({ item }) => [
|
|
154
|
+
createVNode(unref(ElText), {
|
|
155
|
+
class: "session-title",
|
|
156
|
+
truncated: ""
|
|
157
|
+
}, {
|
|
158
|
+
default: withCtx(() => [
|
|
159
|
+
createTextVNode(toDisplayString(item.label), 1)
|
|
160
|
+
]),
|
|
161
|
+
_: 2
|
|
162
|
+
}, 1024)
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
}, 8, ["active", "items", "loadMoreLoading"])) : (openBlock(), createElementBlock("div", _hoisted_3, "暂无会话记录"))
|
|
166
|
+
], 4)
|
|
167
|
+
], 2)
|
|
168
|
+
], 2);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
export {
|
|
173
|
+
_sfc_main as default
|
|
174
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./AiOperationBtns.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const AiOperationBtns = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-df489747"]]);
|
|
5
|
+
export {
|
|
6
|
+
AiOperationBtns as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createCommentVNode, Fragment, renderList, createBlock, unref, withCtx, createVNode, mergeProps, createTextVNode, toDisplayString, resolveDynamicComponent } from "vue";
|
|
2
|
+
import { ElTooltip, ElButton, ElIcon } from "element-plus";
|
|
3
|
+
import { Close, Menu, Plus } from "@element-plus/icons-vue";
|
|
4
|
+
const _hoisted_1 = { class: "ai-operation-btns" };
|
|
5
|
+
const _hoisted_2 = ["src"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "AiOperationBtns",
|
|
8
|
+
props: {
|
|
9
|
+
onClose: { type: Function },
|
|
10
|
+
tooltipPlacement: {},
|
|
11
|
+
isCollapsed: { type: Boolean },
|
|
12
|
+
logoUrl: {}
|
|
13
|
+
},
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
useCssVars((_ctx) => ({
|
|
16
|
+
"v6532bfde": logoPosition.value
|
|
17
|
+
}));
|
|
18
|
+
const props = __props;
|
|
19
|
+
const emits = __emit;
|
|
20
|
+
const isCollapsed = computed(() => props.isCollapsed);
|
|
21
|
+
const btnProps = computed(() => {
|
|
22
|
+
return isCollapsed.value ? {
|
|
23
|
+
circle: true
|
|
24
|
+
} : {
|
|
25
|
+
block: true,
|
|
26
|
+
round: true
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const closeBtnConfig = computed(() => {
|
|
30
|
+
const props2 = {
|
|
31
|
+
circle: true
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
key: "close",
|
|
35
|
+
text: `关闭`,
|
|
36
|
+
showText: false,
|
|
37
|
+
props: props2,
|
|
38
|
+
Icon: Close
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const showCloseToggle = computed(() => !!props.onClose);
|
|
42
|
+
const configList = computed(() => {
|
|
43
|
+
const isHide = isCollapsed.value;
|
|
44
|
+
return [
|
|
45
|
+
...showCloseToggle.value ? [closeBtnConfig.value] : [],
|
|
46
|
+
{
|
|
47
|
+
key: "toggle-collapsed",
|
|
48
|
+
text: `${isHide ? "展开" : "收起"}会话记录`,
|
|
49
|
+
showText: !isHide,
|
|
50
|
+
props: btnProps.value,
|
|
51
|
+
Icon: Menu
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "create-session",
|
|
55
|
+
text: "创建新对话",
|
|
56
|
+
showText: !isHide,
|
|
57
|
+
props: btnProps.value,
|
|
58
|
+
Icon: Plus
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
});
|
|
62
|
+
const logoPosition = computed(() => {
|
|
63
|
+
return showCloseToggle.value ? "absolute" : "static";
|
|
64
|
+
});
|
|
65
|
+
const showLogo = computed(() => {
|
|
66
|
+
return showCloseToggle.value ? !isCollapsed.value : true;
|
|
67
|
+
});
|
|
68
|
+
const handleClick = (key) => {
|
|
69
|
+
var _a;
|
|
70
|
+
switch (key) {
|
|
71
|
+
case "close": {
|
|
72
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
default: {
|
|
76
|
+
emits(key);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return (_ctx, _cache) => {
|
|
81
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
82
|
+
createElementVNode("div", {
|
|
83
|
+
class: normalizeClass(["ai-operation-btns-logo", {
|
|
84
|
+
[`ai-operation-btns-logo_collapsed_${showLogo.value ? "show" : "hide"}`]: isCollapsed.value
|
|
85
|
+
}])
|
|
86
|
+
}, [
|
|
87
|
+
renderSlot(_ctx.$slots, "logo", {
|
|
88
|
+
size: "34px",
|
|
89
|
+
mode: "ai"
|
|
90
|
+
}, () => [
|
|
91
|
+
__props.logoUrl ? (openBlock(), createElementBlock("img", {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: "ai-operation-btns-logo-img",
|
|
94
|
+
src: __props.logoUrl,
|
|
95
|
+
alt: "logo"
|
|
96
|
+
}, null, 8, _hoisted_2)) : createCommentVNode("", true)
|
|
97
|
+
], true)
|
|
98
|
+
], 2),
|
|
99
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(configList.value, (item, index) => {
|
|
100
|
+
return openBlock(), createBlock(unref(ElTooltip), {
|
|
101
|
+
key: index,
|
|
102
|
+
"hide-after": 0,
|
|
103
|
+
disabled: item.showText,
|
|
104
|
+
placement: __props.tooltipPlacement
|
|
105
|
+
}, {
|
|
106
|
+
content: withCtx(() => [
|
|
107
|
+
createTextVNode(toDisplayString(item.text), 1)
|
|
108
|
+
]),
|
|
109
|
+
default: withCtx(() => [
|
|
110
|
+
createVNode(unref(ElButton), mergeProps({
|
|
111
|
+
class: { "ai-operation-btns-btn_block": item.props.block }
|
|
112
|
+
}, { ref_for: true }, item.props, {
|
|
113
|
+
onClick: ($event) => handleClick(item.key)
|
|
114
|
+
}), {
|
|
115
|
+
icon: withCtx(() => [
|
|
116
|
+
createVNode(unref(ElIcon), null, {
|
|
117
|
+
default: withCtx(() => [
|
|
118
|
+
(openBlock(), createBlock(resolveDynamicComponent(item.Icon)))
|
|
119
|
+
]),
|
|
120
|
+
_: 2
|
|
121
|
+
}, 1024)
|
|
122
|
+
]),
|
|
123
|
+
default: withCtx(() => [
|
|
124
|
+
item.showText ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
125
|
+
createTextVNode(toDisplayString(item.text), 1)
|
|
126
|
+
], 64)) : createCommentVNode("", true)
|
|
127
|
+
]),
|
|
128
|
+
_: 2
|
|
129
|
+
}, 1040, ["class", "onClick"])
|
|
130
|
+
]),
|
|
131
|
+
_: 2
|
|
132
|
+
}, 1032, ["disabled", "placement"]);
|
|
133
|
+
}), 128))
|
|
134
|
+
]);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
_sfc_main as default
|
|
140
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./AiSender.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const AiSender = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-52cfb136"]]);
|
|
5
|
+
export {
|
|
6
|
+
AiSender as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, useModel, openBlock, createBlock, unref, createSlots, withCtx, renderSlot, mergeModels } from "vue";
|
|
2
|
+
import { Sender } from "vue-element-plus-x";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "AiSender",
|
|
5
|
+
props: /* @__PURE__ */ mergeModels({
|
|
6
|
+
placeholder: { default: "" },
|
|
7
|
+
loading: { type: Boolean },
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
readOnly: { type: Boolean },
|
|
10
|
+
clearable: { type: Boolean },
|
|
11
|
+
submitBtnDisabled: { type: Boolean },
|
|
12
|
+
submitType: { default: "enter" },
|
|
13
|
+
variant: { default: "updown" },
|
|
14
|
+
autoSize: {}
|
|
15
|
+
}, {
|
|
16
|
+
"modelValue": { default: "" },
|
|
17
|
+
"modelModifiers": {}
|
|
18
|
+
}),
|
|
19
|
+
emits: /* @__PURE__ */ mergeModels(["submit", "cancel"], ["update:modelValue"]),
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const emit = __emit;
|
|
22
|
+
const model = useModel(__props, "modelValue");
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createBlock(unref(Sender), {
|
|
25
|
+
modelValue: model.value,
|
|
26
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
27
|
+
class: "ai-sender",
|
|
28
|
+
placeholder: __props.placeholder,
|
|
29
|
+
loading: __props.loading,
|
|
30
|
+
disabled: __props.disabled,
|
|
31
|
+
"read-only": __props.readOnly,
|
|
32
|
+
clearable: __props.clearable,
|
|
33
|
+
"submit-btn-disabled": __props.submitBtnDisabled,
|
|
34
|
+
"submit-type": __props.submitType,
|
|
35
|
+
variant: __props.variant,
|
|
36
|
+
"auto-size": __props.autoSize,
|
|
37
|
+
onSubmit: _cache[1] || (_cache[1] = (value) => emit("submit", value)),
|
|
38
|
+
onCancel: _cache[2] || (_cache[2] = (value) => emit("cancel", value))
|
|
39
|
+
}, createSlots({ _: 2 }, [
|
|
40
|
+
_ctx.$slots.header ? {
|
|
41
|
+
name: "header",
|
|
42
|
+
fn: withCtx(() => [
|
|
43
|
+
renderSlot(_ctx.$slots, "header", {}, void 0, true)
|
|
44
|
+
]),
|
|
45
|
+
key: "0"
|
|
46
|
+
} : void 0,
|
|
47
|
+
_ctx.$slots.prefix ? {
|
|
48
|
+
name: "prefix",
|
|
49
|
+
fn: withCtx(() => [
|
|
50
|
+
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
|
|
51
|
+
]),
|
|
52
|
+
key: "1"
|
|
53
|
+
} : void 0,
|
|
54
|
+
_ctx.$slots["action-list"] ? {
|
|
55
|
+
name: "action-list",
|
|
56
|
+
fn: withCtx(() => [
|
|
57
|
+
renderSlot(_ctx.$slots, "action-list", {}, void 0, true)
|
|
58
|
+
]),
|
|
59
|
+
key: "2"
|
|
60
|
+
} : void 0,
|
|
61
|
+
_ctx.$slots.footer ? {
|
|
62
|
+
name: "footer",
|
|
63
|
+
fn: withCtx(() => [
|
|
64
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
65
|
+
]),
|
|
66
|
+
key: "3"
|
|
67
|
+
} : void 0
|
|
68
|
+
]), 1032, ["modelValue", "placeholder", "loading", "disabled", "read-only", "clearable", "submit-btn-disabled", "submit-type", "variant", "auto-size"]);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
_sfc_main as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./AiSenderHeader.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const AiSenderHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a929e102"]]);
|
|
5
|
+
export {
|
|
6
|
+
AiSenderHeader as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, renderSlot, normalizeStyle, createCommentVNode, toDisplayString, Fragment, renderList, createBlock, unref, withCtx } from "vue";
|
|
2
|
+
import { ElTooltip } from "element-plus";
|
|
3
|
+
import { useAiSessionInject } from "../../hooks/expose.mjs";
|
|
4
|
+
const _hoisted_1 = { class: "ai-sender-header" };
|
|
5
|
+
const _hoisted_2 = { class: "ai-sender-header-welcome" };
|
|
6
|
+
const _hoisted_3 = ["src"];
|
|
7
|
+
const _hoisted_4 = { class: "ai-sender-header-greeting" };
|
|
8
|
+
const _hoisted_5 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "ai-sender-header-prompts"
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_6 = ["onClick"];
|
|
13
|
+
const _hoisted_7 = { class: "ai-sender-header-prompt-text" };
|
|
14
|
+
const logoSize = "25px";
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
__name: "AiSenderHeader",
|
|
17
|
+
props: {
|
|
18
|
+
greeting: {},
|
|
19
|
+
swiftAsk: {},
|
|
20
|
+
logoUrl: {}
|
|
21
|
+
},
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const { sessionExpose } = useAiSessionInject();
|
|
25
|
+
const swiftAsk = computed(() => props.swiftAsk || []);
|
|
26
|
+
const hasSwiftAsk = computed(() => swiftAsk.value.length > 0);
|
|
27
|
+
const greetingText = computed(
|
|
28
|
+
() => props.greeting ?? (hasSwiftAsk.value ? "你可以这么问:" : "今天有什么可以帮到你?")
|
|
29
|
+
);
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
32
|
+
createElementVNode("div", _hoisted_2, [
|
|
33
|
+
renderSlot(_ctx.$slots, "logo", {
|
|
34
|
+
size: logoSize,
|
|
35
|
+
mode: "ai"
|
|
36
|
+
}, () => [
|
|
37
|
+
__props.logoUrl ? (openBlock(), createElementBlock("img", {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "ai-sender-header-logo ai-sender-header-logo-img",
|
|
40
|
+
src: __props.logoUrl,
|
|
41
|
+
alt: "logo",
|
|
42
|
+
style: normalizeStyle({ width: logoSize, height: logoSize })
|
|
43
|
+
}, null, 12, _hoisted_3)) : createCommentVNode("", true)
|
|
44
|
+
], true),
|
|
45
|
+
createElementVNode("span", _hoisted_4, toDisplayString(greetingText.value), 1)
|
|
46
|
+
]),
|
|
47
|
+
hasSwiftAsk.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
48
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(swiftAsk.value, (askText, index) => {
|
|
49
|
+
return openBlock(), createBlock(unref(ElTooltip), {
|
|
50
|
+
key: index,
|
|
51
|
+
"hide-after": 0,
|
|
52
|
+
"show-after": 0,
|
|
53
|
+
teleported: false,
|
|
54
|
+
content: askText
|
|
55
|
+
}, {
|
|
56
|
+
default: withCtx(() => [
|
|
57
|
+
createElementVNode("button", {
|
|
58
|
+
class: "ai-sender-header-prompt",
|
|
59
|
+
type: "button",
|
|
60
|
+
onClick: ($event) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return (_b = (_a = unref(sessionExpose)) == null ? void 0 : _a.ask) == null ? void 0 : _b.call(_a, { value: askText });
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
createElementVNode("span", _hoisted_7, toDisplayString(askText), 1)
|
|
66
|
+
], 8, _hoisted_6)
|
|
67
|
+
]),
|
|
68
|
+
_: 2
|
|
69
|
+
}, 1032, ["content"]);
|
|
70
|
+
}), 128))
|
|
71
|
+
])) : createCommentVNode("", true)
|
|
72
|
+
]);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
_sfc_main as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { computed, createVNode } from "vue";
|
|
2
|
+
import AiCodeHeaderControl from "../components/bubble/AiCodeHeaderControl.vue.mjs";
|
|
3
|
+
const useCodeXSlot = () => {
|
|
4
|
+
const codeXSlot = computed(() => {
|
|
5
|
+
return {
|
|
6
|
+
// 右侧控制条:复制 + 折叠/展开(§3.3)。左侧语言标签走库默认头部
|
|
7
|
+
codeHeaderControl(props) {
|
|
8
|
+
return createVNode(AiCodeHeaderControl, {
|
|
9
|
+
"codeBlock": props
|
|
10
|
+
}, null);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
codeXSlot
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
useCodeXSlot
|
|
20
|
+
};
|