@veltra/ai 2.3.0 → 2.3.2
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/chat/fold.d.ts +0 -2
- package/dist/chat/fold.js +1 -2
- package/dist/chat/session.d.ts +0 -2
- package/dist/chat/session.js +1 -2
- package/dist/chat/transports/openai.d.ts +0 -2
- package/dist/chat/transports/openai.js +1 -2
- package/dist/chat/types.d.ts +0 -2
- package/dist/chat/use-chat-helpers.js +1 -2
- package/dist/chat/use-chat-session.js +1 -2
- package/dist/chat/use-chat.d.ts +0 -2
- package/dist/chat/use-chat.js +1 -2
- package/dist/components/ai-chat/ai-chat.js +1 -2
- package/dist/components/ai-chat/approval-banner.js +1 -2
- package/dist/components/ai-chat/ask-question.js +1 -2
- package/dist/components/ai-chat/chat-input.js +1 -2
- package/dist/components/ai-chat/di.js +1 -2
- package/dist/components/ai-chat/format-duration.js +1 -2
- package/dist/components/ai-chat/job-bar.js +1 -2
- package/dist/components/ai-chat/message-item.js +1 -2
- package/dist/components/ai-chat/message-list.js +1 -2
- package/dist/components/ai-chat/model-picker.js +1 -2
- package/dist/components/ai-chat/queue-list.js +1 -2
- package/dist/components/ai-chat/reasoning-picker.js +1 -2
- package/dist/components/ai-chat/side-panel.js +1 -2
- package/dist/components/ai-chat/style2.css +3 -3
- package/dist/components/ai-chat/tool-call.js +1 -2
- package/dist/components/ai-chat/tool-icons.js +1 -2
- package/dist/components/ai-chat/tool-json.js +1 -2
- package/dist/components/ai-chat/turn-process.js +1 -2
- package/dist/components/ai-orb/ai-orb.js +1 -2
- package/dist/components/ai-orb/orb-renderer.js +1 -2
- package/dist/providers/types.d.ts +0 -2
- package/dist/tools/ask-question/ask-question.d.ts +0 -2
- package/dist/tools/ask-question/ask-question.js +1 -2
- package/dist/tools/ask-question/deferred.js +1 -2
- package/dist/tools/index.js +1 -2
- package/dist/types/ai-chat.d.ts +0 -2
- package/package.json +2 -2
- package/src/components/ai-chat/style.scss +3 -3
package/dist/chat/fold.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ChatJob, ChatMessage, ChatQueuedMessage, ChatTokenUsage } from "./types
|
|
|
2
2
|
import { AskQuestionItem } from "../tools/ask-question/ask-question.js";
|
|
3
3
|
import "../tools/index.js";
|
|
4
4
|
import { ChatSessionEvent } from "./session.js";
|
|
5
|
-
//#region src/chat/fold.d.ts
|
|
6
5
|
export interface ChatPendingApproval {
|
|
7
6
|
approvalId: string;
|
|
8
7
|
toolName: string;
|
|
@@ -36,5 +35,4 @@ export declare function createFoldState(): ChatFoldState;
|
|
|
36
35
|
* 后到的更小/重复 seq 不覆盖已应用事件。
|
|
37
36
|
*/
|
|
38
37
|
export declare function foldSessionEvent(state: ChatFoldState, event: ChatSessionEvent): ChatFoldState;
|
|
39
|
-
//#endregion
|
|
40
38
|
//# sourceMappingURL=fold.d.ts.map
|
package/dist/chat/fold.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/chat/fold.ts
|
|
2
2
|
function eventSeq(event) {
|
|
3
3
|
return "seq" in event ? event.seq : void 0;
|
|
4
4
|
}
|
|
@@ -214,7 +214,6 @@ function foldSessionEvent(state, event) {
|
|
|
214
214
|
}
|
|
215
215
|
return next;
|
|
216
216
|
}
|
|
217
|
-
//#endregion
|
|
218
217
|
export { createFoldState, foldSessionEvent };
|
|
219
218
|
|
|
220
219
|
//# sourceMappingURL=fold.js.map
|
package/dist/chat/session.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChatAttachment, ChatJob, ChatQueuedMessage, ChatToolCall } from "./types.js";
|
|
2
2
|
import { AskQuestionItem } from "../tools/ask-question/ask-question.js";
|
|
3
3
|
import "../tools/index.js";
|
|
4
|
-
//#region src/chat/session.d.ts
|
|
5
4
|
/** 归一化后的服务端会话事件(协议无关)。
|
|
6
5
|
* seq 为持久帧序号:瞬态/历史回放事件省略(不参与乱序门),durable 终态事件携带。 */
|
|
7
6
|
export type ChatSessionEvent = {
|
|
@@ -125,5 +124,4 @@ export declare function isServerTransport(t: unknown): t is ChatSessionTransport
|
|
|
125
124
|
* 包内完成 seq 校验、disposer、断线补拉、动作 in-flight 去重。
|
|
126
125
|
*/
|
|
127
126
|
export declare function createServerTransport(adapter: ChatSessionAdapter): ChatSessionTransport;
|
|
128
|
-
//#endregion
|
|
129
127
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/chat/session.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/chat/session.ts
|
|
2
2
|
function eventSeq(event) {
|
|
3
3
|
return "seq" in event ? event.seq : void 0;
|
|
4
4
|
}
|
|
@@ -73,7 +73,6 @@ function createServerTransport(adapter) {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
export { createServerTransport, isServerTransport };
|
|
78
77
|
|
|
79
78
|
//# sourceMappingURL=session.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChatTransport } from "../types.js";
|
|
2
2
|
import { ChatModelOption, ChatProvider } from "../../providers/types.js";
|
|
3
|
-
//#region src/chat/transports/openai.d.ts
|
|
4
3
|
/** createOpenAITransport 的配置项(多 Provider) */
|
|
5
4
|
export interface OpenAITransportOptions {
|
|
6
5
|
/** 至少一个 Provider;模型 id 须跨 Provider 全局唯一 */
|
|
@@ -23,5 +22,4 @@ export type OpenAITransport = ChatTransport & {
|
|
|
23
22
|
* 请求体构造、fetch、SSE 解析与错误处理复用 `@veltra/utils` 通用层。
|
|
24
23
|
*/
|
|
25
24
|
export declare function createOpenAITransport(options: OpenAITransportOptions): OpenAITransport;
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildOpenAIBody, requestOpenAIStream } from "@veltra/utils";
|
|
2
|
-
|
|
2
|
+
// src/chat/transports/openai.ts
|
|
3
3
|
/** 校验 providers 并展开扁平模型列表 */
|
|
4
4
|
function flattenModels(providers) {
|
|
5
5
|
if (!providers.length) throw new Error("[createOpenAITransport] providers 不能为空");
|
|
@@ -65,7 +65,6 @@ function createOpenAITransport(options) {
|
|
|
65
65
|
defaultModel
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { createOpenAITransport };
|
|
70
69
|
|
|
71
70
|
//# sourceMappingURL=openai.js.map
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component } from "vue";
|
|
2
|
-
//#region src/chat/types.d.ts
|
|
3
2
|
/** 聊天附件(首版仅支持图片) */
|
|
4
3
|
export interface ChatAttachment {
|
|
5
4
|
/** 文件名 */
|
|
@@ -226,5 +225,4 @@ export interface ChatTransportHandlers {
|
|
|
226
225
|
* 可传入内置的 createOpenAITransport(),也可自行实现接入任意后端。
|
|
227
226
|
*/
|
|
228
227
|
export type ChatTransport = (request: ChatTransportRequest, handlers: ChatTransportHandlers) => Promise<void> | void;
|
|
229
|
-
//#endregion
|
|
230
228
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createBuiltinTools } from "../tools/index.js";
|
|
2
|
-
|
|
2
|
+
// src/chat/use-chat-helpers.ts
|
|
3
3
|
function serializeResult(result) {
|
|
4
4
|
if (typeof result === "string") return result;
|
|
5
5
|
try {
|
|
@@ -33,7 +33,6 @@ function addTokenUsage(a, b) {
|
|
|
33
33
|
if (cacheCreationTokens != null) usage.cacheCreationTokens = cacheCreationTokens;
|
|
34
34
|
return usage;
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { addTokenUsage, resolveTools, serializeResult };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=use-chat-helpers.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFoldState, foldSessionEvent } from "./fold.js";
|
|
2
|
-
|
|
2
|
+
// src/chat/use-chat-session.ts
|
|
3
3
|
/** 把 fold 状态同步到 useChat 的渲染面 */
|
|
4
4
|
function syncFold(fold, surface) {
|
|
5
5
|
surface.messages.value = fold.messages;
|
|
@@ -52,7 +52,6 @@ function createSessionRuntime(surface) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { createSessionRuntime };
|
|
57
56
|
|
|
58
57
|
//# sourceMappingURL=use-chat-session.js.map
|
package/dist/chat/use-chat.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { AiChatEmits, AiChatProps } from "../types/ai-chat.js";
|
|
|
5
5
|
import "../types/index.js";
|
|
6
6
|
import { ChatPendingApproval } from "./fold.js";
|
|
7
7
|
import { Ref } from "vue";
|
|
8
|
-
//#region src/chat/use-chat.d.ts
|
|
9
8
|
export interface UseChatOptions {
|
|
10
9
|
props: AiChatProps;
|
|
11
10
|
emit: AiChatEmits;
|
|
@@ -138,5 +137,4 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
138
137
|
startQueued: (id: string) => void;
|
|
139
138
|
removeQueued: (id: string) => ChatQueuedMessage | undefined;
|
|
140
139
|
};
|
|
141
|
-
//#endregion
|
|
142
140
|
//# sourceMappingURL=use-chat.d.ts.map
|
package/dist/chat/use-chat.js
CHANGED
|
@@ -3,7 +3,7 @@ import { addTokenUsage, resolveTools, serializeResult } from "./use-chat-helpers
|
|
|
3
3
|
import { createSessionRuntime } from "./use-chat-session.js";
|
|
4
4
|
import { useModel } from "@veltra/compositions";
|
|
5
5
|
import { reactive, ref, watch } from "vue";
|
|
6
|
-
|
|
6
|
+
// src/chat/use-chat.ts
|
|
7
7
|
const uid = () => {
|
|
8
8
|
return typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
9
9
|
};
|
|
@@ -405,7 +405,6 @@ function useChat(options) {
|
|
|
405
405
|
removeQueued
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
|
-
//#endregion
|
|
409
408
|
export { useChat };
|
|
410
409
|
|
|
411
410
|
//# sourceMappingURL=use-chat.js.map
|
|
@@ -13,7 +13,7 @@ import { useResizeObserver } from "@veltra/compositions";
|
|
|
13
13
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, isRef, normalizeClass, openBlock, provide, ref, renderSlot, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
14
14
|
import { ULayout } from "@veltra/desktop";
|
|
15
15
|
import { bem } from "@veltra/utils";
|
|
16
|
-
|
|
16
|
+
// src/components/ai-chat/ai-chat.vue
|
|
17
17
|
const PANEL_MIN_WIDTH = 320;
|
|
18
18
|
const MAIN_MIN_WIDTH = 360;
|
|
19
19
|
/** 面板打开时默认给会话区留的宽度(即面板默认尽可能大) */
|
|
@@ -313,7 +313,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
|
-
//#endregion
|
|
317
316
|
export { _sfc_main as default };
|
|
318
317
|
|
|
319
318
|
//# sourceMappingURL=ai-chat.js.map
|
|
@@ -2,7 +2,7 @@ import { AiChatDIKey } from "./di.js";
|
|
|
2
2
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
3
3
|
import { UButton } from "@veltra/desktop";
|
|
4
4
|
import { bem } from "@veltra/utils";
|
|
5
|
-
|
|
5
|
+
// src/components/ai-chat/approval-banner.vue
|
|
6
6
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "UAiChatApprovalBanner",
|
|
8
8
|
__name: "approval-banner",
|
|
@@ -48,7 +48,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
//#endregion
|
|
52
51
|
export { _sfc_main as default };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=approval-banner.js.map
|
|
@@ -2,7 +2,7 @@ import { AiChatDIKey } from "./di.js";
|
|
|
2
2
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, watch, withCtx } from "vue";
|
|
3
3
|
import { UButton, UInput } from "@veltra/desktop";
|
|
4
4
|
import { bem } from "@veltra/utils";
|
|
5
|
-
|
|
5
|
+
// src/components/ai-chat/ask-question.vue
|
|
6
6
|
const _hoisted_1 = ["onClick"];
|
|
7
7
|
const _hoisted_2 = ["aria-checked", "onClick"];
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
@@ -162,7 +162,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
-
//#endregion
|
|
166
165
|
export { _sfc_main as default };
|
|
167
166
|
|
|
168
167
|
//# sourceMappingURL=ask-question.js.map
|
|
@@ -5,7 +5,7 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
|
|
|
5
5
|
import { Attach, Clear, Close, Up } from "@veltra/icons/normal";
|
|
6
6
|
import { UButton, UDropdown, UFilePicker, UIcon, UPopConfirm } from "@veltra/desktop";
|
|
7
7
|
import { bem } from "@veltra/utils";
|
|
8
|
-
|
|
8
|
+
// src/components/ai-chat/chat-input.vue
|
|
9
9
|
const _hoisted_1 = ["src", "alt"];
|
|
10
10
|
const _hoisted_2 = ["placeholder", "onKeydown"];
|
|
11
11
|
const _hoisted_3 = ["stroke-dasharray", "stroke-linecap"];
|
|
@@ -322,7 +322,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
|
-
//#endregion
|
|
326
325
|
export { _sfc_main as default };
|
|
327
326
|
|
|
328
327
|
//# sourceMappingURL=chat-input.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/ai-chat/format-duration.ts
|
|
2
2
|
/** 格式化工作时长:整秒显示,≥60s 显示 Xm Ys */
|
|
3
3
|
const formatDuration = (ms) => {
|
|
4
4
|
const seconds = Math.round(ms / 1e3);
|
|
@@ -7,7 +7,6 @@ const formatDuration = (ms) => {
|
|
|
7
7
|
const rest = seconds % 60;
|
|
8
8
|
return rest ? `${minutes}m ${rest}s` : `${minutes}m`;
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { formatDuration };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=format-duration.js.map
|
|
@@ -4,7 +4,7 @@ import { Fragment, createBlock, createCommentVNode, createElementBlock, createEl
|
|
|
4
4
|
import { ArrowRight } from "@veltra/icons/normal";
|
|
5
5
|
import { UIcon } from "@veltra/desktop";
|
|
6
6
|
import { bem } from "@veltra/utils";
|
|
7
|
-
|
|
7
|
+
// src/components/ai-chat/job-bar.vue
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatJobBar",
|
|
10
10
|
__name: "job-bar",
|
|
@@ -42,7 +42,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
//#endregion
|
|
46
45
|
export { _sfc_main as default };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=job-bar.js.map
|
|
@@ -6,7 +6,7 @@ import { ArrowRight, CircleCheck, Copy, InfoCircle, Loading, Refresh } from "@ve
|
|
|
6
6
|
import { UButton, UIcon, UScroll, message } from "@veltra/desktop";
|
|
7
7
|
import { bem } from "@veltra/utils";
|
|
8
8
|
import MarkdownRender from "markstream-vue";
|
|
9
|
-
|
|
9
|
+
// src/components/ai-chat/message-item.vue
|
|
10
10
|
const _hoisted_1 = ["src", "alt"];
|
|
11
11
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
12
|
name: "UAiChatMessageItem",
|
|
@@ -206,7 +206,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
//#endregion
|
|
210
209
|
export { _sfc_main as default };
|
|
211
210
|
|
|
212
211
|
//# sourceMappingURL=message-item.js.map
|
|
@@ -7,7 +7,7 @@ import { Fragment, Transition, computed, createBlock, createCommentVNode, create
|
|
|
7
7
|
import { ArrowDown } from "@veltra/icons/normal";
|
|
8
8
|
import { UIcon, UScroll } from "@veltra/desktop";
|
|
9
9
|
import { bem } from "@veltra/utils";
|
|
10
|
-
|
|
10
|
+
// src/components/ai-chat/message-list.vue
|
|
11
11
|
const _hoisted_1 = ["disabled"];
|
|
12
12
|
const ORB_SIZE = 48;
|
|
13
13
|
/** 生成结束 / 失败后工作球停留再跳回输入框上方 */
|
|
@@ -406,7 +406,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
408
|
});
|
|
409
|
-
//#endregion
|
|
410
409
|
export { _sfc_main as default };
|
|
411
410
|
|
|
412
411
|
//# sourceMappingURL=message-list.js.map
|
|
@@ -3,7 +3,7 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
|
|
|
3
3
|
import { ArrowDown, Check } from "@veltra/icons/normal";
|
|
4
4
|
import { UDropdown, UIcon, UScroll } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
|
|
6
|
+
// src/components/ai-chat/model-picker.vue
|
|
7
7
|
const _hoisted_1 = ["onClick"];
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatModelPicker",
|
|
@@ -70,7 +70,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
//#endregion
|
|
74
73
|
export { _sfc_main as default };
|
|
75
74
|
|
|
76
75
|
//# sourceMappingURL=model-picker.js.map
|
|
@@ -3,7 +3,7 @@ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, c
|
|
|
3
3
|
import { CaretRight, Close, EditPen } from "@veltra/icons/normal";
|
|
4
4
|
import { UIcon } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
|
|
6
|
+
// src/components/ai-chat/queue-list.vue
|
|
7
7
|
const _hoisted_1 = ["title"];
|
|
8
8
|
const _hoisted_2 = ["onClick"];
|
|
9
9
|
const _hoisted_3 = ["onClick"];
|
|
@@ -70,7 +70,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
//#endregion
|
|
74
73
|
export { _sfc_main as default };
|
|
75
74
|
|
|
76
75
|
//# sourceMappingURL=queue-list.js.map
|
|
@@ -3,7 +3,7 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
|
|
|
3
3
|
import { ArrowDown, Check } from "@veltra/icons/normal";
|
|
4
4
|
import { UDropdown, UIcon } from "@veltra/desktop";
|
|
5
5
|
import { bem } from "@veltra/utils";
|
|
6
|
-
|
|
6
|
+
// src/components/ai-chat/reasoning-picker.vue
|
|
7
7
|
const _hoisted_1 = ["onClick"];
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatReasoningPicker",
|
|
@@ -62,7 +62,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
//#endregion
|
|
66
65
|
export { _sfc_main as default };
|
|
67
66
|
|
|
68
67
|
//# sourceMappingURL=reasoning-picker.js.map
|
|
@@ -4,7 +4,7 @@ import { computed, createBlock, createCommentVNode, createElementBlock, createEl
|
|
|
4
4
|
import { Close } from "@veltra/icons/normal";
|
|
5
5
|
import { UIcon, UScroll } from "@veltra/desktop";
|
|
6
6
|
import { bem } from "@veltra/utils";
|
|
7
|
-
|
|
7
|
+
// src/components/ai-chat/side-panel.vue
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatSidePanel",
|
|
10
10
|
__name: "side-panel",
|
|
@@ -72,7 +72,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
//#endregion
|
|
76
75
|
export { _sfc_main as default };
|
|
77
76
|
|
|
78
77
|
//# sourceMappingURL=side-panel.js.map
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
@media (prefers-reduced-motion: reduce) {
|
|
51
51
|
.u-ai-chat__panel {
|
|
52
|
-
animation: u-ai-chat-panel-fade 160ms cubic-bezier(0.
|
|
52
|
+
animation: u-ai-chat-panel-fade 160ms cubic-bezier(0.33, 1, 0.68, 1);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
.u-ai-chat__panel-card {
|
|
@@ -323,12 +323,12 @@
|
|
|
323
323
|
@media (prefers-reduced-motion: reduce) {
|
|
324
324
|
.u-ai-chat .u-ai-chat__welcome.is-enter .u-ai-orb,
|
|
325
325
|
.u-ai-chat .u-ai-chat__working .u-ai-orb {
|
|
326
|
-
animation: u-ai-chat-orb-fade 160ms cubic-bezier(0.
|
|
326
|
+
animation: u-ai-chat-orb-fade 160ms cubic-bezier(0.33, 1, 0.68, 1) both;
|
|
327
327
|
}
|
|
328
328
|
.u-ai-chat .u-ai-chat__welcome.is-leaving .u-ai-orb,
|
|
329
329
|
.u-ai-chat .u-ai-chat__working.is-leaving .u-ai-orb {
|
|
330
330
|
transform: none;
|
|
331
|
-
transition: opacity 160ms cubic-bezier(0.
|
|
331
|
+
transition: opacity 160ms cubic-bezier(0.33, 1, 0.68, 1);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
.u-ai-chat__to-latest {
|
|
@@ -4,7 +4,7 @@ import _sfc_main$1 from "./tool-json.js";
|
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, ref, resolveDynamicComponent, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
|
|
5
5
|
import { UButton, UCollapseItem, UIcon } from "@veltra/desktop";
|
|
6
6
|
import { bem } from "@veltra/utils";
|
|
7
|
-
|
|
7
|
+
// src/components/ai-chat/tool-call.vue
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatToolCall",
|
|
10
10
|
__name: "tool-call",
|
|
@@ -193,7 +193,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
|
-
//#endregion
|
|
197
196
|
export { _sfc_main as default };
|
|
198
197
|
|
|
199
198
|
//# sourceMappingURL=tool-call.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditPen, Folder, Internet, QuestionFilled, Terminal, Tools } from "@veltra/icons/normal";
|
|
2
|
-
|
|
2
|
+
// src/components/ai-chat/tool-icons.ts
|
|
3
3
|
/**
|
|
4
4
|
* 内置 toolName → icon:按名称子串匹配,顺序即优先级。
|
|
5
5
|
* 未命中任何规则时走兜底图标,不得 throw。
|
|
@@ -25,7 +25,6 @@ function resolveToolIcon(name, overrides) {
|
|
|
25
25
|
for (const [needles, icon] of TOOL_ICON_RULES) if (needles.some((needle) => lower.includes(needle))) return icon;
|
|
26
26
|
return FALLBACK_TOOL_ICON;
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { FALLBACK_TOOL_ICON, resolveToolIcon };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=tool-icons.js.map
|
|
@@ -2,7 +2,7 @@ import { AiChatDIKey } from "./di.js";
|
|
|
2
2
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, normalizeClass, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
|
|
3
3
|
import { UButton } from "@veltra/desktop";
|
|
4
4
|
import { bem } from "@veltra/utils";
|
|
5
|
-
|
|
5
|
+
// src/components/ai-chat/tool-json.vue
|
|
6
6
|
const PREVIEW_LIMIT = 480;
|
|
7
7
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
8
|
name: "UAiChatToolJson",
|
|
@@ -34,7 +34,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
//#endregion
|
|
38
37
|
export { _sfc_main as default };
|
|
39
38
|
|
|
40
39
|
//# sourceMappingURL=tool-json.js.map
|
|
@@ -4,7 +4,7 @@ import { Fragment, createBlock, createCommentVNode, createElementBlock, createEl
|
|
|
4
4
|
import { ArrowRight, CircleCheck } from "@veltra/icons/normal";
|
|
5
5
|
import { UIcon } from "@veltra/desktop";
|
|
6
6
|
import { bem } from "@veltra/utils";
|
|
7
|
-
|
|
7
|
+
// src/components/ai-chat/turn-process.vue
|
|
8
8
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
9
|
name: "UAiChatTurnProcess",
|
|
10
10
|
__name: "turn-process",
|
|
@@ -50,7 +50,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
//#endregion
|
|
54
53
|
export { _sfc_main as default };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=turn-process.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createOrbRenderer } from "./orb-renderer.js";
|
|
2
2
|
import { createElementBlock, defineComponent, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, unref, useTemplateRef, watch } from "vue";
|
|
3
3
|
import { bem } from "@veltra/utils";
|
|
4
|
-
|
|
4
|
+
// src/components/ai-orb/ai-orb.vue
|
|
5
5
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
6
6
|
name: "UAiOrb",
|
|
7
7
|
__name: "ai-orb",
|
|
@@ -88,7 +88,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
//#endregion
|
|
92
91
|
export { _sfc_main as default };
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=ai-orb.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/ai-orb/orb-renderer.ts
|
|
2
2
|
const STATUS_PARAMS = {
|
|
3
3
|
idle: {
|
|
4
4
|
eyeOpen: 1,
|
|
@@ -485,7 +485,6 @@ function createOrbRenderer(canvas, options) {
|
|
|
485
485
|
renderOnce
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
-
//#endregion
|
|
489
488
|
export { createOrbRenderer };
|
|
490
489
|
|
|
491
490
|
//# sourceMappingURL=orb-renderer.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/providers/types.d.ts
|
|
2
1
|
/** 推理等级选项(值不透明,由宿主/服务商约定) */
|
|
3
2
|
export interface ChatReasoningLevel {
|
|
4
3
|
/** 写入请求的值 */
|
|
@@ -44,5 +43,4 @@ export interface ChatModelOption extends ChatModel {
|
|
|
44
43
|
providerId: string;
|
|
45
44
|
providerLabel?: string;
|
|
46
45
|
}
|
|
47
|
-
//#endregion
|
|
48
46
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "../../chat/types.js";
|
|
2
2
|
import { Component } from "vue";
|
|
3
|
-
//#region src/tools/ask-question/ask-question.d.ts
|
|
4
3
|
/** 单个提问项 */
|
|
5
4
|
export interface AskQuestionItem {
|
|
6
5
|
/** 问题文案 */
|
|
@@ -25,5 +24,4 @@ export interface AskQuestionArgs {
|
|
|
25
24
|
export interface AskQuestionResult {
|
|
26
25
|
answers: AskQuestionAnswer[];
|
|
27
26
|
}
|
|
28
|
-
//#endregion
|
|
29
27
|
//# sourceMappingURL=ask-question.d.ts.map
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "../../components/ai-chat/ask-question.js";
|
|
|
2
2
|
import { deferAskQuestion, resolveAskQuestion, takeAskQuestionDeferred } from "./deferred.js";
|
|
3
3
|
import { computed, defineComponent, h } from "vue";
|
|
4
4
|
import { QuestionFilled } from "@veltra/icons/normal";
|
|
5
|
-
|
|
5
|
+
// src/tools/ask-question/ask-question.ts
|
|
6
6
|
const DEFAULT_DESCRIPTION = "当需求不明确或存在歧义时,向用户提问以澄清。一次可提 1-4 个关键问题;每个问题可提供若干预设选项,用户可选择选项或自定义输入。用户作答后再继续生成。";
|
|
7
7
|
/** 提问参数 JSON Schema(原样传给模型) */
|
|
8
8
|
const QUESTIONS_SCHEMA = {
|
|
@@ -106,7 +106,6 @@ function createAskQuestionTool(options = {}) {
|
|
|
106
106
|
})
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { createAskQuestionTool };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=ask-question.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tools/ask-question/deferred.ts
|
|
2
2
|
/** 挂起的提问 Promise,key 为 toolCallId */
|
|
3
3
|
const pending = /* @__PURE__ */ new Map();
|
|
4
4
|
/** 注册挂起的提问 Promise(由 createAskQuestionTool 的 execute 调用) */
|
|
@@ -16,7 +16,6 @@ function takeAskQuestionDeferred(toolCallId) {
|
|
|
16
16
|
function resolveAskQuestion(toolCallId, result) {
|
|
17
17
|
takeAskQuestionDeferred(toolCallId)?.resolve(result);
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { deferAskQuestion, resolveAskQuestion, takeAskQuestionDeferred };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=deferred.js.map
|
package/dist/tools/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createAskQuestionTool } from "./ask-question/ask-question.js";
|
|
2
|
-
|
|
2
|
+
// src/tools/index.ts
|
|
3
3
|
/** 内置工具列表(useChat 始终注入,不对外导出;新增内置工具在此注册) */
|
|
4
4
|
function createBuiltinTools() {
|
|
5
5
|
return [createAskQuestionTool()];
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { createBuiltinTools };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
package/dist/types/ai-chat.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ChatSessionTransport } from "../chat/session.js";
|
|
|
3
3
|
import { ChatModelOption } from "../providers/types.js";
|
|
4
4
|
import { Component, Ref } from "vue";
|
|
5
5
|
import { DeconstructValue } from "@veltra/utils";
|
|
6
|
-
//#region src/types/ai-chat.d.ts
|
|
7
6
|
export interface AiChatProps {
|
|
8
7
|
/** 传输层(必填);函数型 ChatTransport 或 session 对象,可使用 createOpenAITransport / createServerTransport */
|
|
9
8
|
transport: ChatTransport | ChatSessionTransport;
|
|
@@ -93,5 +92,4 @@ export interface _AiChatExposed {
|
|
|
93
92
|
enqueue: (content: string, attachments?: ChatAttachment[], beforeId?: string) => ChatQueuedMessage;
|
|
94
93
|
}
|
|
95
94
|
export type AiChatExposed = DeconstructValue<_AiChatExposed>;
|
|
96
|
-
//#endregion
|
|
97
95
|
//# sourceMappingURL=ai-chat.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/ai",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"homepage": "https://github.com/cabinet-fe/ultra-ui#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/cabinet-fe/ultra-ui/issues"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"markstream-vue": "^2.0.
|
|
39
|
+
"markstream-vue": "^2.0.20"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@veltra/compositions": "^1.7.14",
|
|
@@ -51,7 +51,7 @@ $root-name: ai-chat;
|
|
|
51
51
|
animation: u-ai-chat-panel-in 0.2s ease-out;
|
|
52
52
|
|
|
53
53
|
@media (prefers-reduced-motion: reduce) {
|
|
54
|
-
animation: u-ai-chat-panel-fade 160ms cubic-bezier(0.
|
|
54
|
+
animation: u-ai-chat-panel-fade 160ms cubic-bezier(0.33, 1, 0.68, 1);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -380,13 +380,13 @@ $root-name: ai-chat;
|
|
|
380
380
|
@media (prefers-reduced-motion: reduce) {
|
|
381
381
|
.u-#{$root-name}__welcome.is-enter .u-ai-orb,
|
|
382
382
|
.u-#{$root-name}__working .u-ai-orb {
|
|
383
|
-
animation: u-ai-chat-orb-fade 160ms cubic-bezier(0.
|
|
383
|
+
animation: u-ai-chat-orb-fade 160ms cubic-bezier(0.33, 1, 0.68, 1) both;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
.u-#{$root-name}__welcome.is-leaving .u-ai-orb,
|
|
387
387
|
.u-#{$root-name}__working.is-leaving .u-ai-orb {
|
|
388
388
|
transform: none;
|
|
389
|
-
transition: opacity 160ms cubic-bezier(0.
|
|
389
|
+
transition: opacity 160ms cubic-bezier(0.33, 1, 0.68, 1);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
|