@somecat/ai-assist-sdk 1.3.7 → 2.0.1
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/ai-assist-sdk.css +1 -1
- package/dist/chunks/{index-BND0wsLs.mjs → engine-Cu-2TgJb.mjs} +2329 -2243
- package/dist/chunks/index-DNWBsXlO.mjs +98 -0
- package/dist/core/services/mode.d.ts +49 -0
- package/dist/core/types/index.d.ts +184 -0
- package/dist/core/utils/index.d.ts +1 -1
- package/dist/core/utils/markdown.d.ts +11 -0
- package/dist/core/utils/structured.d.ts +25 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +51 -29
- package/dist/react/index.d.ts +6 -1
- package/dist/react/index.mjs +708 -692
- package/dist/vue/components/answer/composables/useChatActions.d.ts +1 -0
- package/dist/vue/components/answer/composables/useChatSessions.d.ts +5 -0
- package/dist/vue/components/generated/icons.d.ts +76 -0
- package/dist/vue/index.d.ts +3 -1
- package/dist/vue/index.mjs +2445 -1685
- package/package.json +116 -113
|
@@ -25,6 +25,7 @@ export declare function useChatActions({ messages, userInput, isGenerating, last
|
|
|
25
25
|
goHistoryMessage: (appConversationId: string) => Promise<void>;
|
|
26
26
|
initConversation: () => Promise<void>;
|
|
27
27
|
resetConversation: () => void;
|
|
28
|
+
clearMessagesKeepingThread: () => void;
|
|
28
29
|
controllers: {
|
|
29
30
|
first: {
|
|
30
31
|
readonly signal: {
|
|
@@ -29,6 +29,8 @@ export interface ChatSession {
|
|
|
29
29
|
loadHistory: (appConversationId: string) => Promise<void>;
|
|
30
30
|
/** 重置会话状态(不调 API),用于草稿会话复用 */
|
|
31
31
|
resetConversation: () => void;
|
|
32
|
+
/** 只清空消息,保留 thread(形态切换时用) */
|
|
33
|
+
clearMessages: () => void;
|
|
32
34
|
}
|
|
33
35
|
interface UseChatSessionsParams {
|
|
34
36
|
cfg: AiAssistConfig;
|
|
@@ -61,5 +63,8 @@ export declare function useChatSessions({ cfg, STATUS, userInput, isActive, scro
|
|
|
61
63
|
regenerateResponse: () => Promise<void>;
|
|
62
64
|
goHistoryMessage: (appConversationId: string) => void;
|
|
63
65
|
createNewConversation: () => void;
|
|
66
|
+
clearActiveMessages: () => void;
|
|
67
|
+
/** page 模式:打开侧栏时按 threadId 恢复历史(幂等,已有消息直接返回) */
|
|
68
|
+
restorePageHistory: (target?: ChatSession) => Promise<void>;
|
|
64
69
|
};
|
|
65
70
|
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** 单个图标的渲染数据(Iconify 的 body 为 SVG 内部标记) */
|
|
2
|
+
export interface SdkIconData {
|
|
3
|
+
body: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
left?: number;
|
|
7
|
+
top?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const SDK_ICONS: {
|
|
10
|
+
readonly add: {
|
|
11
|
+
readonly body: "<path fill=\"currentColor\" d=\"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1\"/>";
|
|
12
|
+
readonly width: 24;
|
|
13
|
+
readonly height: 24;
|
|
14
|
+
};
|
|
15
|
+
readonly history: {
|
|
16
|
+
readonly body: "<path fill=\"currentColor\" d=\"M13.26 3C8.17 2.86 4 6.95 4 12H2.21c-.45 0-.67.54-.35.85l2.79 2.8c.2.2.51.2.71 0l2.79-2.8a.5.5 0 0 0-.36-.85H6c0-3.9 3.18-7.05 7.1-7c3.72.05 6.85 3.18 6.9 6.9c.05 3.91-3.1 7.1-7 7.1c-1.61 0-3.1-.55-4.28-1.48a.994.994 0 0 0-1.32.08c-.42.42-.39 1.13.08 1.49A8.86 8.86 0 0 0 13 21c5.05 0 9.14-4.17 9-9.26c-.13-4.69-4.05-8.61-8.74-8.74m-.51 5c-.41 0-.75.34-.75.75v3.68c0 .35.19.68.49.86l3.12 1.85c.36.21.82.09 1.03-.26c.21-.36.09-.82-.26-1.03l-2.88-1.71v-3.4c0-.4-.34-.74-.75-.74\"/>";
|
|
17
|
+
readonly width: 24;
|
|
18
|
+
readonly height: 24;
|
|
19
|
+
};
|
|
20
|
+
readonly close: {
|
|
21
|
+
readonly body: "<path fill=\"currentColor\" d=\"M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4\"/>";
|
|
22
|
+
readonly width: 24;
|
|
23
|
+
readonly height: 24;
|
|
24
|
+
};
|
|
25
|
+
readonly fullscreen: {
|
|
26
|
+
readonly body: "<path fill=\"currentColor\" d=\"M6 14c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3c.55 0 1-.45 1-1s-.45-1-1-1H7v-2c0-.55-.45-1-1-1m0-4c.55 0 1-.45 1-1V7h2c.55 0 1-.45 1-1s-.45-1-1-1H6c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1m11 7h-2c-.55 0-1 .45-1 1s.45 1 1 1h3c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1s-1 .45-1 1zM14 6c0 .55.45 1 1 1h2v2c0 .55.45 1 1 1s1-.45 1-1V6c0-.55-.45-1-1-1h-3c-.55 0-1 .45-1 1\"/>";
|
|
27
|
+
readonly width: 24;
|
|
28
|
+
readonly height: 24;
|
|
29
|
+
};
|
|
30
|
+
readonly fullscreenExit: {
|
|
31
|
+
readonly body: "<path fill=\"currentColor\" d=\"M6 16h2v2c0 .55.45 1 1 1s1-.45 1-1v-3c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1s.45 1 1 1m2-8H6c-.55 0-1 .45-1 1s.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1s-1 .45-1 1zm7 11c.55 0 1-.45 1-1v-2h2c.55 0 1-.45 1-1s-.45-1-1-1h-3c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1m1-11V6c0-.55-.45-1-1-1s-1 .45-1 1v3c0 .55.45 1 1 1h3c.55 0 1-.45 1-1s-.45-1-1-1z\"/>";
|
|
32
|
+
readonly width: 24;
|
|
33
|
+
readonly height: 24;
|
|
34
|
+
};
|
|
35
|
+
readonly dockOut: {
|
|
36
|
+
readonly body: "<path fill=\"currentColor\" d=\"M14 14h3q.425 0 .713-.288T18 13V9q0-.425-.288-.712T17 8h-3q-.425 0-.712.288T13 9v4q0 .425.288.713T14 14M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20zm0-2h16V6H4zm0 0V6z\"/>";
|
|
37
|
+
readonly width: 24;
|
|
38
|
+
readonly height: 24;
|
|
39
|
+
};
|
|
40
|
+
readonly dockIn: {
|
|
41
|
+
readonly body: "<path fill=\"currentColor\" d=\"M3 5v6h2V5h14v14h-6v2h6c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2\"/><path fill=\"currentColor\" d=\"m6.71 18.71l7.29-7.3V16h2V8H8v2h4.59l-7.3 7.29z\"/>";
|
|
42
|
+
readonly width: 24;
|
|
43
|
+
readonly height: 24;
|
|
44
|
+
};
|
|
45
|
+
readonly refresh: {
|
|
46
|
+
readonly body: "<path fill=\"currentColor\" d=\"M17.65 6.35a7.95 7.95 0 0 0-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 0 0 7.21-4.56c.32-.67-.16-1.44-.9-1.44c-.37 0-.72.2-.88.53a5.994 5.994 0 0 1-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0 1 12 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71z\"/>";
|
|
47
|
+
readonly width: 24;
|
|
48
|
+
readonly height: 24;
|
|
49
|
+
};
|
|
50
|
+
readonly send: {
|
|
51
|
+
readonly body: "<g fill=\"none\"><path fill=\"url(#SVG60VX7duz)\" d=\"M8.805 8.958L1.994 11l.896-3l-.896-3l6.811 2.042c.95.285.95 1.63 0 1.916\"/><path fill=\"url(#SVGTsfYqe5X)\" d=\"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.69.953c.268.053.268.437 0 .49l-5.69.953a.5.5 0 0 0-.397.354l-1.403 4.85a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894z\"/><path fill=\"url(#SVGR0lgWcwP)\" d=\"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.69.953c.268.053.268.437 0 .49l-5.69.953a.5.5 0 0 0-.397.354l-1.403 4.85a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894z\"/><defs><linearGradient id=\"SVGTsfYqe5X\" x1=\"1\" x2=\"12.99\" y1=\"-4.688\" y2=\"11.244\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#3bd5ff\"/><stop offset=\"1\" stop-color=\"#0094f0\"/></linearGradient><linearGradient id=\"SVGR0lgWcwP\" x1=\"8\" x2=\"11.641\" y1=\"4.773\" y2=\"14.624\" gradientUnits=\"userSpaceOnUse\"><stop offset=\".125\" stop-color=\"#dcf8ff\" stop-opacity=\"0\"/><stop offset=\".769\" stop-color=\"#ff6ce8\" stop-opacity=\".7\"/></linearGradient><radialGradient id=\"SVG60VX7duz\" cx=\"0\" cy=\"0\" r=\"1\" gradientTransform=\"matrix(7.43807 0 0 1.12359 .5 8)\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#0094f0\"/><stop offset=\"1\" stop-color=\"#2052cb\"/></radialGradient></defs></g>";
|
|
52
|
+
readonly width: 16;
|
|
53
|
+
readonly height: 16;
|
|
54
|
+
};
|
|
55
|
+
readonly stop: {
|
|
56
|
+
readonly body: "<path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16M8 7a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1z\" clip-rule=\"evenodd\"/>";
|
|
57
|
+
readonly width: 20;
|
|
58
|
+
readonly height: 20;
|
|
59
|
+
};
|
|
60
|
+
readonly arrowDown: {
|
|
61
|
+
readonly body: "<path fill=\"currentColor\" d=\"M544 805.9V168a32 32 0 1 0-64 0v637.9l-233.3-248a30.7 30.7 0 0 0-45.4 0a35.5 35.5 0 0 0 0 48.1l288 306a30.7 30.7 0 0 0 45.4 0l288-306a35.5 35.5 0 0 0 0-48a30.7 30.7 0 0 0-45.4 0z\"/>";
|
|
62
|
+
readonly width: 1024;
|
|
63
|
+
readonly height: 1024;
|
|
64
|
+
};
|
|
65
|
+
readonly voice: {
|
|
66
|
+
readonly body: "<path fill=\"currentColor\" d=\"M11.034 3.741C11.328 2.643 12.921 2.796 13 4v16c-.036.543-.428 1-1 1s-.964-.457-1-1V4Zm4 3C15.328 5.643 16.921 5.796 17 7v10c-.036.543-.428 1-1 1s-.964-.457-1-1V7Zm-8 0C7.328 5.643 8.921 5.796 9 7v10c-.036.543-.428 1-1 1s-.964-.457-1-1V7Zm12 3c.226-.842 1.396-.996 1.832-.241c.101.175.121.302.134.5v4c-.03.451-.288.844-.741.966c-.656.176-1.217-.327-1.259-.966v-4Zm-16 0c.226-.842 1.396-.996 1.832-.241c.101.175.121.302.134.5v4c-.03.451-.288.844-.741.966c-.656.176-1.217-.327-1.259-.966v-4Z\"/>";
|
|
67
|
+
readonly width: 24;
|
|
68
|
+
readonly height: 24;
|
|
69
|
+
};
|
|
70
|
+
readonly voiceClose: {
|
|
71
|
+
readonly body: "<path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M4.28 3.22a.75.75 0 0 0-1.06 1.06L8.94 10l-5.72 5.72a.75.75 0 1 0 1.06 1.06L10 11.06l5.72 5.72a.75.75 0 1 0 1.06-1.06L11.06 10l5.72-5.72a.75.75 0 0 0-1.06-1.06L10 8.94L4.28 3.22Z\" clip-rule=\"evenodd\"/>";
|
|
72
|
+
readonly width: 20;
|
|
73
|
+
readonly height: 20;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type SdkIconName = keyof typeof SDK_ICONS;
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { App as VueApp } from '../../vue/dist/vue.esm-bundler.js';
|
|
|
2
2
|
import { default as AiAssist } from './components/AiAssist.vue';
|
|
3
3
|
import { default as VoiceInput } from './components/VoiceInput.vue';
|
|
4
4
|
import { AiAssistConfig } from '../core/types';
|
|
5
|
-
export type { AiAssistConfig, AiAssistTheme, AiAssistPanelPhase, AiAssistPanelActiveInfo, AiAssistMessageSendInfo, } from '../core/types';
|
|
5
|
+
export type { AiAssistConfig, AiAssistTheme, AiAssistMode, AiAssistPageModeConfig, AiPageAction, AiPageActionResult, AiPageActionState, AiPageTransport, AiPageFile, AiPageHistoryMessage, AiPageStateResult, AiChartItem, AiToolState, AiStreamEvent, AiAssistPanelPhase, AiAssistPanelActiveInfo, AiAssistMessageSendInfo, } from '../core/types';
|
|
6
|
+
/** 形态与面板运行时 API(页面模式由宿主代码控制,界面不暴露切换入口) */
|
|
7
|
+
export { getAiAssistMode, setAiAssistMode, isAiAssistPageMode, openAiAssist, closeAiAssist, collapsePageAssist, toggleAiAssist, isAiAssistVisible, setAiAssistVisible, refreshAiPanelContext, getPageContextSnapshot, getPageModule, setPageModule, getPageThreadId, setPageThreadId, clearPageThreadId, subscribeAiAssistState, } from '../core/services/mode';
|
|
6
8
|
export declare const initAiAssist: (config: AiAssistConfig) => void;
|
|
7
9
|
export declare const mountAiAssist: (container?: HTMLElement) => void;
|
|
8
10
|
export declare const unmountAiAssist: () => void;
|