pi-llama-cpp 0.5.0 → 0.5.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/package.json +1 -1
- package/src/manager.ts +3 -0
- package/src/tools/resolver.ts +3 -8
- package/tests/commandManager.test.ts +2 -1
package/package.json
CHANGED
package/src/manager.ts
CHANGED
|
@@ -72,6 +72,9 @@ export class CommandManager {
|
|
|
72
72
|
return await notFoundCommand(ctx);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// Refresh the model list from the server
|
|
76
|
+
await this.update();
|
|
77
|
+
|
|
75
78
|
// Command: `/models info`
|
|
76
79
|
if (args === "info") {
|
|
77
80
|
const info = await Promise.all(this.serverModels.map((m) => m.getInfo()));
|
package/src/tools/resolver.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
1
2
|
import { access, constants, readFile } from "node:fs/promises";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import {
|
|
@@ -59,7 +60,7 @@ const readConfigValue = async <T>(
|
|
|
59
60
|
* @returns The API key, as defined by the auth.json file
|
|
60
61
|
*/
|
|
61
62
|
export const resolveApiKey = async (): Promise<string> => {
|
|
62
|
-
const authPath = join(
|
|
63
|
+
const authPath = join(getAgentDir(), "settings.json");
|
|
63
64
|
if (!(await fileExists(authPath))) return API_KEY_PLACEHOLDER;
|
|
64
65
|
|
|
65
66
|
const cfg = await readConfigValue<AuthFile>(authPath, PROVIDER_ID);
|
|
@@ -71,13 +72,7 @@ export const resolveApiKey = async (): Promise<string> => {
|
|
|
71
72
|
* @returns The URL, if found.
|
|
72
73
|
*/
|
|
73
74
|
const resolveGlobalUrl = async (): Promise<string | null> => {
|
|
74
|
-
const globalPath = join(
|
|
75
|
-
process.env.HOME || ".",
|
|
76
|
-
".pi",
|
|
77
|
-
"agent",
|
|
78
|
-
"settings.json",
|
|
79
|
-
);
|
|
80
|
-
|
|
75
|
+
const globalPath = join(getAgentDir(), "settings.json");
|
|
81
76
|
if (!(await fileExists(globalPath))) return null;
|
|
82
77
|
|
|
83
78
|
return readConfigValue<Record<string, string>>(globalPath, "llamaServerUrl");
|
|
@@ -95,7 +95,8 @@ describe("CommandManager", () => {
|
|
|
95
95
|
} as any);
|
|
96
96
|
|
|
97
97
|
expect(notifyFn).toHaveBeenCalledWith("Model info for test-model", "info");
|
|
98
|
-
|
|
98
|
+
// Called once in initialize() and once in run() to refresh the model list
|
|
99
|
+
expect(listModels).toHaveBeenCalledTimes(2);
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
it("should unload all models when args is 'unload'", async () => {
|