sa2kit 3.7.0 → 3.9.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/{chunk-ZJLS5JU5.mjs → chunk-6KD4CD7O.mjs} +7 -16
- package/dist/chunk-6KD4CD7O.mjs.map +1 -0
- package/dist/chunk-FV7IHC23.js +751 -0
- package/dist/chunk-FV7IHC23.js.map +1 -0
- package/dist/chunk-GJVEYCS4.js +12 -0
- package/dist/chunk-GJVEYCS4.js.map +1 -0
- package/dist/chunk-OOVINE7M.mjs +715 -0
- package/dist/chunk-OOVINE7M.mjs.map +1 -0
- package/dist/chunk-PPV4IEWR.mjs +8 -0
- package/dist/chunk-PPV4IEWR.mjs.map +1 -0
- package/dist/{chunk-XPY45Y75.js → chunk-VVHFMAE7.js} +9 -21
- package/dist/chunk-VVHFMAE7.js.map +1 -0
- package/dist/common/aiApi/client/index.d.mts +66 -4
- package/dist/common/aiApi/client/index.d.ts +66 -4
- package/dist/common/aiApi/client/index.js +360 -15
- package/dist/common/aiApi/client/index.js.map +1 -1
- package/dist/common/aiApi/client/index.mjs +345 -11
- package/dist/common/aiApi/client/index.mjs.map +1 -1
- package/dist/common/aiApi/index.d.mts +2 -2
- package/dist/common/aiApi/index.d.ts +2 -2
- package/dist/common/aiApi/index.js +63 -62
- package/dist/common/aiApi/index.mjs +2 -1
- package/dist/common/aiApi/server/index.d.mts +1 -1
- package/dist/common/aiApi/server/index.d.ts +1 -1
- package/dist/common/aiApi/server/index.js +63 -62
- package/dist/common/aiApi/server/index.mjs +2 -1
- package/dist/common/appLauncher/index.d.mts +32 -0
- package/dist/common/appLauncher/index.d.ts +32 -0
- package/dist/common/appLauncher/index.js +149 -0
- package/dist/common/appLauncher/index.js.map +1 -0
- package/dist/common/appLauncher/index.mjs +4 -0
- package/dist/common/appLauncher/index.mjs.map +1 -0
- package/dist/common/appLauncher/rn/index.d.mts +35 -0
- package/dist/common/appLauncher/rn/index.d.ts +35 -0
- package/dist/common/appLauncher/rn/index.js +100 -0
- package/dist/common/appLauncher/rn/index.js.map +1 -0
- package/dist/common/appLauncher/rn/index.mjs +31 -0
- package/dist/common/appLauncher/rn/index.mjs.map +1 -0
- package/dist/index-BHgDdlJW.d.mts +177 -0
- package/dist/index-BHgDdlJW.d.ts +177 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{types-CiqMQ-uu.d.mts → types-DgbG0Of-.d.mts} +9 -1
- package/dist/{types-CiqMQ-uu.d.ts → types-DgbG0Of-.d.ts} +9 -1
- package/package.json +11 -1
- package/dist/chunk-XPY45Y75.js.map +0 -1
- package/dist/chunk-ZJLS5JU5.mjs.map +0 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** 支持的第三方 App 提供方 */
|
|
2
|
+
type AppProviderId = 'amap' | 'baidu' | 'google' | 'wechat' | 'qq' | 'generic';
|
|
3
|
+
/** 运行平台 */
|
|
4
|
+
type AppLaunchPlatform = 'web' | 'rn';
|
|
5
|
+
/** 唤起结果状态 */
|
|
6
|
+
type AppLaunchStatus = 'opened' | 'fallback' | 'unavailable' | 'cancelled' | 'timeout';
|
|
7
|
+
type AppLaunchUrls = {
|
|
8
|
+
/** 优先尝试的 scheme / URI */
|
|
9
|
+
primary: string;
|
|
10
|
+
/** 无法唤起 App 时的降级链接(通常为 https://uri.* 网页版) */
|
|
11
|
+
fallback?: string;
|
|
12
|
+
};
|
|
13
|
+
type AppLaunchResult = {
|
|
14
|
+
provider: AppProviderId;
|
|
15
|
+
action: string;
|
|
16
|
+
status: AppLaunchStatus;
|
|
17
|
+
url: string;
|
|
18
|
+
platform: AppLaunchPlatform;
|
|
19
|
+
data?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
declare class AppLaunchError extends Error {
|
|
22
|
+
readonly code: 'UNKNOWN_PROVIDER' | 'UNKNOWN_ACTION' | 'INVALID_PARAMS' | 'ADAPTER_MISSING' | 'OPEN_FAILED';
|
|
23
|
+
readonly details?: Record<string, unknown>;
|
|
24
|
+
constructor(code: AppLaunchError['code'], message: string, details?: Record<string, unknown>);
|
|
25
|
+
}
|
|
26
|
+
type AppReturnPayload = {
|
|
27
|
+
provider?: AppProviderId;
|
|
28
|
+
action?: string;
|
|
29
|
+
url: string;
|
|
30
|
+
params: Record<string, string>;
|
|
31
|
+
raw?: unknown;
|
|
32
|
+
};
|
|
33
|
+
type AppLaunchCallbacks = {
|
|
34
|
+
/** 已成功尝试唤起(Web 端通过页面隐藏等方式推断) */
|
|
35
|
+
onOpened?: (result: AppLaunchResult) => void;
|
|
36
|
+
/** 使用了 fallback 链接 */
|
|
37
|
+
onFallback?: (result: AppLaunchResult) => void;
|
|
38
|
+
/** 无法唤起目标 App */
|
|
39
|
+
onUnavailable?: (result: AppLaunchResult) => void;
|
|
40
|
+
/** 第三方 App 通过 returnUrl / deep link 回传 */
|
|
41
|
+
onReturn?: (payload: AppReturnPayload) => void;
|
|
42
|
+
/** 任意错误 */
|
|
43
|
+
onError?: (error: AppLaunchError) => void;
|
|
44
|
+
};
|
|
45
|
+
type AppLaunchOptions = {
|
|
46
|
+
/** 第三方统计用的来源应用名,如 profile-v1 */
|
|
47
|
+
sourceApplication?: string;
|
|
48
|
+
/** 自定义 fallback,覆盖 provider 默认值 */
|
|
49
|
+
fallbackUrl?: string;
|
|
50
|
+
/** 回跳地址(如 myapp://launch/callback),供宿主监听 */
|
|
51
|
+
returnUrl?: string;
|
|
52
|
+
/** Web 端等待 App 唤起的超时(毫秒) */
|
|
53
|
+
timeoutMs?: number;
|
|
54
|
+
};
|
|
55
|
+
type AppLaunchRequest = {
|
|
56
|
+
provider: AppProviderId;
|
|
57
|
+
action: string;
|
|
58
|
+
params?: Record<string, unknown>;
|
|
59
|
+
options?: AppLaunchOptions;
|
|
60
|
+
callbacks?: AppLaunchCallbacks;
|
|
61
|
+
/** 单次调用可覆盖全局 adapter */
|
|
62
|
+
adapter?: AppLaunchAdapter;
|
|
63
|
+
};
|
|
64
|
+
type LaunchExecutionOptions = {
|
|
65
|
+
timeoutMs: number;
|
|
66
|
+
callbacks?: AppLaunchCallbacks;
|
|
67
|
+
provider: AppProviderId;
|
|
68
|
+
action: string;
|
|
69
|
+
};
|
|
70
|
+
/** 平台适配器:负责实际 openURL 与结果推断 */
|
|
71
|
+
type AppLaunchAdapter = {
|
|
72
|
+
platform: AppLaunchPlatform;
|
|
73
|
+
launch(urls: AppLaunchUrls, options: LaunchExecutionOptions): Promise<AppLaunchResult>;
|
|
74
|
+
canOpen?(url: string): Promise<boolean>;
|
|
75
|
+
};
|
|
76
|
+
type AppLauncherConfig = {
|
|
77
|
+
sourceApplication: string;
|
|
78
|
+
adapter?: AppLaunchAdapter;
|
|
79
|
+
defaultOptions?: AppLaunchOptions;
|
|
80
|
+
defaultCallbacks?: AppLaunchCallbacks;
|
|
81
|
+
};
|
|
82
|
+
type AppLaunchProviderContext = {
|
|
83
|
+
sourceApplication: string;
|
|
84
|
+
options: AppLaunchOptions;
|
|
85
|
+
};
|
|
86
|
+
/** 各子功能(高德/微信/QQ 等)的统一契约 */
|
|
87
|
+
type AppLaunchProvider = {
|
|
88
|
+
id: AppProviderId;
|
|
89
|
+
actions: readonly string[];
|
|
90
|
+
buildUrls(action: string, params: Record<string, unknown>, context: AppLaunchProviderContext): AppLaunchUrls;
|
|
91
|
+
validateParams?(action: string, params: Record<string, unknown>): void;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** RN Linking 最小能力面,避免硬依赖 react-native */
|
|
95
|
+
type RnLinkingLike = {
|
|
96
|
+
canOpenURL(url: string): Promise<boolean>;
|
|
97
|
+
openURL(url: string): Promise<void>;
|
|
98
|
+
addEventListener?: (type: 'url', handler: (event: {
|
|
99
|
+
url: string;
|
|
100
|
+
}) => void) => void;
|
|
101
|
+
removeEventListener?: (type: 'url', handler: (event: {
|
|
102
|
+
url: string;
|
|
103
|
+
}) => void) => void;
|
|
104
|
+
getInitialURL?: () => Promise<string | null>;
|
|
105
|
+
};
|
|
106
|
+
declare function createRnAppLaunchAdapter(linking: RnLinkingLike): AppLaunchAdapter;
|
|
107
|
+
/**
|
|
108
|
+
* 在已安装 react-native 的宿主中快捷创建 adapter。
|
|
109
|
+
* 若未安装 react-native 将抛出明确错误。
|
|
110
|
+
*/
|
|
111
|
+
declare function createRnAppLaunchAdapterFromReactNative(): AppLaunchAdapter;
|
|
112
|
+
|
|
113
|
+
declare function configureAppLauncher(patch: Partial<AppLauncherConfig>): AppLauncherConfig;
|
|
114
|
+
declare function getAppLauncherConfig(): AppLauncherConfig;
|
|
115
|
+
declare function resetAppLauncherConfig(): void;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 统一唤起入口:按 provider + action 构建 scheme,经平台 adapter 拉起第三方 App。
|
|
119
|
+
*/
|
|
120
|
+
declare function launchApp(request: AppLaunchRequest): Promise<AppLaunchResult>;
|
|
121
|
+
|
|
122
|
+
declare function parseReturnUrl(url: string): AppReturnPayload;
|
|
123
|
+
type ReturnListener = (payload: AppReturnPayload) => void;
|
|
124
|
+
/** 宿主 App 在收到 deep link 回跳时调用,分发给 onReturn 订阅者 */
|
|
125
|
+
declare function notifyAppReturn(payload: AppReturnPayload): void;
|
|
126
|
+
declare function subscribeAppReturn(listener: ReturnListener): () => void;
|
|
127
|
+
declare function matchesReturnUrl(incomingUrl: string, expectedReturnUrl?: string): boolean;
|
|
128
|
+
|
|
129
|
+
declare function registerAppProvider(provider: AppLaunchProvider): void;
|
|
130
|
+
declare function getAppProvider(id: AppProviderId): AppLaunchProvider | undefined;
|
|
131
|
+
declare function listAppProviders(): AppProviderId[];
|
|
132
|
+
|
|
133
|
+
/** 地图导航提供方(关键词导航场景) */
|
|
134
|
+
type MapNavigationProviderId = 'amap' | 'baidu' | 'google';
|
|
135
|
+
type MapNavigationOption = {
|
|
136
|
+
id: MapNavigationProviderId;
|
|
137
|
+
label: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
};
|
|
140
|
+
declare const MAP_NAVIGATION_OPTIONS: readonly MapNavigationOption[];
|
|
141
|
+
type MapNavigationOptions = AppLaunchOptions & {
|
|
142
|
+
callbacks?: AppLaunchCallbacks;
|
|
143
|
+
};
|
|
144
|
+
declare function launchMapNavigation(provider: MapNavigationProviderId, destination: string, options?: MapNavigationOptions): Promise<AppLaunchResult>;
|
|
145
|
+
/** 同步唤起,结果通过 callbacks 回传 */
|
|
146
|
+
declare function openMapNavigation(provider: MapNavigationProviderId, destination: string, options?: MapNavigationOptions): void;
|
|
147
|
+
|
|
148
|
+
type AmapNavigationOptions = AppLaunchOptions & {
|
|
149
|
+
callbacks?: AppLaunchCallbacks;
|
|
150
|
+
};
|
|
151
|
+
/** 高德关键词导航(日历等场景:仅地点文本) */
|
|
152
|
+
declare function launchAmapNavigation(destination: string, options?: AmapNavigationOptions): Promise<AppLaunchResult>;
|
|
153
|
+
/** 兼容同步调用:不阻塞 UI,结果通过 callbacks 回传 */
|
|
154
|
+
declare function openAmapNavigation(destination: string, options?: AmapNavigationOptions): void;
|
|
155
|
+
|
|
156
|
+
type WechatShareOptions = AppLaunchOptions & {
|
|
157
|
+
callbacks?: AppLaunchCallbacks;
|
|
158
|
+
title: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
url: string;
|
|
161
|
+
thumbUrl?: string;
|
|
162
|
+
};
|
|
163
|
+
declare function launchWechatShare(options: WechatShareOptions): Promise<AppLaunchResult>;
|
|
164
|
+
type QqShareOptions = AppLaunchOptions & {
|
|
165
|
+
callbacks?: AppLaunchCallbacks;
|
|
166
|
+
title: string;
|
|
167
|
+
summary?: string;
|
|
168
|
+
url: string;
|
|
169
|
+
imageUrl?: string;
|
|
170
|
+
};
|
|
171
|
+
declare function launchQqShare(options: QqShareOptions): Promise<AppLaunchResult>;
|
|
172
|
+
declare function launchGenericUrl(url: string, options?: AppLaunchOptions & {
|
|
173
|
+
callbacks?: AppLaunchCallbacks;
|
|
174
|
+
fallback?: string;
|
|
175
|
+
}): Promise<AppLaunchResult>;
|
|
176
|
+
|
|
177
|
+
export { type AppReturnPayload as A, type AppLaunchPlatform as B, type AppLaunchRequest as C, type AppLaunchStatus as D, type AppLaunchUrls as E, type AppLauncherConfig as F, type AppProviderId as G, AppLaunchError as H, type AmapNavigationOptions as I, type MapNavigationOption as J, type MapNavigationOptions as K, type LaunchExecutionOptions as L, MAP_NAVIGATION_OPTIONS as M, type QqShareOptions as Q, type RnLinkingLike as R, type WechatShareOptions as W, createRnAppLaunchAdapter as a, createRnAppLaunchAdapterFromReactNative as b, configureAppLauncher as c, launchAmapNavigation as d, launchGenericUrl as e, launchQqShare as f, getAppLauncherConfig as g, launchWechatShare as h, launchMapNavigation as i, type AppLaunchCallbacks as j, type AppLaunchOptions as k, launchApp as l, matchesReturnUrl as m, notifyAppReturn as n, openMapNavigation as o, parseReturnUrl as p, type AppLaunchResult as q, registerAppProvider as r, subscribeAppReturn as s, type MapNavigationProviderId as t, type AppLaunchAdapter as u, type AppLaunchProvider as v, resetAppLauncherConfig as w, getAppProvider as x, listAppProviders as y, openAmapNavigation as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -10974,6 +10974,14 @@ interface ConnectivityTestOutput {
|
|
|
10974
10974
|
ok: boolean;
|
|
10975
10975
|
reply: string;
|
|
10976
10976
|
}
|
|
10977
|
+
/** GET /api/ai/config 响应(宿主实现,不暴露 apiKey) */
|
|
10978
|
+
interface AiServerConfigStatus {
|
|
10979
|
+
serverConfigured: boolean;
|
|
10980
|
+
baseUrl?: string;
|
|
10981
|
+
visionModel?: string;
|
|
10982
|
+
textModel?: string;
|
|
10983
|
+
error?: string;
|
|
10984
|
+
}
|
|
10977
10985
|
interface AiModelsListRequest {
|
|
10978
10986
|
clientSettings?: AiClientSettings;
|
|
10979
10987
|
}
|
|
@@ -11201,4 +11209,4 @@ declare const coreStructuredMultimodalTask: AiTaskDefinition<StructuredMultimoda
|
|
|
11201
11209
|
|
|
11202
11210
|
declare const coreConnectivityTestTask: AiTaskDefinition<Record<string, never>, ConnectivityTestOutput>;
|
|
11203
11211
|
|
|
11204
|
-
export { type AiApiErrorBody, type AiApiErrorCode, type AiApiResponse, type AiApiResponseMeta, type AiApiRunRequest, type AiAudioInput, type AiAudioMediaInput, type AiClientSettings, type AiConnectionConfig, type AiConnectionSettings, type AiImageInput, type AiImageMediaInput, type AiMediaInput, type AiMediaKind, type AiModelsListRequest, type AiModelsListResponse, type AiTaskContext, type AiTaskDefinition, type AiTaskRunOptions, Dialog as AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, DialogDescription as AlertDialogDescription, DialogFooter as AlertDialogFooter, DialogHeader as AlertDialogHeader, DialogOverlay as AlertDialogOverlay, DialogPortal as AlertDialogPortal, DialogTitle as AlertDialogTitle, DialogTrigger as AlertDialogTrigger, type AudioStrategy, Avatar, AvatarFallback, AvatarImage, BackButton, type BackButtonProps, type BackgroundRemovalOptions, type BackgroundRemovalState, BackgroundRemover, Badge, type BadgeProps, Ball, Button, type ButtonProps, CORE_CONNECTIVITY_TEST_TASK_ID, CORE_LLM_COMPLETION_TASK_ID, CORE_STRUCTURED_MULTIMODAL_TASK_ID, type CallChatOptions, type CallChatResult, type CallCompletionParams, type CallCompletionResult, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatRole, type ChatUsage, CollisionBalls, CollisionBallsConfig, ConfirmModal, type ConfirmModalProps, type ConnectivityTestOutput, ConsoleLoggerAdapter, DEFAULT_OPENAI_BASE_URL, DEFAULT_TEXT_MODEL, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterButtonGroup, type FilterButtonGroupProps, type FilterOption, GenericOrderManager, type GenericOrderManagerProps, Grid, GridColumns, GridGap, GridItem, GridProps, type ImageMappingItem, ImageMappingPanel, type ImageMappingPanelProps, type ImageMappingValue, Input, type JsonRequestOptions, Label, type ListModelsResult, LocalImageMappingPanel, type LocalImageMappingPanelProps, type LogEntry, LogLevel, Logger, type LoggerAdapter, type LoggerConfig, Modal, type ModalProps, type MultimodalChatParams, type MultimodalChatResult, type OCROptions, type OCRResult, OCRScanner, type OCRState, type OrderManagerOperations, type OrderableItem, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, type ResolvedAudioHandling, ScrollArea, ScrollBar, SearchBox, SearchResultHint, type SearchResultHintProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SentimentAnalyzer, type SentimentOptions, type SentimentResult, type SentimentState, Separator, type SeparatorProps, Dialog as Sheet, DialogClose as SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, DialogOverlay as SheetOverlay, DialogPortal as SheetPortal, SheetTitle, DialogTrigger as SheetTrigger, SmartAssistant, type StorageAdapter, type StorageChangeEvent, type StructuredMultimodalInput, type StructuredMultimodalOutput, Tabs, TabsContent, TabsList, TabsTrigger, type TextCompletionInput, type TextCompletionOutput, type TextGenerationOptions, type TextGenerationState, Textarea, Timeline, TimelineConfig, TimelineItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TranscribeAudioOptions, type VisionMessageFormat, appendTranscriptionsToPrompt, arrayUtils, assertMultimodalCapableModel, assertValidAudioInput, assertValidImageInput, assertValidMultimodalMedia, assertVisionCapableModel, badgeVariants, base64ToBlob, buildMultimodalMessages, buttonVariants, callChat, callCompletion, callMultimodalChat, clearAiTasksForTest, cn, index as common, coreConnectivityTestTask, coreLlmCompletionTask, coreStructuredMultimodalTask, createLogger, debugUtils, detectVisionMessageFormat, ensureCoreAiTasksRegistered, errorUtils, extractJsonObject, fileToAiAudioInput, fileToAiImageInput, fileUtils, filterChatModels, filterSttModels, filterVisionModels, formatTime, getAiTask, isAudioInputError, isImageUrlVariantError, isKnownTextOnlyModel, isLikelyNativeAudioChatModel, isLikelySttModel, isLikelyVisionModel, japaneseUtils, listAiTasks, listOpenAiCompatibleModels, logger, mimeToAudioFormat, pickDefaultSttModel, pickDefaultVisionModel, registerAiTask, registerCoreAiTasks, requestJson, requireAiConnectionConfig, resetCoreAiTasksForTest, resolveAiConnectionConfig, resolveAudioHandling, runAiTask, splitMediaByKind, stringUtils, toVisionApiErrorMessage, transcribeAudio, transcribeAudios, useAsyncStorage, useBackgroundRemoval, useElectronStorage, useLocalStorage, useOCR, useSentimentAnalysis, useStorage, useTaroStorage, useTextGeneration, validators };
|
|
11212
|
+
export { type AiApiErrorBody, type AiApiErrorCode, type AiApiResponse, type AiApiResponseMeta, type AiApiRunRequest, type AiAudioInput, type AiAudioMediaInput, type AiClientSettings, type AiConnectionConfig, type AiConnectionSettings, type AiImageInput, type AiImageMediaInput, type AiMediaInput, type AiMediaKind, type AiModelsListRequest, type AiModelsListResponse, type AiServerConfigStatus, type AiTaskContext, type AiTaskDefinition, type AiTaskRunOptions, Dialog as AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, DialogDescription as AlertDialogDescription, DialogFooter as AlertDialogFooter, DialogHeader as AlertDialogHeader, DialogOverlay as AlertDialogOverlay, DialogPortal as AlertDialogPortal, DialogTitle as AlertDialogTitle, DialogTrigger as AlertDialogTrigger, type AudioStrategy, Avatar, AvatarFallback, AvatarImage, BackButton, type BackButtonProps, type BackgroundRemovalOptions, type BackgroundRemovalState, BackgroundRemover, Badge, type BadgeProps, Ball, Button, type ButtonProps, CORE_CONNECTIVITY_TEST_TASK_ID, CORE_LLM_COMPLETION_TASK_ID, CORE_STRUCTURED_MULTIMODAL_TASK_ID, type CallChatOptions, type CallChatResult, type CallCompletionParams, type CallCompletionResult, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatRole, type ChatUsage, CollisionBalls, CollisionBallsConfig, ConfirmModal, type ConfirmModalProps, type ConnectivityTestOutput, ConsoleLoggerAdapter, DEFAULT_OPENAI_BASE_URL, DEFAULT_TEXT_MODEL, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterButtonGroup, type FilterButtonGroupProps, type FilterOption, GenericOrderManager, type GenericOrderManagerProps, Grid, GridColumns, GridGap, GridItem, GridProps, type ImageMappingItem, ImageMappingPanel, type ImageMappingPanelProps, type ImageMappingValue, Input, type JsonRequestOptions, Label, type ListModelsResult, LocalImageMappingPanel, type LocalImageMappingPanelProps, type LogEntry, LogLevel, Logger, type LoggerAdapter, type LoggerConfig, Modal, type ModalProps, type MultimodalChatParams, type MultimodalChatResult, type OCROptions, type OCRResult, OCRScanner, type OCRState, type OrderManagerOperations, type OrderableItem, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, type ResolvedAudioHandling, ScrollArea, ScrollBar, SearchBox, SearchResultHint, type SearchResultHintProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SentimentAnalyzer, type SentimentOptions, type SentimentResult, type SentimentState, Separator, type SeparatorProps, Dialog as Sheet, DialogClose as SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, DialogOverlay as SheetOverlay, DialogPortal as SheetPortal, SheetTitle, DialogTrigger as SheetTrigger, SmartAssistant, type StorageAdapter, type StorageChangeEvent, type StructuredMultimodalInput, type StructuredMultimodalOutput, Tabs, TabsContent, TabsList, TabsTrigger, type TextCompletionInput, type TextCompletionOutput, type TextGenerationOptions, type TextGenerationState, Textarea, Timeline, TimelineConfig, TimelineItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TranscribeAudioOptions, type VisionMessageFormat, appendTranscriptionsToPrompt, arrayUtils, assertMultimodalCapableModel, assertValidAudioInput, assertValidImageInput, assertValidMultimodalMedia, assertVisionCapableModel, badgeVariants, base64ToBlob, buildMultimodalMessages, buttonVariants, callChat, callCompletion, callMultimodalChat, clearAiTasksForTest, cn, index as common, coreConnectivityTestTask, coreLlmCompletionTask, coreStructuredMultimodalTask, createLogger, debugUtils, detectVisionMessageFormat, ensureCoreAiTasksRegistered, errorUtils, extractJsonObject, fileToAiAudioInput, fileToAiImageInput, fileUtils, filterChatModels, filterSttModels, filterVisionModels, formatTime, getAiTask, isAudioInputError, isImageUrlVariantError, isKnownTextOnlyModel, isLikelyNativeAudioChatModel, isLikelySttModel, isLikelyVisionModel, japaneseUtils, listAiTasks, listOpenAiCompatibleModels, logger, mimeToAudioFormat, pickDefaultSttModel, pickDefaultVisionModel, registerAiTask, registerCoreAiTasks, requestJson, requireAiConnectionConfig, resetCoreAiTasksForTest, resolveAiConnectionConfig, resolveAudioHandling, runAiTask, splitMediaByKind, stringUtils, toVisionApiErrorMessage, transcribeAudio, transcribeAudios, useAsyncStorage, useBackgroundRemoval, useElectronStorage, useLocalStorage, useOCR, useSentimentAnalysis, useStorage, useTaroStorage, useTextGeneration, validators };
|
package/dist/index.d.ts
CHANGED
|
@@ -10974,6 +10974,14 @@ interface ConnectivityTestOutput {
|
|
|
10974
10974
|
ok: boolean;
|
|
10975
10975
|
reply: string;
|
|
10976
10976
|
}
|
|
10977
|
+
/** GET /api/ai/config 响应(宿主实现,不暴露 apiKey) */
|
|
10978
|
+
interface AiServerConfigStatus {
|
|
10979
|
+
serverConfigured: boolean;
|
|
10980
|
+
baseUrl?: string;
|
|
10981
|
+
visionModel?: string;
|
|
10982
|
+
textModel?: string;
|
|
10983
|
+
error?: string;
|
|
10984
|
+
}
|
|
10977
10985
|
interface AiModelsListRequest {
|
|
10978
10986
|
clientSettings?: AiClientSettings;
|
|
10979
10987
|
}
|
|
@@ -11201,4 +11209,4 @@ declare const coreStructuredMultimodalTask: AiTaskDefinition<StructuredMultimoda
|
|
|
11201
11209
|
|
|
11202
11210
|
declare const coreConnectivityTestTask: AiTaskDefinition<Record<string, never>, ConnectivityTestOutput>;
|
|
11203
11211
|
|
|
11204
|
-
export { type AiApiErrorBody, type AiApiErrorCode, type AiApiResponse, type AiApiResponseMeta, type AiApiRunRequest, type AiAudioInput, type AiAudioMediaInput, type AiClientSettings, type AiConnectionConfig, type AiConnectionSettings, type AiImageInput, type AiImageMediaInput, type AiMediaInput, type AiMediaKind, type AiModelsListRequest, type AiModelsListResponse, type AiTaskContext, type AiTaskDefinition, type AiTaskRunOptions, Dialog as AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, DialogDescription as AlertDialogDescription, DialogFooter as AlertDialogFooter, DialogHeader as AlertDialogHeader, DialogOverlay as AlertDialogOverlay, DialogPortal as AlertDialogPortal, DialogTitle as AlertDialogTitle, DialogTrigger as AlertDialogTrigger, type AudioStrategy, Avatar, AvatarFallback, AvatarImage, BackButton, type BackButtonProps, type BackgroundRemovalOptions, type BackgroundRemovalState, BackgroundRemover, Badge, type BadgeProps, Ball, Button, type ButtonProps, CORE_CONNECTIVITY_TEST_TASK_ID, CORE_LLM_COMPLETION_TASK_ID, CORE_STRUCTURED_MULTIMODAL_TASK_ID, type CallChatOptions, type CallChatResult, type CallCompletionParams, type CallCompletionResult, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatRole, type ChatUsage, CollisionBalls, CollisionBallsConfig, ConfirmModal, type ConfirmModalProps, type ConnectivityTestOutput, ConsoleLoggerAdapter, DEFAULT_OPENAI_BASE_URL, DEFAULT_TEXT_MODEL, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterButtonGroup, type FilterButtonGroupProps, type FilterOption, GenericOrderManager, type GenericOrderManagerProps, Grid, GridColumns, GridGap, GridItem, GridProps, type ImageMappingItem, ImageMappingPanel, type ImageMappingPanelProps, type ImageMappingValue, Input, type JsonRequestOptions, Label, type ListModelsResult, LocalImageMappingPanel, type LocalImageMappingPanelProps, type LogEntry, LogLevel, Logger, type LoggerAdapter, type LoggerConfig, Modal, type ModalProps, type MultimodalChatParams, type MultimodalChatResult, type OCROptions, type OCRResult, OCRScanner, type OCRState, type OrderManagerOperations, type OrderableItem, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, type ResolvedAudioHandling, ScrollArea, ScrollBar, SearchBox, SearchResultHint, type SearchResultHintProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SentimentAnalyzer, type SentimentOptions, type SentimentResult, type SentimentState, Separator, type SeparatorProps, Dialog as Sheet, DialogClose as SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, DialogOverlay as SheetOverlay, DialogPortal as SheetPortal, SheetTitle, DialogTrigger as SheetTrigger, SmartAssistant, type StorageAdapter, type StorageChangeEvent, type StructuredMultimodalInput, type StructuredMultimodalOutput, Tabs, TabsContent, TabsList, TabsTrigger, type TextCompletionInput, type TextCompletionOutput, type TextGenerationOptions, type TextGenerationState, Textarea, Timeline, TimelineConfig, TimelineItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TranscribeAudioOptions, type VisionMessageFormat, appendTranscriptionsToPrompt, arrayUtils, assertMultimodalCapableModel, assertValidAudioInput, assertValidImageInput, assertValidMultimodalMedia, assertVisionCapableModel, badgeVariants, base64ToBlob, buildMultimodalMessages, buttonVariants, callChat, callCompletion, callMultimodalChat, clearAiTasksForTest, cn, index as common, coreConnectivityTestTask, coreLlmCompletionTask, coreStructuredMultimodalTask, createLogger, debugUtils, detectVisionMessageFormat, ensureCoreAiTasksRegistered, errorUtils, extractJsonObject, fileToAiAudioInput, fileToAiImageInput, fileUtils, filterChatModels, filterSttModels, filterVisionModels, formatTime, getAiTask, isAudioInputError, isImageUrlVariantError, isKnownTextOnlyModel, isLikelyNativeAudioChatModel, isLikelySttModel, isLikelyVisionModel, japaneseUtils, listAiTasks, listOpenAiCompatibleModels, logger, mimeToAudioFormat, pickDefaultSttModel, pickDefaultVisionModel, registerAiTask, registerCoreAiTasks, requestJson, requireAiConnectionConfig, resetCoreAiTasksForTest, resolveAiConnectionConfig, resolveAudioHandling, runAiTask, splitMediaByKind, stringUtils, toVisionApiErrorMessage, transcribeAudio, transcribeAudios, useAsyncStorage, useBackgroundRemoval, useElectronStorage, useLocalStorage, useOCR, useSentimentAnalysis, useStorage, useTaroStorage, useTextGeneration, validators };
|
|
11212
|
+
export { type AiApiErrorBody, type AiApiErrorCode, type AiApiResponse, type AiApiResponseMeta, type AiApiRunRequest, type AiAudioInput, type AiAudioMediaInput, type AiClientSettings, type AiConnectionConfig, type AiConnectionSettings, type AiImageInput, type AiImageMediaInput, type AiMediaInput, type AiMediaKind, type AiModelsListRequest, type AiModelsListResponse, type AiServerConfigStatus, type AiTaskContext, type AiTaskDefinition, type AiTaskRunOptions, Dialog as AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, DialogDescription as AlertDialogDescription, DialogFooter as AlertDialogFooter, DialogHeader as AlertDialogHeader, DialogOverlay as AlertDialogOverlay, DialogPortal as AlertDialogPortal, DialogTitle as AlertDialogTitle, DialogTrigger as AlertDialogTrigger, type AudioStrategy, Avatar, AvatarFallback, AvatarImage, BackButton, type BackButtonProps, type BackgroundRemovalOptions, type BackgroundRemovalState, BackgroundRemover, Badge, type BadgeProps, Ball, Button, type ButtonProps, CORE_CONNECTIVITY_TEST_TASK_ID, CORE_LLM_COMPLETION_TASK_ID, CORE_STRUCTURED_MULTIMODAL_TASK_ID, type CallChatOptions, type CallChatResult, type CallCompletionParams, type CallCompletionResult, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatRole, type ChatUsage, CollisionBalls, CollisionBallsConfig, ConfirmModal, type ConfirmModalProps, type ConnectivityTestOutput, ConsoleLoggerAdapter, DEFAULT_OPENAI_BASE_URL, DEFAULT_TEXT_MODEL, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterButtonGroup, type FilterButtonGroupProps, type FilterOption, GenericOrderManager, type GenericOrderManagerProps, Grid, GridColumns, GridGap, GridItem, GridProps, type ImageMappingItem, ImageMappingPanel, type ImageMappingPanelProps, type ImageMappingValue, Input, type JsonRequestOptions, Label, type ListModelsResult, LocalImageMappingPanel, type LocalImageMappingPanelProps, type LogEntry, LogLevel, Logger, type LoggerAdapter, type LoggerConfig, Modal, type ModalProps, type MultimodalChatParams, type MultimodalChatResult, type OCROptions, type OCRResult, OCRScanner, type OCRState, type OrderManagerOperations, type OrderableItem, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, type ResolvedAudioHandling, ScrollArea, ScrollBar, SearchBox, SearchResultHint, type SearchResultHintProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SentimentAnalyzer, type SentimentOptions, type SentimentResult, type SentimentState, Separator, type SeparatorProps, Dialog as Sheet, DialogClose as SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, DialogOverlay as SheetOverlay, DialogPortal as SheetPortal, SheetTitle, DialogTrigger as SheetTrigger, SmartAssistant, type StorageAdapter, type StorageChangeEvent, type StructuredMultimodalInput, type StructuredMultimodalOutput, Tabs, TabsContent, TabsList, TabsTrigger, type TextCompletionInput, type TextCompletionOutput, type TextGenerationOptions, type TextGenerationState, Textarea, Timeline, TimelineConfig, TimelineItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TranscribeAudioOptions, type VisionMessageFormat, appendTranscriptionsToPrompt, arrayUtils, assertMultimodalCapableModel, assertValidAudioInput, assertValidImageInput, assertValidMultimodalMedia, assertVisionCapableModel, badgeVariants, base64ToBlob, buildMultimodalMessages, buttonVariants, callChat, callCompletion, callMultimodalChat, clearAiTasksForTest, cn, index as common, coreConnectivityTestTask, coreLlmCompletionTask, coreStructuredMultimodalTask, createLogger, debugUtils, detectVisionMessageFormat, ensureCoreAiTasksRegistered, errorUtils, extractJsonObject, fileToAiAudioInput, fileToAiImageInput, fileUtils, filterChatModels, filterSttModels, filterVisionModels, formatTime, getAiTask, isAudioInputError, isImageUrlVariantError, isKnownTextOnlyModel, isLikelyNativeAudioChatModel, isLikelySttModel, isLikelyVisionModel, japaneseUtils, listAiTasks, listOpenAiCompatibleModels, logger, mimeToAudioFormat, pickDefaultSttModel, pickDefaultVisionModel, registerAiTask, registerCoreAiTasks, requestJson, requireAiConnectionConfig, resetCoreAiTasksForTest, resolveAiConnectionConfig, resolveAudioHandling, runAiTask, splitMediaByKind, stringUtils, toVisionApiErrorMessage, transcribeAudio, transcribeAudios, useAsyncStorage, useBackgroundRemoval, useElectronStorage, useLocalStorage, useOCR, useSentimentAnalysis, useStorage, useTaroStorage, useTextGeneration, validators };
|
package/dist/index.js
CHANGED
|
@@ -33564,23 +33564,17 @@ var coreConnectivityTestTask = {
|
|
|
33564
33564
|
baseUrl: config.baseUrl,
|
|
33565
33565
|
apiKey: config.apiKey,
|
|
33566
33566
|
model: config.textModel,
|
|
33567
|
-
systemPrompt: "You are a connectivity probe. Reply
|
|
33568
|
-
userPrompt:
|
|
33567
|
+
systemPrompt: "You are a connectivity probe. Reply briefly.",
|
|
33568
|
+
userPrompt: "Say OK",
|
|
33569
33569
|
temperature: 0,
|
|
33570
33570
|
maxTokens: 32,
|
|
33571
33571
|
timeoutMs: config.timeoutMs
|
|
33572
33572
|
});
|
|
33573
|
-
let ok = false;
|
|
33574
33573
|
let reply = result.content.trim();
|
|
33575
33574
|
try {
|
|
33576
33575
|
const json2 = extractJsonObject(result.content);
|
|
33577
|
-
|
|
33578
|
-
reply = String(json2.reply ?? result.content).trim();
|
|
33576
|
+
reply = String(json2.reply ?? json2.message ?? result.content).trim();
|
|
33579
33577
|
} catch {
|
|
33580
|
-
ok = /ok/i.test(result.content);
|
|
33581
|
-
}
|
|
33582
|
-
if (!ok && !reply) {
|
|
33583
|
-
throw new Error("\u6A21\u578B\u672A\u8FD4\u56DE\u6709\u6548\u54CD\u5E94");
|
|
33584
33578
|
}
|
|
33585
33579
|
return {
|
|
33586
33580
|
data: { ok: true, reply: reply || "OK" },
|