feat(ai): add Qoder CLI provider
This commit is contained in:
1 parent
da6e2738ce
commit
c72b429899
38 files changed
+1100
-19
No files matched your search
@@ -166,6 +166,30 @@ describe("useAiModelCatalog", () => {
|
||||
expect(apiMock.aiListModels).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("tracks Qoder executable and environment changes without depending on environment key order", async () => {
|
||||
const initial: AiConfigItem = {
|
||||
...config(),
|
||||
provider: "qoder-cli",
|
||||
endpoint: "",
|
||||
apiKey: "",
|
||||
model: "default",
|
||||
qoderCliPath: "/opt/homebrew/bin/qodercli",
|
||||
qoderCliEnv: { HTTPS_PROXY: "http://127.0.0.1:7890", NO_PROXY: "localhost" },
|
||||
};
|
||||
apiMock.aiListModels.mockResolvedValueOnce([{ id: "first" }]).mockResolvedValueOnce([{ id: "second" }]);
|
||||
|
||||
await expect(catalog.loadModels(initial)).resolves.toEqual([{ id: "first" }]);
|
||||
await expect(
|
||||
catalog.loadModels({
|
||||
...initial,
|
||||
qoderCliEnv: { NO_PROXY: "localhost", HTTPS_PROXY: "http://127.0.0.1:7890" },
|
||||
}),
|
||||
).resolves.toEqual([{ id: "first" }]);
|
||||
await expect(catalog.loadModels({ ...initial, qoderCliPath: "/usr/local/bin/qodercli" })).resolves.toEqual([{ id: "second" }]);
|
||||
|
||||
expect(apiMock.aiListModels).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("does not let a stale request overwrite a newer provider catalog", async () => {
|
||||
let resolveInitial: ((models: { id: string }[]) => void) | undefined;
|
||||
apiMock.aiListModels
|
||||
|
||||
@@ -60,6 +60,7 @@ function configSignature(config: AiConfigItem): string {
|
||||
opencodeCliPath: config.opencodeCliPath ?? null,
|
||||
cursorCliPath: config.cursorCliPath ?? null,
|
||||
codebuddyCliPath: config.codebuddyCliPath ?? null,
|
||||
qoderCliPath: config.qoderCliPath ?? null,
|
||||
connectionFingerprint: fingerprint(
|
||||
JSON.stringify({
|
||||
apiKey: config.apiKey,
|
||||
@@ -71,6 +72,7 @@ function configSignature(config: AiConfigItem): string {
|
||||
opencodeCliEnv: sortedRecord(config.opencodeCliEnv),
|
||||
cursorCliEnv: sortedRecord(config.cursorCliEnv),
|
||||
codebuddyCliEnv: sortedRecord(config.codebuddyCliEnv),
|
||||
qoderCliEnv: sortedRecord(config.qoderCliEnv),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user