Use Kimi turbo for report AI text
This commit is contained in:
@@ -111,7 +111,7 @@ describe('AiService', () => {
|
||||
expect(requestBody).not.toHaveProperty('frequency_penalty');
|
||||
});
|
||||
|
||||
it('uses the faster Moonshot text model for Kimi K2 text-only report prompts', async () => {
|
||||
it('uses the faster Kimi turbo text model for Kimi K2 text-only report prompts', async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(JSON.stringify({ choices: [{ message: { content: '{"reply":"已完善"}' } }] }), { status: 200 }),
|
||||
);
|
||||
@@ -125,9 +125,9 @@ describe('AiService', () => {
|
||||
const requestBody = JSON.parse(String(fetchMock.mock.calls[0][1]?.body));
|
||||
expect(requestBody).toMatchObject({
|
||||
messages: [{ role: 'user', content: '请继续完善手术步骤' }],
|
||||
model: 'moonshot-v1-32k',
|
||||
temperature: 0.3,
|
||||
model: 'kimi-k2-turbo-preview',
|
||||
});
|
||||
expect(requestBody).not.toHaveProperty('temperature');
|
||||
});
|
||||
|
||||
it('keeps an image-capable Kimi model for image prompts and removes unsupported sampling options', async () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ interface AiProvider {
|
||||
const RETRYABLE_PROVIDER_STATUSES = new Set([429, 500, 502, 503, 504]);
|
||||
const DEFAULT_RETRY_DELAYS_MS = [600, 1200];
|
||||
const DEFAULT_PROVIDER_TIMEOUT_MS = 45_000;
|
||||
const DEFAULT_KIMI_TEXT_MODEL = 'moonshot-v1-32k';
|
||||
const DEFAULT_KIMI_TEXT_MODEL = 'kimi-k2-turbo-preview';
|
||||
const DEFAULT_KIMI_VISION_MODEL = 'kimi-k2.6';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -20,7 +20,7 @@ export const DEMO_SYSTEM_SETTINGS = {
|
||||
kimi: {
|
||||
endpoint: 'https://api.moonshot.cn/v1',
|
||||
apiKey: DEMO_AI_API_KEY,
|
||||
modelName: 'moonshot-v1-32k',
|
||||
modelName: 'kimi-k2-turbo-preview',
|
||||
},
|
||||
deepseek: { endpoint: 'https://api.deepseek.com/v1', apiKey: '', modelName: 'deepseek-chat' },
|
||||
openai: { endpoint: 'https://api.openai.com/v1', apiKey: '', modelName: 'gpt-4o' },
|
||||
|
||||
@@ -13,7 +13,7 @@ import { PrismaService } from '../prisma/prisma.service.js';
|
||||
import { systemSettingsSchema, type SystemSettingsInput } from './settings.schemas.js';
|
||||
|
||||
const DEFAULT_AI_PROVIDERS = {
|
||||
kimi: { endpoint: 'https://api.moonshot.cn/v1', apiKey: DEMO_SYSTEM_SETTINGS.aiProviders.kimi.apiKey, modelName: 'moonshot-v1-32k' },
|
||||
kimi: { endpoint: 'https://api.moonshot.cn/v1', apiKey: DEMO_SYSTEM_SETTINGS.aiProviders.kimi.apiKey, modelName: 'kimi-k2-turbo-preview' },
|
||||
deepseek: { endpoint: 'https://api.deepseek.com/v1', apiKey: '', modelName: 'deepseek-chat' },
|
||||
openai: { endpoint: 'https://api.openai.com/v1', apiKey: '', modelName: 'gpt-4o' },
|
||||
custom: { endpoint: '', apiKey: '', modelName: '' },
|
||||
|
||||
@@ -1334,7 +1334,7 @@ export default function ReportEditor() {
|
||||
try {
|
||||
const settings = storage.get<SystemSettings>('systemSettings', {} as SystemSettings);
|
||||
const provider = settings.aiProviders?.[settings.activeAiProvider || 'kimi'];
|
||||
const modelName = provider?.modelName || 'moonshot-v1-32k';
|
||||
const modelName = provider?.modelName || 'kimi-k2-turbo-preview';
|
||||
let actualTargetId = aiTargetRegion;
|
||||
if (aiModifyEnabled && actualTargetId === 'none') {
|
||||
const availableRegions = checkAiRegions();
|
||||
|
||||
@@ -96,7 +96,7 @@ export default function SystemSettings() {
|
||||
providers.kimi = {
|
||||
endpoint: (savedSettings as any).kimiApiEndpoint || providers.kimi.endpoint,
|
||||
apiKey: (savedSettings as any).kimiApiKey || '',
|
||||
modelName: 'moonshot-v1-32k'
|
||||
modelName: 'kimi-k2-turbo-preview'
|
||||
};
|
||||
}
|
||||
savedSettings.aiProviders = providers;
|
||||
|
||||
@@ -112,7 +112,7 @@ export interface SystemSettings {
|
||||
}
|
||||
|
||||
export const DEFAULT_AI_PROVIDERS: Record<string, AiProviderConfig> = {
|
||||
kimi: { endpoint: 'https://api.moonshot.cn/v1', apiKey: '', modelName: 'moonshot-v1-32k' },
|
||||
kimi: { endpoint: 'https://api.moonshot.cn/v1', apiKey: '', modelName: 'kimi-k2-turbo-preview' },
|
||||
deepseek: { endpoint: 'https://api.deepseek.com/v1', apiKey: '', modelName: 'deepseek-chat' },
|
||||
openai: { endpoint: 'https://api.openai.com/v1', apiKey: '', modelName: 'gpt-4o' },
|
||||
custom: { endpoint: '', apiKey: '', modelName: '' }
|
||||
|
||||
Reference in New Issue
Block a user