feat: added local LLM context length option

This commit is contained in:
Xiaohan-Tian
2026-05-14 19:44:25 -07:00
parent dbf0c20542
commit a48966d761
13 changed files with 467 additions and 4 deletions
+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from 'vitest';
import {
formatLocalLLMContextLength,
LOCAL_LLM_DEFAULT_CONTEXT_LENGTH,
normalizeLocalLLMContextLength,
} from './localLLMConfig';
describe('localLLMConfig', () => {
it('defaults invalid context lengths to 32768', () => {
expect(normalizeLocalLLMContextLength(undefined)).toBe(LOCAL_LLM_DEFAULT_CONTEXT_LENGTH);
expect(normalizeLocalLLMContextLength(12345)).toBe(LOCAL_LLM_DEFAULT_CONTEXT_LENGTH);
});
it('formats context lengths using k suffixes', () => {
expect(formatLocalLLMContextLength(32768)).toBe('32k');
expect(formatLocalLLMContextLength(65536)).toBe('64k');
expect(formatLocalLLMContextLength(131072)).toBe('128k');
});
});