feat: add OpenAI OAuth, strict model overrides, and Gmail pull mode
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
import { createModelCommand } from './index.js';
|
||||
|
||||
describe('builtin /model command', () => {
|
||||
it('passes through the full argument string', async () => {
|
||||
const cmd = createModelCommand();
|
||||
const setModel = vi.fn(() => 'ok');
|
||||
|
||||
const result = await cmd.execute(['default', 'github/gpt-5-mini'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/model default github/gpt-5-mini',
|
||||
services: { setModel },
|
||||
});
|
||||
|
||||
expect(setModel).toHaveBeenCalledWith('default github/gpt-5-mini');
|
||||
expect(result).toEqual({ handled: true, text: 'ok' });
|
||||
});
|
||||
|
||||
it('still works for single-argument tier switching', async () => {
|
||||
const cmd = createModelCommand();
|
||||
const setModel = vi.fn(() => 'switched');
|
||||
|
||||
const result = await cmd.execute(['fast'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/model fast',
|
||||
services: { setModel },
|
||||
});
|
||||
|
||||
expect(setModel).toHaveBeenCalledWith('fast');
|
||||
expect(result).toEqual({ handled: true, text: 'switched' });
|
||||
});
|
||||
});
|
||||
@@ -86,7 +86,9 @@ export function createModelCommand(): CommandDefinition {
|
||||
|
||||
return {
|
||||
handled: true,
|
||||
text: await ctx.services.setModel(args[0]),
|
||||
// Pass through the full argument string so frontends can support
|
||||
// richer syntax like: /model <tier> <provider/model>
|
||||
text: await ctx.services.setModel(args.join(' ')),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user