@opentiny/next-remoter 0.2.3 → 0.2.5
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/components/BubbleImageRenderer.vue.d.ts +15 -0
- package/dist/components/TinyRobotChat.vue.d.ts +48 -11
- package/dist/components/tokenUsage.vue.d.ts +18 -6
- package/dist/composable/CustomAgentModelProvider.d.ts +3 -23
- package/dist/composable/streamVisitor.d.ts +75 -0
- package/dist/composable/useConversationHistory.d.ts +24 -0
- package/dist/composable/useMessageRoles.d.ts +54 -0
- package/dist/composable/usePluginSession.d.ts +25 -0
- package/dist/composable/useSkill.d.ts +21 -22
- package/dist/multimodal/index.d.ts +6 -0
- package/dist/multimodal/useMultimodal.d.ts +210 -0
- package/dist/multimodal/utils.d.ts +23 -0
- package/dist/next-remoter-runtime.es.js +194960 -185760
- package/dist/next-remoter.cjs.js +46 -68
- package/dist/next-remoter.css +1 -1
- package/dist/next-remoter.es.js +15325 -14582
- package/dist/style.css +1 -1
- package/dist/types/model-config.d.ts +14 -0
- package/package.json +9 -7
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { Attachment } from '@opentiny/tiny-robot';
|
|
3
|
+
import { UnifiedModelConfig } from '../types/model-config';
|
|
4
|
+
|
|
5
|
+
export interface MultimodalConfig {
|
|
6
|
+
/** 最大文件大小(MB) - 支持响应式 */
|
|
7
|
+
maxFileSize?: number | ComputedRef<number>;
|
|
8
|
+
/** 支持的文件类型(MIME类型前缀,如 'image/') - 支持响应式 */
|
|
9
|
+
supportedTypes?: string[] | ComputedRef<string[]>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 多模态配置(完整版本,支持模型感知)
|
|
13
|
+
*/
|
|
14
|
+
export interface MultimodalOptionsWithModel {
|
|
15
|
+
/** 当前选中的模型 */
|
|
16
|
+
selectedModel: Ref<UnifiedModelConfig | undefined>;
|
|
17
|
+
/** 当前选中的模型 ID */
|
|
18
|
+
selectedModelId: Ref<string | undefined>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 将附件转换为多模态消息内容(AI SDK 格式)
|
|
22
|
+
* @param attachments 附件列表
|
|
23
|
+
* @returns Promise<Array> 多模态消息内容数组
|
|
24
|
+
*/
|
|
25
|
+
export declare function convertAttachmentsToContent(attachments: Attachment[]): Promise<any[]>;
|
|
26
|
+
/**
|
|
27
|
+
* 多模态消息 Composable(基础版本)
|
|
28
|
+
* 适用于不需要模型感知的场景
|
|
29
|
+
*/
|
|
30
|
+
export declare function useMultimodal(config?: MultimodalConfig): {
|
|
31
|
+
attachments: Ref<({
|
|
32
|
+
url: string;
|
|
33
|
+
size: number;
|
|
34
|
+
rawFile?: {
|
|
35
|
+
readonly lastModified: number;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly webkitRelativePath: string;
|
|
38
|
+
readonly size: number;
|
|
39
|
+
readonly type: string;
|
|
40
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
41
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
42
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
43
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
44
|
+
text: () => Promise<string>;
|
|
45
|
+
} | undefined;
|
|
46
|
+
id?: string | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
49
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
50
|
+
message?: string | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
rawFile: {
|
|
53
|
+
readonly lastModified: number;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly webkitRelativePath: string;
|
|
56
|
+
readonly size: number;
|
|
57
|
+
readonly type: string;
|
|
58
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
59
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
60
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
61
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
62
|
+
text: () => Promise<string>;
|
|
63
|
+
};
|
|
64
|
+
url?: string | undefined;
|
|
65
|
+
size?: number | undefined;
|
|
66
|
+
id?: string | undefined;
|
|
67
|
+
name?: string | undefined;
|
|
68
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
69
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
70
|
+
message?: string | undefined;
|
|
71
|
+
})[], Attachment[] | ({
|
|
72
|
+
url: string;
|
|
73
|
+
size: number;
|
|
74
|
+
rawFile?: {
|
|
75
|
+
readonly lastModified: number;
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly webkitRelativePath: string;
|
|
78
|
+
readonly size: number;
|
|
79
|
+
readonly type: string;
|
|
80
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
81
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
82
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
83
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
84
|
+
text: () => Promise<string>;
|
|
85
|
+
} | undefined;
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
name?: string | undefined;
|
|
88
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
89
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
90
|
+
message?: string | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
rawFile: {
|
|
93
|
+
readonly lastModified: number;
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly webkitRelativePath: string;
|
|
96
|
+
readonly size: number;
|
|
97
|
+
readonly type: string;
|
|
98
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
99
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
100
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
101
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
102
|
+
text: () => Promise<string>;
|
|
103
|
+
};
|
|
104
|
+
url?: string | undefined;
|
|
105
|
+
size?: number | undefined;
|
|
106
|
+
id?: string | undefined;
|
|
107
|
+
name?: string | undefined;
|
|
108
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
109
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
110
|
+
message?: string | undefined;
|
|
111
|
+
})[]>;
|
|
112
|
+
handleFilesSelected: (files: File[]) => Promise<void>;
|
|
113
|
+
clearAttachments: () => void;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* 多模态消息 Composable(完整版本)
|
|
117
|
+
* 集成模型感知、自动验证、切换处理等高级功能
|
|
118
|
+
*
|
|
119
|
+
* @param options 包含选中的模型和模型ID
|
|
120
|
+
* @returns 多模态功能的完整API
|
|
121
|
+
*/
|
|
122
|
+
export declare function useMultimodalWithModel(options: MultimodalOptionsWithModel): {
|
|
123
|
+
hasMultimodalSupport: ComputedRef<boolean>;
|
|
124
|
+
attachments: Ref<({
|
|
125
|
+
url: string;
|
|
126
|
+
size: number;
|
|
127
|
+
rawFile?: {
|
|
128
|
+
readonly lastModified: number;
|
|
129
|
+
readonly name: string;
|
|
130
|
+
readonly webkitRelativePath: string;
|
|
131
|
+
readonly size: number;
|
|
132
|
+
readonly type: string;
|
|
133
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
134
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
135
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
136
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
137
|
+
text: () => Promise<string>;
|
|
138
|
+
} | undefined;
|
|
139
|
+
id?: string | undefined;
|
|
140
|
+
name?: string | undefined;
|
|
141
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
142
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
143
|
+
message?: string | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
rawFile: {
|
|
146
|
+
readonly lastModified: number;
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly webkitRelativePath: string;
|
|
149
|
+
readonly size: number;
|
|
150
|
+
readonly type: string;
|
|
151
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
152
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
153
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
154
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
155
|
+
text: () => Promise<string>;
|
|
156
|
+
};
|
|
157
|
+
url?: string | undefined;
|
|
158
|
+
size?: number | undefined;
|
|
159
|
+
id?: string | undefined;
|
|
160
|
+
name?: string | undefined;
|
|
161
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
162
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
163
|
+
message?: string | undefined;
|
|
164
|
+
})[], Attachment[] | ({
|
|
165
|
+
url: string;
|
|
166
|
+
size: number;
|
|
167
|
+
rawFile?: {
|
|
168
|
+
readonly lastModified: number;
|
|
169
|
+
readonly name: string;
|
|
170
|
+
readonly webkitRelativePath: string;
|
|
171
|
+
readonly size: number;
|
|
172
|
+
readonly type: string;
|
|
173
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
174
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
175
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
176
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
177
|
+
text: () => Promise<string>;
|
|
178
|
+
} | undefined;
|
|
179
|
+
id?: string | undefined;
|
|
180
|
+
name?: string | undefined;
|
|
181
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
182
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
183
|
+
message?: string | undefined;
|
|
184
|
+
} | {
|
|
185
|
+
rawFile: {
|
|
186
|
+
readonly lastModified: number;
|
|
187
|
+
readonly name: string;
|
|
188
|
+
readonly webkitRelativePath: string;
|
|
189
|
+
readonly size: number;
|
|
190
|
+
readonly type: string;
|
|
191
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
192
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
193
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
194
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
195
|
+
text: () => Promise<string>;
|
|
196
|
+
};
|
|
197
|
+
url?: string | undefined;
|
|
198
|
+
size?: number | undefined;
|
|
199
|
+
id?: string | undefined;
|
|
200
|
+
name?: string | undefined;
|
|
201
|
+
status?: import('@opentiny/tiny-robot').FileStatus | undefined;
|
|
202
|
+
fileType?: import('@opentiny/tiny-robot').FileType | undefined;
|
|
203
|
+
message?: string | undefined;
|
|
204
|
+
})[]>;
|
|
205
|
+
onFilesSelected: (files: File[]) => void;
|
|
206
|
+
checkCanSendAttachments: () => boolean;
|
|
207
|
+
processAttachments: () => Promise<any[]>;
|
|
208
|
+
cleanupAttachments: () => void;
|
|
209
|
+
clearAttachments: () => void;
|
|
210
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 多模态消息工具函数
|
|
3
|
+
* 提供文件转base64等基础功能
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 将文件转换为 base64 DataURL
|
|
7
|
+
* @param file 文件对象
|
|
8
|
+
* @returns Promise<string> base64 DataURL字符串
|
|
9
|
+
*/
|
|
10
|
+
export declare function fileToBase64(file: File): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* 检查文件是否为图片
|
|
13
|
+
* @param file 文件对象
|
|
14
|
+
* @returns boolean
|
|
15
|
+
*/
|
|
16
|
+
export declare function isImageFile(file: File): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 验证文件大小
|
|
19
|
+
* @param file 文件对象
|
|
20
|
+
* @param maxSizeMB 最大大小(MB)
|
|
21
|
+
* @returns boolean
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateFileSize(file: File, maxSizeMB: number): boolean;
|