seacloud-sdk 0.11.10 → 0.12.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/README.md +3 -3
- package/dist/cli.js +6 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ import { initSeacloud, agentChatCompletions, createTextMessage } from 'seacloud-
|
|
|
28
28
|
initSeacloud({
|
|
29
29
|
apiKey: 'your-api-key',
|
|
30
30
|
baseUrl: 'https://proxy-rs.seaverse.ai',
|
|
31
|
-
xProject: '
|
|
31
|
+
xProject: 'SeaVerse', // Optional, defaults to 'SeaVerse'
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
|
@@ -84,10 +84,10 @@ for await (const chunk of stream) {
|
|
|
84
84
|
The `xProject` parameter sets the `X-Project` request header to identify the source project. Different projects may have different quotas and permissions:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
//
|
|
87
|
+
// SeaVerse project
|
|
88
88
|
initSeacloud({
|
|
89
89
|
apiKey: 'your-api-key',
|
|
90
|
-
xProject: '
|
|
90
|
+
xProject: 'SeaVerse',
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
// KIIRA project
|
package/dist/cli.js
CHANGED
|
@@ -336,8 +336,9 @@ async function llmChatCompletions(params) {
|
|
|
336
336
|
const config = client.getConfig();
|
|
337
337
|
const url = `${config.baseUrl}/llm/chat/completions`;
|
|
338
338
|
const token = await getApiToken(config.apiKey);
|
|
339
|
+
const timeoutMs = params.timeout ?? config.timeout;
|
|
339
340
|
const controller = new AbortController();
|
|
340
|
-
const timeoutId = setTimeout(() => controller.abort(),
|
|
341
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
341
342
|
try {
|
|
342
343
|
const response = await config.fetch(url, {
|
|
343
344
|
method: "POST",
|
|
@@ -368,7 +369,7 @@ async function llmChatCompletions(params) {
|
|
|
368
369
|
throw error;
|
|
369
370
|
}
|
|
370
371
|
if (error.name === "AbortError") {
|
|
371
|
-
throw new SeacloudError(`Request timeout after ${
|
|
372
|
+
throw new SeacloudError(`Request timeout after ${timeoutMs}ms`);
|
|
372
373
|
}
|
|
373
374
|
throw new SeacloudError(
|
|
374
375
|
`Request failed: ${error.message}`,
|
|
@@ -426,8 +427,9 @@ async function agentChatCompletions(params) {
|
|
|
426
427
|
stream: true
|
|
427
428
|
// Always request SSE from API
|
|
428
429
|
};
|
|
430
|
+
const timeoutMs = params.timeout ?? config.timeout;
|
|
429
431
|
const controller = new AbortController();
|
|
430
|
-
const timeoutId = setTimeout(() => controller.abort(),
|
|
432
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
431
433
|
try {
|
|
432
434
|
const headers = {
|
|
433
435
|
"Content-Type": "application/json",
|
|
@@ -461,7 +463,7 @@ async function agentChatCompletions(params) {
|
|
|
461
463
|
throw error;
|
|
462
464
|
}
|
|
463
465
|
if (error.name === "AbortError") {
|
|
464
|
-
throw new SeacloudError(`Request timeout after ${
|
|
466
|
+
throw new SeacloudError(`Request timeout after ${timeoutMs}ms`);
|
|
465
467
|
}
|
|
466
468
|
throw new SeacloudError(
|
|
467
469
|
`Request failed: ${error.message}`,
|