@spacex110/core 0.1.11

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.
@@ -0,0 +1,620 @@
1
+ export declare class AIChannelManager {
2
+ private storageAdapter;
3
+ private channels;
4
+ private activeChannelId;
5
+ private storagePrefix;
6
+ private activeChannelKey;
7
+ private proxyUrl?;
8
+ private listeners;
9
+ constructor(options?: ChannelManagerOptions);
10
+ /** 监听事件 */
11
+ on(event: ChannelEventType, listener: ChannelEventListener): () => void;
12
+ /** 取消监听 */
13
+ off(event: ChannelEventType, listener: ChannelEventListener): void;
14
+ private emit;
15
+ private getStorageKey;
16
+ private loadChannels;
17
+ private loadActiveChannel;
18
+ private saveChannel;
19
+ private deleteChannelFromStorage;
20
+ private saveActiveChannel;
21
+ /** 添加通道 */
22
+ addChannel(config: AIConfig, name?: string): Promise<ChannelConfig>;
23
+ /** 删除通道 */
24
+ deleteChannel(id: string): void;
25
+ /** 更新通道 */
26
+ updateChannel(id: string, config: Partial<AIConfig>, name?: string): Promise<ChannelConfig>;
27
+ /** 获取所有通道 */
28
+ getChannels(): ChannelConfig[];
29
+ /** 根据 ID 获取通道 */
30
+ getChannel(id: string): ChannelConfig | undefined;
31
+ /** 按 Provider ID 过滤通道 */
32
+ getChannelsByProvider(providerId: string): ChannelConfig[];
33
+ /** 按模型能力过滤通道(如 vision, reasoning, audio) */
34
+ getChannelsByCapability(capability: ModelCapability): ChannelConfig[];
35
+ /** 按 API 格式过滤通道(如 openai, anthropic, gemini) */
36
+ getChannelsByFormat(format: ApiFormat): ChannelConfig[];
37
+ /** 按连接状态过滤通道 */
38
+ getChannelsByStatus(status: ChannelConfig['status']): ChannelConfig[];
39
+ /** 综合条件查询通道 */
40
+ queryChannels(filter: ChannelFilter): ChannelConfig[];
41
+ /** 获取通道数量 */
42
+ getChannelCount(): number;
43
+ /** 获取当前激活的通道 */
44
+ getActiveChannel(): ChannelConfig | undefined;
45
+ /** 设置当前激活的通道 */
46
+ setActiveChannel(id: string): void;
47
+ /** 清除当前激活的通道 */
48
+ clearActiveChannel(): void;
49
+ /** 获取 Provider 的可用模型列表(动态获取 + 静态兜底) */
50
+ getProviderModels(providerId: string, apiKey?: string, baseUrl?: string): Promise<Model[]>;
51
+ /** 获取通道对应的 Provider 的模型列表 */
52
+ getChannelModels(id: string): Promise<Model[]>;
53
+ /** 获取 Provider 的静态模型列表(不发起网络请求) */
54
+ getStaticModelList(providerId: string): Model[];
55
+ /** 按能力过滤模型列表 */
56
+ getModelsByCapability(models: Model[], capability: ModelCapability): Model[];
57
+ /** 获取所有已配置的模型摘要列表 */
58
+ getConfiguredModels(): Array<{
59
+ channelId: string;
60
+ providerId: string;
61
+ providerName: string;
62
+ model: string;
63
+ modelName: string;
64
+ apiFormat: ApiFormat;
65
+ capabilities: ModelCapability[];
66
+ status: ChannelConfig['status'];
67
+ }>;
68
+ /** 更新通道的 API Key */
69
+ updateApiKey(id: string, apiKey: string): Promise<ChannelConfig>;
70
+ /** 验证 API Key 格式(简单校验,非空且长度合理) */
71
+ validateApiKey(providerId: string, apiKey: string): {
72
+ valid: boolean;
73
+ message?: string;
74
+ };
75
+ /** 脱敏显示 API Key(如 sk-••••••••J4xK) */
76
+ maskApiKey(apiKey: string): string;
77
+ /** 获取通道的脱敏 API Key */
78
+ getMaskedApiKey(id: string): string;
79
+ /** 使用当前激活的通道发送聊天请求 */
80
+ chat(message: string, options?: {
81
+ messages?: Array<{
82
+ role: string;
83
+ content: string;
84
+ }>;
85
+ maxTokens?: number;
86
+ }): Promise<ChatResult>;
87
+ /** 使用指定通道发送聊天请求 */
88
+ chatWith(channelId: string, message: string, options?: {
89
+ messages?: Array<{
90
+ role: string;
91
+ content: string;
92
+ }>;
93
+ maxTokens?: number;
94
+ }): Promise<ChatResult>;
95
+ /** 使用当前激活通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
96
+ chatStream(message: string, options: {
97
+ messages?: Array<{
98
+ role: string;
99
+ content: string;
100
+ }>;
101
+ maxTokens?: number;
102
+ onDelta: (full: string) => void;
103
+ signal?: AbortSignal;
104
+ }): Promise<ChatResult>;
105
+ /** 使用指定通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
106
+ chatWithStream(channelId: string, message: string, options: {
107
+ messages?: Array<{
108
+ role: string;
109
+ content: string;
110
+ }>;
111
+ maxTokens?: number;
112
+ onDelta: (full: string) => void;
113
+ signal?: AbortSignal;
114
+ }): Promise<ChatResult>;
115
+ /** 测试指定通道的连接 */
116
+ testChannel(id: string): Promise<{
117
+ success: boolean;
118
+ latencyMs?: number;
119
+ message?: string;
120
+ }>;
121
+ /** 测试所有通道连接 */
122
+ testAllChannels(): Promise<Array<{
123
+ id: string;
124
+ channel: ChannelConfig;
125
+ result: {
126
+ success: boolean;
127
+ latencyMs?: number;
128
+ message?: string;
129
+ };
130
+ }>>;
131
+ /** 获取所有可用的 Provider */
132
+ getAvailableProviders(): Provider[];
133
+ /** 获取单个 Provider 信息 */
134
+ getProvider(providerId: string): Provider | undefined;
135
+ /** 按 API 格式获取 Provider 列表 */
136
+ getProvidersByFormat(format: ApiFormat): Provider[];
137
+ /** 导出所有通道配置(不包含 API Key 明文) */
138
+ exportChannels(includeApiKeys?: boolean): string;
139
+ /** 导入通道配置 */
140
+ importChannels(json: string, merge?: boolean): Promise<ChannelConfig[]>;
141
+ /** 清空所有通道 */
142
+ clearAllChannels(): void;
143
+ /** 批量删除通道 */
144
+ deleteChannels(ids: string[]): void;
145
+ /** 获取统计信息 */
146
+ getStats(): {
147
+ total: number;
148
+ byStatus: Record<string, number>;
149
+ byFormat: Record<string, number>;
150
+ byProvider: Record<string, number>;
151
+ byCapability: Record<string, number>;
152
+ };
153
+ }
154
+
155
+ export declare interface AIConfig {
156
+ providerId: string;
157
+ apiKey: string;
158
+ model: string;
159
+ modelName?: string;
160
+ baseUrl?: string;
161
+ }
162
+
163
+ /** AIConfigForm 组件的 Props */
164
+ export declare interface AIConfigFormProps {
165
+ /**
166
+ * 自定义请求处理器
167
+ * 用于接管获取模型列表和连通性测试的请求
168
+ * 如果提供此函数,proxyUrl 在这两种操作中将被忽略
169
+ */
170
+ modelFetcher?: ModelFetcher;
171
+ /** 后端代理地址(必需,除非提供了 modelFetcher) */
172
+ proxyUrl?: string;
173
+ /** Provider 配置(可选,默认使用全部内置 Providers) */
174
+ config?: ProviderConfig;
175
+ /** 初始配置(可选,用于编辑已有配置) */
176
+ initialConfig?: Partial<AIConfig>;
177
+ /** 表单标题 */
178
+ title?: string;
179
+ /** 是否显示配置预览区域 */
180
+ showPreview?: boolean;
181
+ /** 保存按钮文本 */
182
+ saveButtonText?: string;
183
+ /** 是否禁用整个表单 */
184
+ disabled?: boolean;
185
+ }
186
+
187
+ /**
188
+ * AI Provider Selector - Core Types
189
+ * Framework-agnostic type definitions
190
+ */
191
+ export declare type ApiFormat = 'openai' | 'anthropic' | 'gemini' | 'cohere';
192
+
193
+ /** 通道配置(扩展 AIConfig,包含更多元数据) */
194
+ export declare interface ChannelConfig extends AIConfig {
195
+ /** 通道唯一标识 */
196
+ id: string;
197
+ /** 通道名称(用户自定义) */
198
+ name?: string;
199
+ /** Provider 名称 */
200
+ providerName: string;
201
+ /** 模型显示名称 */
202
+ modelName: string;
203
+ /** API 格式 */
204
+ apiFormat: ApiFormat;
205
+ /** 模型能力列表 */
206
+ capabilities?: ModelCapability[];
207
+ /** 上下文窗口大小 */
208
+ contextLength?: number;
209
+ /** 创建时间 */
210
+ createdAt: number;
211
+ /** 最后使用时间 */
212
+ lastUsedAt?: number;
213
+ /** 连接状态 */
214
+ status?: 'untested' | 'connected' | 'error';
215
+ /** 最后错误信息 */
216
+ lastError?: string;
217
+ }
218
+
219
+ declare type ChannelEventListener = (data: any) => void;
220
+
221
+ /** 事件类型 */
222
+ export declare type ChannelEventType = 'add' | 'update' | 'delete' | 'activate' | 'chat' | 'test' | 'clear';
223
+
224
+ /** 通道查询过滤条件 */
225
+ export declare interface ChannelFilter {
226
+ /** 按 Provider ID 过滤 */
227
+ providerId?: string;
228
+ /** 按 API 格式过滤 */
229
+ apiFormat?: ApiFormat;
230
+ /** 按模型能力过滤 */
231
+ capability?: ModelCapability;
232
+ /** 按连接状态过滤 */
233
+ status?: ChannelConfig['status'];
234
+ /** 关键字搜索(匹配名称、模型名、Provider 名) */
235
+ keyword?: string;
236
+ }
237
+
238
+ /** 通道管理器配置选项 */
239
+ export declare interface ChannelManagerOptions {
240
+ /** 存储适配器(默认使用加密存储) */
241
+ storageAdapter?: StorageAdapter;
242
+ /** 存储键名前缀 */
243
+ storagePrefix?: string;
244
+ /** 当前激活通道的存储键 */
245
+ activeChannelKey?: string;
246
+ /** 后端代理地址(可选,用于解决 CORS 问题) */
247
+ proxyUrl?: string;
248
+ }
249
+
250
+ /** 聊天结果 */
251
+ export declare interface ChatResult {
252
+ success: boolean;
253
+ content?: string;
254
+ message?: string;
255
+ latencyMs?: number;
256
+ channelId?: string;
257
+ model?: string;
258
+ }
259
+
260
+ export declare function createConfigStorage(adapter?: StorageAdapter, options?: StorageOptions): {
261
+ /**
262
+ * Save AI config
263
+ */
264
+ save(config: AIConfig): void;
265
+ /**
266
+ * Load AI config
267
+ */
268
+ load(): AIConfig | null;
269
+ /**
270
+ * Clear AI config
271
+ */
272
+ clear(): void;
273
+ };
274
+
275
+ /** 自定义 Provider 定义 */
276
+ export declare interface CustomProviderDefinition {
277
+ name: string;
278
+ baseUrl: string;
279
+ needsApiKey: boolean;
280
+ apiFormat: ApiFormat;
281
+ supportsModelsApi?: boolean;
282
+ icon?: string;
283
+ /** 静态模型列表(当不支持 /models API 时使用) */
284
+ models?: Model[];
285
+ }
286
+
287
+ /** 默认存储适配器(加密) */
288
+ export declare const defaultStorageAdapter: StorageAdapter;
289
+
290
+ export declare interface DirectChatOptions {
291
+ apiFormat: string;
292
+ baseUrl: string;
293
+ apiKey: string;
294
+ model: string;
295
+ messages: Array<{
296
+ role: string;
297
+ content: string;
298
+ }>;
299
+ maxTokens?: number;
300
+ }
301
+
302
+ export declare interface DirectChatResult {
303
+ success: boolean;
304
+ content?: string;
305
+ message?: string;
306
+ latencyMs?: number;
307
+ }
308
+
309
+ export declare interface DirectChatStreamOptions extends DirectChatOptions {
310
+ /** 每收到增量文本时回调,参数为「累计完整文本」 */
311
+ onDelta: (full: string) => void;
312
+ /** 可选 AbortSignal */
313
+ signal?: AbortSignal;
314
+ }
315
+
316
+ /**
317
+ * 加密存储适配器(默认)
318
+ * 使用 AES 加密存储,防止 API Key 明文泄露
319
+ */
320
+ export declare const encryptedStorageAdapter: StorageAdapter;
321
+
322
+ export declare type FetcherActionType = 'fetchModels' | 'checkConnection';
323
+
324
+ export declare interface FetcherParams {
325
+ type: FetcherActionType;
326
+ providerId: string;
327
+ baseUrl: string;
328
+ apiKey?: string;
329
+ modelId?: string;
330
+ }
331
+
332
+ /**
333
+ * Fetch available models from a provider
334
+ */
335
+ export declare function fetchModels(options: FetchModelsOptions): Promise<Model[]>;
336
+
337
+ export declare interface FetchModelsOptions {
338
+ provider: Provider;
339
+ apiKey?: string;
340
+ baseUrl?: string;
341
+ proxyUrl?: string;
342
+ fallbackToStatic?: boolean;
343
+ }
344
+
345
+ /**
346
+ * Get all providers as an array
347
+ */
348
+ export declare function getAllProviders(): Provider[];
349
+
350
+ /**
351
+ * Get a provider by ID
352
+ */
353
+ export declare function getProvider(id: string): Provider | undefined;
354
+
355
+ /**
356
+ * Get a single provider by ID from config
357
+ */
358
+ export declare function getProviderFromConfig(providerId: string, config?: ProviderConfig): Provider | null;
359
+
360
+ /**
361
+ * Get providers by API format
362
+ */
363
+ export declare function getProvidersByFormat(format: Provider['apiFormat']): Provider[];
364
+
365
+ /**
366
+ * Get static models for a provider
367
+ */
368
+ export declare function getStaticModels(providerId: string): Model[];
369
+
370
+ export declare function getStrategy(format: string): ProviderStrategy;
371
+
372
+ export declare const I18N: {
373
+ readonly zh: {
374
+ readonly save: "保存配置";
375
+ readonly saved: "保存成功";
376
+ readonly providerLabel: "Provider";
377
+ readonly modelLabel: "Model";
378
+ readonly selectProvider: "选择 Provider...";
379
+ readonly customBaseUrl: "自定义 Base URL";
380
+ readonly apiKeyLabel: "API Key";
381
+ readonly apiKeyPlaceholder: "输入 API Key...";
382
+ readonly testConnection: "测试模型连接";
383
+ readonly testing: "测试中...";
384
+ readonly testSuccess: "连接成功";
385
+ readonly testFailed: "测试连通性失败";
386
+ readonly selectModel: "选择 Model...";
387
+ readonly searchModel: "搜索或自定义模型...";
388
+ readonly useCustom: "使用自定义";
389
+ readonly noModels: "暂无模型数据";
390
+ readonly apiKeyTip: "输入 API Key 后可获取完整模型列表";
391
+ readonly fetchModelsFailed: "拉取模型列表失败,已使用离线模型列表";
392
+ readonly refreshingModels: "列表刷新中...";
393
+ readonly modelListUpdated: "模型列表已刷新";
394
+ readonly preview: "配置预览";
395
+ readonly unselected: "(未选择)";
396
+ readonly customProvider: "自定义 (Custom)";
397
+ readonly baseUrlRequired: "请输入 Base URL";
398
+ readonly baseUrlPlaceholder: "输入 API 地址,如 http://localhost:11434/v1";
399
+ readonly apiKeyOptional: "API Key(可选)";
400
+ readonly modelAllTypes: "全部";
401
+ readonly modelCount: "个";
402
+ };
403
+ readonly en: {
404
+ readonly save: "Save Config";
405
+ readonly saved: "Saved";
406
+ readonly providerLabel: "Provider";
407
+ readonly modelLabel: "Model";
408
+ readonly selectProvider: "Select Provider...";
409
+ readonly customBaseUrl: "Custom Base URL";
410
+ readonly apiKeyLabel: "API Key";
411
+ readonly apiKeyPlaceholder: "Enter API Key...";
412
+ readonly testConnection: "Test Model Connection";
413
+ readonly testing: "Testing...";
414
+ readonly testSuccess: "Connection Successful";
415
+ readonly testFailed: "Connection Failed";
416
+ readonly selectModel: "Select Model...";
417
+ readonly searchModel: "Search or custom models...";
418
+ readonly useCustom: "Use custom";
419
+ readonly noModels: "No models found";
420
+ readonly apiKeyTip: "Enter API Key to fetch full model list";
421
+ readonly fetchModelsFailed: "Failed to fetch model list, using offline models";
422
+ readonly refreshingModels: "Refreshing models...";
423
+ readonly modelListUpdated: "Model list updated";
424
+ readonly preview: "Config Preview";
425
+ readonly unselected: "(Unselected)";
426
+ readonly customProvider: "自定义 (Custom)";
427
+ readonly baseUrlRequired: "Base URL is required";
428
+ readonly baseUrlPlaceholder: "Enter API URL, e.g. http://localhost:11434/v1";
429
+ readonly apiKeyOptional: "API Key (optional)";
430
+ readonly modelAllTypes: "All";
431
+ readonly modelCount: "";
432
+ };
433
+ };
434
+
435
+ export declare type I18NKeys = keyof typeof I18N['zh'];
436
+
437
+ export declare type Language = keyof typeof I18N;
438
+
439
+ /** @deprecated 使用 encryptedStorageAdapter 或 plainStorageAdapter */
440
+ export declare const localStorageAdapter: StorageAdapter;
441
+
442
+ export declare interface Model {
443
+ id: string;
444
+ name: string;
445
+ /** 模型能力列表(如 text, vision, audio) */
446
+ capabilities?: ModelCapability[];
447
+ /** 上下文窗口大小 */
448
+ contextLength?: number;
449
+ }
450
+
451
+ export declare const MODEL_CAPABILITIES: Record<ModelCapability, ModelCapabilityMeta>;
452
+
453
+ /** 模型能力类型 */
454
+ export declare type ModelCapability = 'text' | 'vision' | 'audio' | 'video' | 'embedding' | 'reasoning';
455
+
456
+ /** 能力标签配置 */
457
+ declare interface ModelCapabilityMeta {
458
+ type: ModelCapability;
459
+ label: string;
460
+ labelZh: string;
461
+ icon: string;
462
+ }
463
+
464
+ /**
465
+ * Custom fetcher for retrieving models and checking connection.
466
+ * If provided, this will bypass internal fetch logic.
467
+ *
468
+ * - type='fetchModels': returns Promise<Model[]>
469
+ * - type='checkConnection': returns Promise<{ success: boolean; latency?: number; message?: string }>
470
+ */
471
+ export declare type ModelFetcher = (params: FetcherParams) => Promise<any>;
472
+
473
+ /**
474
+ * 明文存储适配器(不推荐)
475
+ */
476
+ export declare const plainStorageAdapter: StorageAdapter;
477
+
478
+ export declare interface Provider {
479
+ id: string;
480
+ name: string;
481
+ baseUrl: string;
482
+ needsApiKey: boolean;
483
+ apiFormat: ApiFormat;
484
+ supportsModelsApi: boolean;
485
+ icon?: string;
486
+ }
487
+
488
+ export declare const PROVIDER_ID: {
489
+ readonly OPENAI: "openai";
490
+ readonly ANTHROPIC: "anthropic";
491
+ readonly GEMINI: "gemini";
492
+ readonly DEEPSEEK: "deepseek";
493
+ readonly OPENROUTER: "openrouter";
494
+ readonly GROQ: "groq";
495
+ readonly MISTRAL: "mistral";
496
+ readonly MOONSHOT: "moonshot";
497
+ readonly QWEN: "qwen";
498
+ readonly ZHIPU: "zhipu";
499
+ readonly SILICONFLOW: "siliconflow";
500
+ readonly XAI: "xai";
501
+ readonly TOGETHER: "together";
502
+ readonly FIREWORKS: "fireworks";
503
+ readonly DEEPINFRA: "deepinfra";
504
+ readonly PERPLEXITY: "perplexity";
505
+ readonly COHERE: "cohere";
506
+ readonly OLLAMA: "ollama";
507
+ readonly DOUBAO: "doubao";
508
+ readonly MINIMAX: "minimax";
509
+ readonly CUSTOM: "custom";
510
+ };
511
+
512
+ /** Provider 配置 JSON */
513
+ export declare interface ProviderConfig {
514
+ /** 模式:default=内置+自定义,customOnly=只用自定义 */
515
+ mode: 'default' | 'customOnly';
516
+ /** 白名单:只显示这些内置 provider(仅 mode=default) */
517
+ include?: string[];
518
+ /** 黑名单:隐藏这些内置 provider(仅 mode=default) */
519
+ exclude?: string[];
520
+ /** 自定义 Providers */
521
+ custom?: Record<string, CustomProviderDefinition>;
522
+ }
523
+
524
+ export declare type ProviderId = typeof PROVIDER_ID[keyof typeof PROVIDER_ID];
525
+
526
+ export declare const PROVIDERS: Record<string, Provider>;
527
+
528
+ export declare interface ProviderStrategy {
529
+ format: string;
530
+ getModelsEndpoint?: (baseUrl: string, apiKey: string) => string;
531
+ parseModelsResponse?: (data: any) => Model[];
532
+ getChatEndpoint: (baseUrl: string, apiKey: string, model: string) => string;
533
+ buildChatPayload: (model: string, messages: Array<{
534
+ role: string;
535
+ content: string;
536
+ }>, maxTokens?: number) => Record<string, unknown>;
537
+ parseChatResponse: (data: any) => string;
538
+ /** 从一个 SSE data 块中提取增量文本(流式)。返回空字符串表示无内容。 */
539
+ parseStreamChunk?: (data: any) => string;
540
+ buildHeaders: (apiKey: string) => Record<string, string>;
541
+ }
542
+
543
+ export declare interface ResolvedConfig {
544
+ providers: Provider[];
545
+ getModels: (providerId: string) => Model[];
546
+ }
547
+
548
+ /**
549
+ * Resolve a ProviderConfig into usable providers and models
550
+ */
551
+ export declare function resolveProviderConfig(config?: ProviderConfig): ResolvedConfig;
552
+
553
+ /**
554
+ * 纯前端直连 AI 厂商进行聊天
555
+ * 注意: 这会将 API Key 暴露在浏览器中,仅适用于 Demo/测试场景
556
+ */
557
+ export declare function sendDirectChat(options: DirectChatOptions): Promise<DirectChatResult>;
558
+
559
+ /**
560
+ * 纯前端直连流式聊天。逐增量回调 onDelta(累计文本),返回最终完整文本。
561
+ * 注意: 与 sendDirectChat 一样会把 API Key 暴露在浏览器,仅适用于 Demo/本地场景。
562
+ */
563
+ export declare function sendDirectChatStream(options: DirectChatStreamOptions): Promise<DirectChatResult>;
564
+
565
+ export declare const STATIC_MODELS: Record<string, Model[]>;
566
+
567
+ export declare interface StorageAdapter {
568
+ get(key: string): string | null;
569
+ set(key: string, value: string): void;
570
+ remove(key: string): void;
571
+ }
572
+
573
+ /**
574
+ * Create a config storage instance
575
+ */
576
+ declare interface StorageOptions {
577
+ serialize?: (data: any) => string;
578
+ deserialize?: (data: string) => any;
579
+ }
580
+
581
+ export declare const strategyRegistry: Record<string, ProviderStrategy>;
582
+
583
+ /**
584
+ * Test connection to an AI provider
585
+ */
586
+ export declare function testConnection(options: TestConnectionOptions): Promise<TestConnectionResult>;
587
+
588
+ export declare interface TestConnectionOptions {
589
+ provider: Provider;
590
+ apiKey: string;
591
+ model?: string;
592
+ baseUrl?: string;
593
+ proxyUrl?: string;
594
+ }
595
+
596
+ declare interface TestConnectionOptions_2 {
597
+ apiFormat: string;
598
+ baseUrl: string;
599
+ apiKey: string;
600
+ model: string;
601
+ }
602
+
603
+ export declare interface TestConnectionResult {
604
+ success: boolean;
605
+ latencyMs?: number;
606
+ message?: string;
607
+ }
608
+
609
+ declare interface TestConnectionResult_2 {
610
+ success: boolean;
611
+ latencyMs?: number;
612
+ message?: string;
613
+ }
614
+
615
+ /**
616
+ * 测试 AI 厂商连接 (通过发送一个简单的聊天请求)
617
+ */
618
+ export declare function testDirectConnection(options: TestConnectionOptions_2): Promise<TestConnectionResult_2>;
619
+
620
+ export { }