@semalt-ai/code 1.4.0 → 1.4.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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/index.js +5 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -67,6 +67,7 @@ Example config:
67
67
  "default_model": "default",
68
68
  "temperature": 0.7,
69
69
  "max_tokens": 4096,
70
+ "request_timeout_ms": 900000,
70
71
  "stream": true
71
72
  }
72
73
  ```
package/index.js CHANGED
@@ -12,6 +12,8 @@ const { URL } = require('url');
12
12
 
13
13
  const PACKAGE_JSON = require('./package.json');
14
14
 
15
+ const DEFAULT_API_TIMEOUT_MS = 15 * 60 * 1000;
16
+
15
17
  // ── Config ────────────────────────────────────────────────────────────────────
16
18
 
17
19
  const DEFAULT_CONFIG = {
@@ -20,6 +22,7 @@ const DEFAULT_CONFIG = {
20
22
  default_model: 'default',
21
23
  temperature: 0.7,
22
24
  max_tokens: 4096,
25
+ request_timeout_ms: DEFAULT_API_TIMEOUT_MS,
23
26
  stream: true,
24
27
  models: [],
25
28
  };
@@ -538,6 +541,7 @@ async function chatStream(messages, { model, temperature, maxTokens } = {}) {
538
541
  try {
539
542
  res = await httpRequest(apiUrl('/v1/chat/completions'), {
540
543
  method: 'POST',
544
+ timeout: config.request_timeout_ms,
541
545
  headers: {
542
546
  'Content-Type': 'application/json',
543
547
  'Authorization': `Bearer ${config.api_key}`,
@@ -639,6 +643,7 @@ async function chatSync(messages, { model } = {}) {
639
643
  try {
640
644
  res = await httpRequest(apiUrl('/v1/chat/completions'), {
641
645
  method: 'POST',
646
+ timeout: config.request_timeout_ms,
642
647
  headers: {
643
648
  'Content-Type': 'application/json',
644
649
  'Authorization': `Bearer ${config.api_key}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semalt-ai/code",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Self-hosted AI Coding Assistant CLI",
5
5
  "main": "index.js",
6
6
  "bin": {