@vtstech/pi-api 1.1.7 → 1.1.8
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/api.js +1 -18
- package/package.json +2 -2
package/api.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// .build-npm/api/api.temp.ts
|
|
2
|
-
import * as fs from "node:fs";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import os from "node:os";
|
|
5
2
|
import { section, ok, info, warn } from "@vtstech/pi-shared/format";
|
|
6
3
|
import { readModelsJson, writeModelsJson, getOllamaBaseUrl, BUILTIN_PROVIDERS, EXTENSION_VERSION } from "@vtstech/pi-shared/ollama";
|
|
4
|
+
import { SETTINGS_PATH, readSettings, writeSettings } from "@vtstech/pi-shared/config-io";
|
|
7
5
|
var API_MODES = {
|
|
8
6
|
"anthropic-messages": "Anthropic Claude API and compatibles",
|
|
9
7
|
"openai-completions": "OpenAI Chat Completions API and compatibles",
|
|
@@ -38,21 +36,6 @@ var COMPAT_FLAGS = {
|
|
|
38
36
|
values: ["qwen", "deepseek", "default"]
|
|
39
37
|
}
|
|
40
38
|
};
|
|
41
|
-
var SETTINGS_PATH = path.join(os.homedir(), ".pi", "agent", "settings.json");
|
|
42
|
-
function readSettings() {
|
|
43
|
-
try {
|
|
44
|
-
if (fs.existsSync(SETTINGS_PATH)) {
|
|
45
|
-
return JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
|
|
46
|
-
}
|
|
47
|
-
} catch {
|
|
48
|
-
}
|
|
49
|
-
return {};
|
|
50
|
-
}
|
|
51
|
-
function writeSettings(data) {
|
|
52
|
-
const dir = path.dirname(SETTINGS_PATH);
|
|
53
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
54
|
-
fs.writeFileSync(SETTINGS_PATH, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
55
|
-
}
|
|
56
39
|
function getLocalProvider(config) {
|
|
57
40
|
for (const [name, provider] of Object.entries(config.providers)) {
|
|
58
41
|
const url = provider.baseUrl || "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtstech/pi-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "API Mode Switcher extension for Pi Coding Agent",
|
|
5
5
|
"main": "api.js",
|
|
6
6
|
"keywords": ["pi-extensions"],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/VTSTech/pi-coding-agent"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vtstech/pi-shared": "1.1.
|
|
17
|
+
"@vtstech/pi-shared": "1.1.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mariozechner/pi-coding-agent": ">=0.66"
|