@aheart-ui/ai 0.0.0-stage → 1.1.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 +30 -2
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +5 -0
- package/es/actions/style.css +36 -0
- package/es/actions.vue.d.ts +34 -0
- package/es/actions.vue.js +27 -0
- package/es/actions.vue2.js +4 -0
- package/es/agent/index.d.ts +5 -0
- package/es/agent/index.js +12 -0
- package/es/agent/style.css +308 -0
- package/es/agent-execution.vue.d.ts +106 -0
- package/es/agent-execution.vue.js +441 -0
- package/es/agent-execution.vue2.js +4 -0
- package/es/agent-workbench/index.d.ts +2 -0
- package/es/agent-workbench/index.js +5 -0
- package/es/agent-workbench/style.css +1332 -0
- package/es/agent-workbench.vue.d.ts +186 -0
- package/es/agent-workbench.vue.js +537 -0
- package/es/agent-workbench.vue2.js +4 -0
- package/es/attachments/index.d.ts +2 -0
- package/es/attachments/index.js +5 -0
- package/es/attachments/style.css +62 -0
- package/es/attachments.vue.d.ts +39 -0
- package/es/attachments.vue.js +39 -0
- package/es/attachments.vue2.js +4 -0
- package/es/bubble/index.d.ts +2 -0
- package/es/bubble/index.js +5 -0
- package/es/bubble/style.css +241 -0
- package/es/bubble.vue.d.ts +27 -0
- package/es/bubble.vue.js +82 -0
- package/es/bubble.vue2.js +4 -0
- package/es/chat/index.d.ts +11 -0
- package/es/chat/index.js +23 -0
- package/es/chat/style.css +595 -0
- package/es/chat-panel/index.d.ts +3 -0
- package/es/chat-panel/index.js +8 -0
- package/es/chat-panel/style.css +595 -0
- package/es/chat-panel.vue.d.ts +108 -0
- package/es/chat-panel.vue.js +330 -0
- package/es/chat-panel.vue2.js +4 -0
- package/es/conversations/index.d.ts +2 -0
- package/es/conversations/index.js +5 -0
- package/es/conversations/style.css +48 -0
- package/es/conversations.vue.d.ts +39 -0
- package/es/conversations.vue.js +29 -0
- package/es/conversations.vue2.js +4 -0
- package/es/form/index.d.ts +3 -0
- package/es/form/index.js +9 -0
- package/es/form/style.css +242 -0
- package/es/form-field.vue.d.ts +28 -0
- package/es/form-field.vue.js +176 -0
- package/es/form-field.vue2.js +4 -0
- package/es/form-schema.d.ts +73 -0
- package/es/form-schema.js +105 -0
- package/es/form.vue.d.ts +81 -0
- package/es/form.vue.js +376 -0
- package/es/form.vue2.js +4 -0
- package/es/index.d.ts +20 -0
- package/es/index.js +42 -0
- package/es/package.json +3 -0
- package/es/process/index.d.ts +2 -0
- package/es/process/index.js +5 -0
- package/es/process/style.css +77 -0
- package/es/process.vue.d.ts +30 -0
- package/es/process.vue.js +29 -0
- package/es/process.vue2.js +4 -0
- package/es/prompts/index.d.ts +2 -0
- package/es/prompts/index.js +5 -0
- package/es/prompts/style.css +76 -0
- package/es/prompts.vue.d.ts +39 -0
- package/es/prompts.vue.js +33 -0
- package/es/prompts.vue2.js +4 -0
- package/es/safe-markdown.d.ts +3 -0
- package/es/safe-markdown.js +23 -0
- package/es/sender/index.d.ts +2 -0
- package/es/sender/index.js +5 -0
- package/es/sender/style.css +88 -0
- package/es/sender.vue.d.ts +52 -0
- package/es/sender.vue.js +46 -0
- package/es/sender.vue2.js +4 -0
- package/es/sources/index.d.ts +2 -0
- package/es/sources/index.js +5 -0
- package/es/sources/style.css +54 -0
- package/es/sources.vue.d.ts +30 -0
- package/es/sources.vue.js +34 -0
- package/es/sources.vue2.js +4 -0
- package/es/stream-reducer.d.ts +35 -0
- package/es/stream-reducer.js +85 -0
- package/es/style.css +1586 -0
- package/es/thought-chain/index.d.ts +2 -0
- package/es/thought-chain/index.js +5 -0
- package/es/thought-chain/style.css +77 -0
- package/es/thought-chain.vue.d.ts +30 -0
- package/es/thought-chain.vue.js +15 -0
- package/es/thought-chain.vue2.js +4 -0
- package/es/types.d.ts +203 -0
- package/es/welcome/index.d.ts +2 -0
- package/es/welcome/index.js +5 -0
- package/es/welcome/style.css +33 -0
- package/es/welcome.vue.d.ts +41 -0
- package/es/welcome.vue.js +27 -0
- package/es/welcome.vue2.js +4 -0
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/style.css +36 -0
- package/lib/actions.vue.d.ts +34 -0
- package/lib/actions.vue.js +1 -0
- package/lib/actions.vue2.js +1 -0
- package/lib/agent/index.d.ts +5 -0
- package/lib/agent/index.js +1 -0
- package/lib/agent/style.css +308 -0
- package/lib/agent-execution.vue.d.ts +106 -0
- package/lib/agent-execution.vue.js +1 -0
- package/lib/agent-execution.vue2.js +1 -0
- package/lib/agent-workbench/index.d.ts +2 -0
- package/lib/agent-workbench/index.js +1 -0
- package/lib/agent-workbench/style.css +1332 -0
- package/lib/agent-workbench.vue.d.ts +186 -0
- package/lib/agent-workbench.vue.js +1 -0
- package/lib/agent-workbench.vue2.js +1 -0
- package/lib/attachments/index.d.ts +2 -0
- package/lib/attachments/index.js +1 -0
- package/lib/attachments/style.css +62 -0
- package/lib/attachments.vue.d.ts +39 -0
- package/lib/attachments.vue.js +1 -0
- package/lib/attachments.vue2.js +1 -0
- package/lib/bubble/index.d.ts +2 -0
- package/lib/bubble/index.js +1 -0
- package/lib/bubble/style.css +241 -0
- package/lib/bubble.vue.d.ts +27 -0
- package/lib/bubble.vue.js +1 -0
- package/lib/bubble.vue2.js +1 -0
- package/lib/chat/index.d.ts +11 -0
- package/lib/chat/index.js +1 -0
- package/lib/chat/style.css +595 -0
- package/lib/chat-panel/index.d.ts +3 -0
- package/lib/chat-panel/index.js +1 -0
- package/lib/chat-panel/style.css +595 -0
- package/lib/chat-panel.vue.d.ts +108 -0
- package/lib/chat-panel.vue.js +1 -0
- package/lib/chat-panel.vue2.js +1 -0
- package/lib/conversations/index.d.ts +2 -0
- package/lib/conversations/index.js +1 -0
- package/lib/conversations/style.css +48 -0
- package/lib/conversations.vue.d.ts +39 -0
- package/lib/conversations.vue.js +1 -0
- package/lib/conversations.vue2.js +1 -0
- package/lib/form/index.d.ts +3 -0
- package/lib/form/index.js +1 -0
- package/lib/form/style.css +242 -0
- package/lib/form-field.vue.d.ts +28 -0
- package/lib/form-field.vue.js +1 -0
- package/lib/form-field.vue2.js +1 -0
- package/lib/form-schema.d.ts +73 -0
- package/lib/form-schema.js +1 -0
- package/lib/form.vue.d.ts +81 -0
- package/lib/form.vue.js +1 -0
- package/lib/form.vue2.js +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +1 -0
- package/lib/package.json +3 -0
- package/lib/process/index.d.ts +2 -0
- package/lib/process/index.js +1 -0
- package/lib/process/style.css +77 -0
- package/lib/process.vue.d.ts +30 -0
- package/lib/process.vue.js +1 -0
- package/lib/process.vue2.js +1 -0
- package/lib/prompts/index.d.ts +2 -0
- package/lib/prompts/index.js +1 -0
- package/lib/prompts/style.css +76 -0
- package/lib/prompts.vue.d.ts +39 -0
- package/lib/prompts.vue.js +1 -0
- package/lib/prompts.vue2.js +1 -0
- package/lib/safe-markdown.d.ts +3 -0
- package/lib/safe-markdown.js +2 -0
- package/lib/sender/index.d.ts +2 -0
- package/lib/sender/index.js +1 -0
- package/lib/sender/style.css +88 -0
- package/lib/sender.vue.d.ts +52 -0
- package/lib/sender.vue.js +1 -0
- package/lib/sender.vue2.js +1 -0
- package/lib/sources/index.d.ts +2 -0
- package/lib/sources/index.js +1 -0
- package/lib/sources/style.css +54 -0
- package/lib/sources.vue.d.ts +30 -0
- package/lib/sources.vue.js +1 -0
- package/lib/sources.vue2.js +1 -0
- package/lib/stream-reducer.d.ts +35 -0
- package/lib/stream-reducer.js +1 -0
- package/lib/style.css +1586 -0
- package/lib/thought-chain/index.d.ts +2 -0
- package/lib/thought-chain/index.js +1 -0
- package/lib/thought-chain/style.css +77 -0
- package/lib/thought-chain.vue.d.ts +30 -0
- package/lib/thought-chain.vue.js +1 -0
- package/lib/thought-chain.vue2.js +1 -0
- package/lib/types.d.ts +203 -0
- package/lib/welcome/index.d.ts +2 -0
- package/lib/welcome/index.js +1 -0
- package/lib/welcome/style.css +33 -0
- package/lib/welcome.vue.d.ts +41 -0
- package/lib/welcome.vue.js +1 -0
- package/lib/welcome.vue2.js +1 -0
- package/package.json +172 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineComponent as i, openBlock as t, createElementBlock as s, createElementVNode as l, Fragment as c, renderList as u, normalizeClass as m, toDisplayString as r, createCommentVNode as o } from "vue";
|
|
2
|
+
const d = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "aheart-ai-process",
|
|
5
|
+
"aria-label": "执行进度"
|
|
6
|
+
}, p = { key: 0 }, k = /* @__PURE__ */ i({
|
|
7
|
+
name: "AAIProcess",
|
|
8
|
+
__name: "process",
|
|
9
|
+
props: {
|
|
10
|
+
items: { default: () => [] }
|
|
11
|
+
},
|
|
12
|
+
setup(n) {
|
|
13
|
+
return (_, a) => n.items.length ? (t(), s("section", d, [
|
|
14
|
+
a[0] || (a[0] = l("h3", null, "执行进度", -1)),
|
|
15
|
+
l("ol", null, [
|
|
16
|
+
(t(!0), s(c, null, u(n.items, (e) => (t(), s("li", {
|
|
17
|
+
key: e.id,
|
|
18
|
+
class: m(`is-${e.status}`)
|
|
19
|
+
}, [
|
|
20
|
+
l("span", null, r(e.label), 1),
|
|
21
|
+
e.detail ? (t(), s("small", p, r(e.detail), 1)) : o("", !0)
|
|
22
|
+
], 2))), 128))
|
|
23
|
+
])
|
|
24
|
+
])) : o("", !0);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
k as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--aheart-ai-cyan: #0e7490;
|
|
3
|
+
--aheart-ai-cyan-strong: #0e7490;
|
|
4
|
+
--aheart-ai-brand-strong: #0958d9;
|
|
5
|
+
--aheart-ai-cyan-soft: #ecfeff;
|
|
6
|
+
--aheart-ai-line: #e4e7ec;
|
|
7
|
+
--aheart-ai-surface: #ffffff;
|
|
8
|
+
--aheart-ai-surface-subtle: #f8fafc;
|
|
9
|
+
--aheart-ai-text: #182230;
|
|
10
|
+
--aheart-ai-text-secondary: #667085;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.aheart-ai-prompts {
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
16
|
+
gap: 8px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
list-style: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.aheart-ai-prompts li {
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
min-inline-size: 0;
|
|
26
|
+
list-style: none !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.aheart-ai-prompts li::marker {
|
|
30
|
+
content: "";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.aheart-ai-prompts button {
|
|
34
|
+
display: grid;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
min-block-size: 64px;
|
|
37
|
+
inline-size: 100%;
|
|
38
|
+
padding: 11px 12px;
|
|
39
|
+
border: 1px solid #d0d5dd;
|
|
40
|
+
border-radius: 6px;
|
|
41
|
+
background: rgba(255, 255, 255, 0.96);
|
|
42
|
+
color: var(--aheart-ai-text);
|
|
43
|
+
font: inherit;
|
|
44
|
+
text-align: left;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
transition: transform 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.aheart-ai-prompts button:hover,
|
|
50
|
+
.aheart-ai-prompts button:focus-visible {
|
|
51
|
+
transform: translateY(-2px);
|
|
52
|
+
border-color: #69b1ff;
|
|
53
|
+
background: #f0f7ff;
|
|
54
|
+
outline: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.aheart-ai-prompts span {
|
|
58
|
+
display: block;
|
|
59
|
+
color: var(--aheart-ai-text-secondary);
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (max-width: 760px) {
|
|
64
|
+
|
|
65
|
+
.aheart-ai-prompts {
|
|
66
|
+
grid-template-columns: minmax(0, 1fr);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (prefers-reduced-motion: reduce) {
|
|
71
|
+
|
|
72
|
+
.aheart-ai-prompts button:hover,
|
|
73
|
+
.aheart-ai-prompts button:focus-visible {
|
|
74
|
+
transform: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AIPrompt } from './types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
prompts?: AIPrompt[] | undefined;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
5
|
+
}>, {
|
|
6
|
+
prompts: () => never[];
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
select: (prompt: AIPrompt) => void;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
prompts?: AIPrompt[] | undefined;
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
prompts: () => never[];
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}>>> & Readonly<{
|
|
17
|
+
onSelect?: ((prompt: AIPrompt) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
prompts: AIPrompt[];
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
24
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
25
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
26
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
27
|
+
} : {
|
|
28
|
+
type: import('vue').PropType<T[K]>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
type __VLS_WithDefaults<P, D> = {
|
|
33
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
34
|
+
default: D[K];
|
|
35
|
+
}> : P[K];
|
|
36
|
+
};
|
|
37
|
+
type __VLS_Prettify<T> = {
|
|
38
|
+
[K in keyof T]: T[K];
|
|
39
|
+
} & {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as r, openBlock as t, createElementBlock as n, Fragment as c, renderList as d, createElementVNode as o, toDisplayString as l, createCommentVNode as m } from "vue";
|
|
2
|
+
const u = {
|
|
3
|
+
class: "aheart-ai-prompts",
|
|
4
|
+
"aria-label": "建议任务"
|
|
5
|
+
}, p = ["disabled", "onClick"], _ = { key: 0 }, h = /* @__PURE__ */ r({
|
|
6
|
+
name: "AAIPrompts",
|
|
7
|
+
__name: "prompts",
|
|
8
|
+
props: {
|
|
9
|
+
prompts: { default: () => [] },
|
|
10
|
+
disabled: { type: Boolean, default: !1 }
|
|
11
|
+
},
|
|
12
|
+
emits: ["select"],
|
|
13
|
+
setup(s, { emit: a }) {
|
|
14
|
+
const i = a;
|
|
15
|
+
return (b, f) => (t(), n("ul", u, [
|
|
16
|
+
(t(!0), n(c, null, d(s.prompts, (e) => (t(), n("li", {
|
|
17
|
+
key: e.key
|
|
18
|
+
}, [
|
|
19
|
+
o("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
disabled: s.disabled,
|
|
22
|
+
onClick: (k) => i("select", e)
|
|
23
|
+
}, [
|
|
24
|
+
o("strong", null, l(e.label), 1),
|
|
25
|
+
e.description ? (t(), n("span", _, l(e.description), 1)) : m("", !0)
|
|
26
|
+
], 8, p)
|
|
27
|
+
]))), 128))
|
|
28
|
+
]));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
h as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { h as s } from "vue";
|
|
2
|
+
const l = (e) => e && /^(https?:|mailto:)/i.test(e) ? e : void 0, h = /(\*\*([^*]+)\*\*|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g, c = (e) => {
|
|
3
|
+
const r = [];
|
|
4
|
+
let n = 0;
|
|
5
|
+
for (const t of e.matchAll(h)) {
|
|
6
|
+
const o = t.index ?? 0;
|
|
7
|
+
if (o > n && r.push(e.slice(n, o)), t[2])
|
|
8
|
+
r.push(s("strong", t[2]));
|
|
9
|
+
else if (t[3])
|
|
10
|
+
r.push(s("em", t[3]));
|
|
11
|
+
else {
|
|
12
|
+
const i = l(t[5]);
|
|
13
|
+
r.push(i ? s("a", { href: i, target: "_blank", rel: "noreferrer" }, t[4]) : t[4]);
|
|
14
|
+
}
|
|
15
|
+
n = o + t[0].length;
|
|
16
|
+
}
|
|
17
|
+
return n < e.length && r.push(e.slice(n)), r;
|
|
18
|
+
}, p = (e) => e.split(`
|
|
19
|
+
`).flatMap((n, t) => t === 0 ? c(n) : [s("br"), ...c(n)]);
|
|
20
|
+
export {
|
|
21
|
+
l as getSafeUrl,
|
|
22
|
+
p as renderSafeMarkdown
|
|
23
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--aheart-ai-cyan: #0e7490;
|
|
3
|
+
--aheart-ai-cyan-strong: #0e7490;
|
|
4
|
+
--aheart-ai-brand-strong: #0958d9;
|
|
5
|
+
--aheart-ai-cyan-soft: #ecfeff;
|
|
6
|
+
--aheart-ai-line: #e4e7ec;
|
|
7
|
+
--aheart-ai-surface: #ffffff;
|
|
8
|
+
--aheart-ai-surface-subtle: #f8fafc;
|
|
9
|
+
--aheart-ai-text: #182230;
|
|
10
|
+
--aheart-ai-text-secondary: #667085;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.aheart-ai-sender {
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
16
|
+
align-items: end;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
padding: 6px;
|
|
19
|
+
border: 1px solid #b9c2cf;
|
|
20
|
+
border-radius: 7px;
|
|
21
|
+
background: #fff;
|
|
22
|
+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
|
|
23
|
+
transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.aheart-ai-sender:focus-within {
|
|
27
|
+
border-color: var(--aheart-color-primary, #1677ff);
|
|
28
|
+
box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.aheart-ai-sender textarea {
|
|
32
|
+
inline-size: 100%;
|
|
33
|
+
min-block-size: 56px;
|
|
34
|
+
max-block-size: 160px;
|
|
35
|
+
resize: vertical;
|
|
36
|
+
padding: 8px;
|
|
37
|
+
border: 0;
|
|
38
|
+
background: transparent;
|
|
39
|
+
color: var(--aheart-ai-text);
|
|
40
|
+
font: inherit;
|
|
41
|
+
line-height: 1.55;
|
|
42
|
+
outline: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.aheart-ai-sender button {
|
|
46
|
+
min-inline-size: 72px;
|
|
47
|
+
min-block-size: 36px;
|
|
48
|
+
padding: 7px 14px;
|
|
49
|
+
border: 1px solid var(--aheart-color-primary, #1677ff);
|
|
50
|
+
border-radius: 5px;
|
|
51
|
+
background: var(--aheart-color-primary, #1677ff);
|
|
52
|
+
color: #fff;
|
|
53
|
+
font: 500 14px/1 inherit;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition: background-color 120ms ease-out, border-color 120ms ease-out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.aheart-ai-sender button:hover:not(:disabled),
|
|
59
|
+
.aheart-ai-sender button:focus-visible {
|
|
60
|
+
border-color: #0958d9;
|
|
61
|
+
background: #0958d9;
|
|
62
|
+
outline: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.aheart-ai-sender button:disabled {
|
|
66
|
+
border-color: #d0d5dd;
|
|
67
|
+
background: #eaecf0;
|
|
68
|
+
color: #98a2b3;
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media (max-width: 760px) {
|
|
73
|
+
|
|
74
|
+
.aheart-ai-sender {
|
|
75
|
+
grid-template-columns: minmax(0, 1fr);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.aheart-ai-sender button {
|
|
79
|
+
inline-size: 100%;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (pointer: coarse) {
|
|
84
|
+
.aheart-ai-sender button {
|
|
85
|
+
min-block-size: 44px;
|
|
86
|
+
min-inline-size: 44px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
modelValue?: string | undefined;
|
|
3
|
+
placeholder?: string | undefined;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
5
|
+
loading?: boolean | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
modelValue: string;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
submit: (content: string) => void;
|
|
13
|
+
stop: () => void;
|
|
14
|
+
"update:modelValue": (value: string) => void;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
16
|
+
modelValue?: string | undefined;
|
|
17
|
+
placeholder?: string | undefined;
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
loading?: boolean | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
modelValue: string;
|
|
22
|
+
placeholder: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
}>>> & Readonly<{
|
|
26
|
+
onSubmit?: ((content: string) => any) | undefined;
|
|
27
|
+
onStop?: (() => any) | undefined;
|
|
28
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
loading: boolean;
|
|
32
|
+
placeholder: string;
|
|
33
|
+
modelValue: string;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
export default _default;
|
|
36
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
37
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
38
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
39
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
40
|
+
} : {
|
|
41
|
+
type: import('vue').PropType<T[K]>;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
type __VLS_WithDefaults<P, D> = {
|
|
46
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
47
|
+
default: D[K];
|
|
48
|
+
}> : P[K];
|
|
49
|
+
};
|
|
50
|
+
type __VLS_Prettify<T> = {
|
|
51
|
+
[K in keyof T]: T[K];
|
|
52
|
+
} & {};
|
package/es/sender.vue.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineComponent as r, openBlock as o, createElementBlock as i, withModifiers as s, createElementVNode as b, withKeys as c } from "vue";
|
|
2
|
+
const f = ["value", "placeholder", "disabled", "onKeydown"], p = ["disabled"], v = /* @__PURE__ */ r({
|
|
3
|
+
name: "AAISender",
|
|
4
|
+
__name: "sender",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: { default: "" },
|
|
7
|
+
placeholder: { default: "输入消息" },
|
|
8
|
+
disabled: { type: Boolean, default: !1 },
|
|
9
|
+
loading: { type: Boolean, default: !1 }
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:modelValue", "submit", "stop"],
|
|
12
|
+
setup(e, { emit: m }) {
|
|
13
|
+
const l = e, a = m, d = () => {
|
|
14
|
+
const n = l.modelValue.trim();
|
|
15
|
+
n && !l.disabled && !l.loading && a("submit", n);
|
|
16
|
+
};
|
|
17
|
+
return (n, t) => (o(), i("form", {
|
|
18
|
+
class: "aheart-ai-sender",
|
|
19
|
+
onSubmit: s(d, ["prevent"])
|
|
20
|
+
}, [
|
|
21
|
+
b("textarea", {
|
|
22
|
+
value: e.modelValue,
|
|
23
|
+
"aria-label": "消息内容",
|
|
24
|
+
placeholder: e.placeholder,
|
|
25
|
+
disabled: e.disabled || e.loading,
|
|
26
|
+
onInput: t[0] || (t[0] = (u) => a("update:modelValue", u.target.value)),
|
|
27
|
+
onKeydown: c(s(d, ["exact", "prevent"]), ["enter"])
|
|
28
|
+
}, null, 40, f),
|
|
29
|
+
e.loading ? (o(), i("button", {
|
|
30
|
+
key: 0,
|
|
31
|
+
type: "button",
|
|
32
|
+
"aria-label": "停止生成",
|
|
33
|
+
onClick: t[1] || (t[1] = (u) => a("stop"))
|
|
34
|
+
}, "停止")) : (o(), i("button", {
|
|
35
|
+
key: 1,
|
|
36
|
+
type: "submit",
|
|
37
|
+
"aria-label": "发送消息",
|
|
38
|
+
disabled: e.disabled || !e.modelValue.trim(),
|
|
39
|
+
onClick: s(d, ["prevent"])
|
|
40
|
+
}, "发送", 8, p))
|
|
41
|
+
], 32));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
v as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--aheart-ai-cyan: #0e7490;
|
|
3
|
+
--aheart-ai-cyan-strong: #0e7490;
|
|
4
|
+
--aheart-ai-brand-strong: #0958d9;
|
|
5
|
+
--aheart-ai-cyan-soft: #ecfeff;
|
|
6
|
+
--aheart-ai-line: #e4e7ec;
|
|
7
|
+
--aheart-ai-surface: #ffffff;
|
|
8
|
+
--aheart-ai-surface-subtle: #f8fafc;
|
|
9
|
+
--aheart-ai-text: #182230;
|
|
10
|
+
--aheart-ai-text-secondary: #667085;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.aheart-ai-sources h3,
|
|
14
|
+
.aheart-ai-sources p {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.aheart-ai-sources {
|
|
19
|
+
display: grid;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.aheart-ai-sources ul {
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
list-style: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.aheart-ai-sources li {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
min-block-size: 34px;
|
|
35
|
+
padding: 6px 8px;
|
|
36
|
+
border: 1px solid var(--aheart-ai-line);
|
|
37
|
+
border-radius: 5px;
|
|
38
|
+
background: var(--aheart-ai-surface-subtle);
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.aheart-ai-sources {
|
|
43
|
+
padding-block-start: 8px;
|
|
44
|
+
border-block-start: 1px solid var(--aheart-ai-line);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.aheart-ai-sources a {
|
|
48
|
+
color: var(--aheart-ai-brand-strong);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.aheart-ai-sources h3 {
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
color: var(--aheart-ai-text-secondary);
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AISource } from './types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
sources?: AISource[] | undefined;
|
|
4
|
+
}>, {
|
|
5
|
+
sources: () => never[];
|
|
6
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
sources?: AISource[] | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
sources: () => never[];
|
|
10
|
+
}>>> & Readonly<{}>, {
|
|
11
|
+
sources: AISource[];
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type __VLS_WithDefaults<P, D> = {
|
|
24
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
25
|
+
default: D[K];
|
|
26
|
+
}> : P[K];
|
|
27
|
+
};
|
|
28
|
+
type __VLS_Prettify<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent as c, openBlock as t, createElementBlock as r, createElementVNode as s, Fragment as d, renderList as m, unref as a, toDisplayString as n, createCommentVNode as i } from "vue";
|
|
2
|
+
import { getSafeUrl as u } from "./safe-markdown.js";
|
|
3
|
+
const f = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "aheart-ai-sources",
|
|
6
|
+
"aria-label": "参考来源"
|
|
7
|
+
}, p = ["href"], _ = { key: 1 }, h = { key: 2 }, S = /* @__PURE__ */ c({
|
|
8
|
+
name: "AAISources",
|
|
9
|
+
__name: "sources",
|
|
10
|
+
props: {
|
|
11
|
+
sources: { default: () => [] }
|
|
12
|
+
},
|
|
13
|
+
setup(o) {
|
|
14
|
+
return (k, l) => o.sources.length ? (t(), r("section", f, [
|
|
15
|
+
l[0] || (l[0] = s("h3", null, "参考来源", -1)),
|
|
16
|
+
s("ul", null, [
|
|
17
|
+
(t(!0), r(d, null, m(o.sources, (e) => (t(), r("li", {
|
|
18
|
+
key: e.id
|
|
19
|
+
}, [
|
|
20
|
+
a(u)(e.url) ? (t(), r("a", {
|
|
21
|
+
key: 0,
|
|
22
|
+
href: a(u)(e.url),
|
|
23
|
+
target: "_blank",
|
|
24
|
+
rel: "noreferrer"
|
|
25
|
+
}, n(e.title), 9, p)) : (t(), r("span", _, n(e.title), 1)),
|
|
26
|
+
e.description ? (t(), r("p", h, n(e.description), 1)) : i("", !0)
|
|
27
|
+
]))), 128))
|
|
28
|
+
])
|
|
29
|
+
])) : i("", !0);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
S as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AIMessage, AIStreamEventV2 } from './types';
|
|
2
|
+
export type AIStreamDiagnosticKind = 'accepted' | 'duplicate' | 'buffered' | 'stale' | 'gap' | 'protocol-error' | 'terminal-no-op';
|
|
3
|
+
export interface AIStreamReducerState {
|
|
4
|
+
requestId: string;
|
|
5
|
+
messageId: string;
|
|
6
|
+
cursor: {
|
|
7
|
+
afterSequence: number;
|
|
8
|
+
revision: number;
|
|
9
|
+
};
|
|
10
|
+
message: AIMessage;
|
|
11
|
+
status: 'idle' | 'streaming' | 'reconnecting' | 'completed' | 'cancelled' | 'error';
|
|
12
|
+
recoveryRequired: boolean;
|
|
13
|
+
diagnostic: {
|
|
14
|
+
kind: AIStreamDiagnosticKind;
|
|
15
|
+
sequence?: number;
|
|
16
|
+
reason?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface AIStreamReducerOptions {
|
|
20
|
+
requestId: string;
|
|
21
|
+
messageId: string;
|
|
22
|
+
maxReconnectAttempts?: number;
|
|
23
|
+
initialMessage?: AIMessage;
|
|
24
|
+
}
|
|
25
|
+
export interface AIStreamReducer {
|
|
26
|
+
dispatch(event: AIStreamEventV2): AIStreamReducerState;
|
|
27
|
+
reduce(event: AIStreamEventV2): AIStreamReducerState;
|
|
28
|
+
recover(options?: {
|
|
29
|
+
reason?: string;
|
|
30
|
+
}): AIStreamReducerState;
|
|
31
|
+
failRecovery(reason?: string, retryable?: boolean): AIStreamReducerState;
|
|
32
|
+
getState(): AIStreamReducerState;
|
|
33
|
+
}
|
|
34
|
+
export declare const createAIStreamReducer: (options: AIStreamReducerOptions) => AIStreamReducer;
|
|
35
|
+
export declare const reduceAIStreamEvent: (state: AIStreamReducer, event: AIStreamEventV2) => AIStreamReducerState;
|