@openloaf-saas/sdk 0.1.35 → 0.1.37
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/index.d.ts +22 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -757,6 +757,7 @@ declare class SaaSContract {
|
|
|
757
757
|
inputs?: Record<string, unknown> | undefined;
|
|
758
758
|
params?: Record<string, unknown> | undefined;
|
|
759
759
|
count?: number | undefined;
|
|
760
|
+
stream?: boolean | undefined;
|
|
760
761
|
}, {
|
|
761
762
|
success: true;
|
|
762
763
|
data: {
|
|
@@ -1277,6 +1278,8 @@ type BaseSaaSClientOptions<TContract> = {
|
|
|
1277
1278
|
fetcher?: typeof fetch;
|
|
1278
1279
|
headers?: HeaderInput;
|
|
1279
1280
|
contract: TContract;
|
|
1281
|
+
/** Default locale for APIs that support i18n (e.g. "zh-CN", "en-US"). */
|
|
1282
|
+
locale?: string;
|
|
1280
1283
|
};
|
|
1281
1284
|
declare class BaseSaaSClient<TContract> {
|
|
1282
1285
|
/** Contract definitions used by the client. */
|
|
@@ -1289,6 +1292,8 @@ declare class BaseSaaSClient<TContract> {
|
|
|
1289
1292
|
private readonly fetcher;
|
|
1290
1293
|
/** Static headers injected into every request. */
|
|
1291
1294
|
private readonly headers?;
|
|
1295
|
+
/** Default locale for i18n-aware APIs. */
|
|
1296
|
+
private locale?;
|
|
1292
1297
|
/** Create a base client instance. */
|
|
1293
1298
|
constructor(options: BaseSaaSClientOptions<TContract>);
|
|
1294
1299
|
/** Send a typed request to the SaaS server. */
|
|
@@ -1301,6 +1306,10 @@ declare class BaseSaaSClient<TContract> {
|
|
|
1301
1306
|
buildAuthHeader(): Promise<Record<string, string>>;
|
|
1302
1307
|
/** Return the configured base URL. */
|
|
1303
1308
|
getBaseUrl(): string;
|
|
1309
|
+
/** Return the configured default locale. */
|
|
1310
|
+
getLocale(): string | undefined;
|
|
1311
|
+
/** Update the default locale at runtime. */
|
|
1312
|
+
setLocale(locale: string | undefined): void;
|
|
1304
1313
|
}
|
|
1305
1314
|
|
|
1306
1315
|
/** Request function signature shared by SDK clients. */
|
|
@@ -1319,6 +1328,8 @@ type SdkHost<TContract> = {
|
|
|
1319
1328
|
getBaseUrl: () => string;
|
|
1320
1329
|
/** Build Authorization header for authenticated calls. */
|
|
1321
1330
|
buildAuthHeader: () => Promise<Record<string, string>>;
|
|
1331
|
+
/** Resolve the configured default locale (e.g. "zh-CN"). */
|
|
1332
|
+
getLocale: () => string | undefined;
|
|
1322
1333
|
};
|
|
1323
1334
|
|
|
1324
1335
|
declare const aiEndpoints: {
|
|
@@ -2045,6 +2056,7 @@ declare const aiEndpoints: {
|
|
|
2045
2056
|
inputs?: Record<string, unknown> | undefined;
|
|
2046
2057
|
params?: Record<string, unknown> | undefined;
|
|
2047
2058
|
count?: number | undefined;
|
|
2059
|
+
stream?: boolean | undefined;
|
|
2048
2060
|
}, {
|
|
2049
2061
|
success: true;
|
|
2050
2062
|
data: {
|
|
@@ -3709,6 +3721,7 @@ declare const v3GenerateRequestSchema: z.ZodObject<{
|
|
|
3709
3721
|
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3710
3722
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3711
3723
|
count: z.ZodOptional<z.ZodNumber>;
|
|
3724
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
3712
3725
|
}, z.core.$strip>;
|
|
3713
3726
|
/** v3 text generate request body. */
|
|
3714
3727
|
declare const v3TextGenerateRequestSchema: z.ZodObject<{
|
|
@@ -4676,6 +4689,13 @@ declare class AiClient {
|
|
|
4676
4689
|
taskIds: string[];
|
|
4677
4690
|
};
|
|
4678
4691
|
}>;
|
|
4692
|
+
/**
|
|
4693
|
+
* Submit a v3 generate request in streaming mode.
|
|
4694
|
+
* 返回原始 Response,调用方通过 response.body (ReadableStream) 消费 SSE 事件。
|
|
4695
|
+
* 每个 SSE event 的 data 字段是 OpenAI chat completions chunk 格式。
|
|
4696
|
+
* taskId 通过响应头 x-task-id 返回。
|
|
4697
|
+
*/
|
|
4698
|
+
v3GenerateStream(payload: Omit<V3GenerateRequest, "stream" | "count">): Promise<Response>;
|
|
4679
4699
|
/** Get v3 task details by ID. */
|
|
4680
4700
|
v3Task(taskId: string): Promise<{
|
|
4681
4701
|
success: true;
|
|
@@ -7113,6 +7133,8 @@ declare class SkillMarketClient {
|
|
|
7113
7133
|
constructor(sdk: SkillMarketSdkHost);
|
|
7114
7134
|
/** Build URL query string from params (skip undefined/null values). */
|
|
7115
7135
|
private buildQuery;
|
|
7136
|
+
/** Resolve effective lang: explicit param > global locale > undefined (server default). */
|
|
7137
|
+
private resolveLang;
|
|
7116
7138
|
/**
|
|
7117
7139
|
* List marketplace skills with optional filters.
|
|
7118
7140
|
* @remarks Public endpoint — no authentication required.
|