@semalt-ai/code 1.1.0 → 1.3.0
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 +9 -0
- package/index.js +4 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -23,6 +23,13 @@ It provides an interactive chat interface, one-shot code generation, AI-assisted
|
|
|
23
23
|
|
|
24
24
|
The default configuration expects a local API server at `http://127.0.0.1:8800`.
|
|
25
25
|
|
|
26
|
+
The CLI accepts `api_base` in either of these forms:
|
|
27
|
+
|
|
28
|
+
- `http://127.0.0.1:8800`
|
|
29
|
+
- `http://127.0.0.1:8800/v1`
|
|
30
|
+
|
|
31
|
+
Both formats are normalized automatically.
|
|
32
|
+
|
|
26
33
|
## Installation
|
|
27
34
|
|
|
28
35
|
Install the package globally so the `semalt-code` command is available system-wide.
|
|
@@ -64,6 +71,8 @@ Example config:
|
|
|
64
71
|
}
|
|
65
72
|
```
|
|
66
73
|
|
|
74
|
+
You can also set `"api_base"` to a URL that already ends with `/v1`.
|
|
75
|
+
|
|
67
76
|
## Usage
|
|
68
77
|
|
|
69
78
|
```bash
|
package/index.js
CHANGED
|
@@ -418,7 +418,10 @@ class StreamRenderer {
|
|
|
418
418
|
// ── API Client ────────────────────────────────────────────────────────────────
|
|
419
419
|
|
|
420
420
|
function apiUrl(urlPath) {
|
|
421
|
-
|
|
421
|
+
const base = (config.api_base || '').replace(/\/$/, '');
|
|
422
|
+
const normalizedBase = /\/v1$/i.test(base) ? base : `${base}/v1`;
|
|
423
|
+
const normalizedPath = urlPath.startsWith('/v1/') ? urlPath.slice(3) : urlPath;
|
|
424
|
+
return `${normalizedBase}${normalizedPath}`;
|
|
422
425
|
}
|
|
423
426
|
|
|
424
427
|
function estimateTokens(text) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semalt-ai/code",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Self-hosted AI Coding Assistant CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"semalt-code": "./index.js"
|
|
7
|
+
"semalt-code": "./index.js",
|
|
8
|
+
"semalt": "./index.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"start": "node index.js"
|