fix(opencode): keep model switching runtime-hot
This commit is contained in:
@@ -341,6 +341,7 @@ describe('buildOpencodeRuntimeConfig', () => {
|
||||
});
|
||||
|
||||
it('routes imported Works Square models through the local AI proxy without gateway-token headers', async () => {
|
||||
const resolveApiKey = vi.fn().mockResolvedValue('stale-host-api-token');
|
||||
const result = await buildOpencodeRuntimeConfig({
|
||||
accounts: [
|
||||
createAccount({
|
||||
@@ -358,7 +359,8 @@ describe('buildOpencodeRuntimeConfig', () => {
|
||||
}),
|
||||
],
|
||||
defaultAccountId: 'niancode-user-models',
|
||||
resolveApiKey: vi.fn().mockResolvedValue('local-host-api-token'),
|
||||
resolveApiKey,
|
||||
localProxyApiKey: 'current-host-api-token',
|
||||
});
|
||||
|
||||
expect(result.config.provider['niancode-user-models'].options).toEqual({
|
||||
@@ -368,8 +370,9 @@ describe('buildOpencodeRuntimeConfig', () => {
|
||||
expect(JSON.stringify(result.config)).not.toContain('X-Works-Square-AI-Token');
|
||||
expect(JSON.stringify(result.config)).not.toContain('https://open-api.example.com');
|
||||
expect(result.env).toEqual({
|
||||
NIANCODE_OPENCODE_NIANCODE_USER_MODELS_API_KEY: 'local-host-api-token',
|
||||
NIANCODE_OPENCODE_NIANCODE_USER_MODELS_API_KEY: 'current-host-api-token',
|
||||
});
|
||||
expect(resolveApiKey).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('strips DeepSeek routing prefixes from imported Works Square runtime models', async () => {
|
||||
|
||||
Reference in New Issue
Block a user