fix(desktop): expose Codex compression auto-raise
This commit is contained in:
@@ -62,14 +62,14 @@ afterEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
function renderConfigSettings() {
|
||||
function renderConfigSettings(activeSectionId = 'safety') {
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
||||
const importInputRef = createRef<HTMLInputElement>()
|
||||
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<QueryClientProvider client={client}>
|
||||
<ConfigSettings activeSectionId="safety" importInputRef={importInputRef} />
|
||||
<ConfigSettings activeSectionId={activeSectionId} importInputRef={importInputRef} />
|
||||
</QueryClientProvider>
|
||||
</MemoryRouter>
|
||||
)
|
||||
@@ -78,6 +78,35 @@ function renderConfigSettings() {
|
||||
}
|
||||
|
||||
describe('ConfigSettings autosave', () => {
|
||||
it('renders and saves the Codex compression auto-raise setting', async () => {
|
||||
getHermesConfigRecord.mockResolvedValue({
|
||||
compression: { codex_gpt55_autoraise: true }
|
||||
})
|
||||
getHermesConfigSchema.mockResolvedValue({
|
||||
fields: {
|
||||
'compression.codex_gpt55_autoraise': { type: 'boolean' }
|
||||
}
|
||||
})
|
||||
|
||||
vi.useFakeTimers({ shouldAdvanceTime: true })
|
||||
|
||||
try {
|
||||
renderConfigSettings('memory')
|
||||
|
||||
expect(await screen.findByText('Codex Compression Auto-Raise')).toBeTruthy()
|
||||
expect(screen.getByText('Raise compression to 85% for supported ChatGPT Codex OAuth models.')).toBeTruthy()
|
||||
|
||||
screen.getByRole('switch').click()
|
||||
await vi.advanceTimersByTimeAsync(700)
|
||||
|
||||
await vi.waitFor(() =>
|
||||
expect(saveHermesConfig).toHaveBeenCalledWith({ compression: { codex_gpt55_autoraise: false } }, undefined)
|
||||
)
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
|
||||
it('sends a later revert instead of diffing it away against the stale page-load baseline', async () => {
|
||||
getHermesConfigRecord.mockResolvedValue({ checkpoints: { enabled: false }, other: 'untouched' })
|
||||
|
||||
|
||||
@@ -552,6 +552,7 @@ export const FIELD_LABELS: Record<string, string> = defineFieldCopy({
|
||||
compression: {
|
||||
enabled: 'Auto-Compression',
|
||||
threshold: 'Compression Threshold',
|
||||
codexGpt55Autoraise: 'Codex Compression Auto-Raise',
|
||||
targetRatio: 'Compression Target',
|
||||
protectLastN: 'Protected Recent Messages'
|
||||
},
|
||||
@@ -621,7 +622,8 @@ export const FIELD_DESCRIPTIONS: Record<string, string> = defineFieldCopy({
|
||||
engine: 'Strategy for managing long conversations near the context limit.'
|
||||
},
|
||||
compression: {
|
||||
enabled: 'Summarize older context when conversations get large.'
|
||||
enabled: 'Summarize older context when conversations get large.',
|
||||
codexGpt55Autoraise: 'Raise compression to 85% for supported ChatGPT Codex OAuth models.'
|
||||
},
|
||||
voice: {
|
||||
autoTts: 'Automatically speak assistant responses.',
|
||||
@@ -728,6 +730,7 @@ export const SECTIONS: DesktopConfigSection[] = [
|
||||
'context.engine',
|
||||
'compression.enabled',
|
||||
'compression.threshold',
|
||||
'compression.codex_gpt55_autoraise',
|
||||
'compression.target_ratio',
|
||||
'compression.protect_last_n'
|
||||
]
|
||||
|
||||
@@ -733,6 +733,7 @@ export const ar = defineLocale({
|
||||
'context.engine': 'محرك السياق',
|
||||
'compression.enabled': 'الضغط التلقائي',
|
||||
'compression.threshold': 'عتبة الضغط',
|
||||
'compression.codexGpt55Autoraise': 'الرفع التلقائي لضغط Codex',
|
||||
'compression.targetRatio': 'هدف الضغط',
|
||||
'compression.protectLastN': 'الرسائل الأخيرة المحمية',
|
||||
'delegation.model': 'نموذج الوكيل الفرعي',
|
||||
@@ -769,6 +770,7 @@ export const ar = defineLocale({
|
||||
'memory.userProfileEnabled': 'يحافظ على ملف مختصر لتفضيلات المستخدم.',
|
||||
'context.engine': 'استراتيجية إدارة المحادثات الطويلة قرب حد السياق.',
|
||||
'compression.enabled': 'يلخص السياق الأقدم عندما تكبر المحادثات.',
|
||||
'compression.codexGpt55Autoraise': 'يرفع عتبة الضغط إلى 85٪ لنماذج ChatGPT Codex OAuth المدعومة.',
|
||||
'voice.autoTts': 'ينطق ردود المساعد تلقائياً.',
|
||||
'tts.xai.voiceId': 'معرف صوت xAI مثل eve أو معرف صوت مخصص.',
|
||||
'tts.xai.language': 'رمز لغة النطق، مثل en.',
|
||||
|
||||
@@ -774,6 +774,7 @@ export const ja = defineLocale({
|
||||
compression: {
|
||||
enabled: '自動圧縮',
|
||||
threshold: '圧縮しきい値',
|
||||
codexGpt55Autoraise: 'Codex 圧縮の自動引き上げ',
|
||||
targetRatio: '圧縮目標',
|
||||
protectLastN: '保護する直近メッセージ'
|
||||
},
|
||||
@@ -835,7 +836,8 @@ export const ja = defineLocale({
|
||||
engine: '長い会話がコンテキスト上限に近づいたときの管理戦略です。'
|
||||
},
|
||||
compression: {
|
||||
enabled: '会話が大きくなったとき、古いコンテキストを要約します。'
|
||||
enabled: '会話が大きくなったとき、古いコンテキストを要約します。',
|
||||
codexGpt55Autoraise: '対応する ChatGPT Codex OAuth モデルの圧縮しきい値を 85% に引き上げます。'
|
||||
},
|
||||
voice: {
|
||||
autoTts: 'アシスタントの応答を自動で読み上げます。'
|
||||
|
||||
@@ -838,6 +838,7 @@ export const ru = defineLocale({
|
||||
compression: {
|
||||
enabled: 'Авто-сжатие',
|
||||
threshold: 'Порог сжатия',
|
||||
codexGpt55Autoraise: 'Автоповышение сжатия Codex',
|
||||
targetRatio: 'Целевое сжатие',
|
||||
protectLastN: 'Защищённые недавние сообщения'
|
||||
},
|
||||
@@ -903,7 +904,8 @@ export const ru = defineLocale({
|
||||
engine: 'Стратегия управления длинными диалогами у предела контекста.'
|
||||
},
|
||||
compression: {
|
||||
enabled: 'Сжимать более старый контекст, когда диалоги становятся большими.'
|
||||
enabled: 'Сжимать более старый контекст, когда диалоги становятся большими.',
|
||||
codexGpt55Autoraise: 'Повышает порог сжатия до 85% для поддерживаемых моделей ChatGPT Codex OAuth.'
|
||||
},
|
||||
voice: {
|
||||
autoTts: 'Автоматически зачитывать ответы ассистента.'
|
||||
|
||||
@@ -761,6 +761,7 @@ export const zhHant = defineLocale({
|
||||
compression: {
|
||||
enabled: '自動壓縮',
|
||||
threshold: '壓縮閾值',
|
||||
codexGpt55Autoraise: 'Codex 壓縮自動提高',
|
||||
targetRatio: '壓縮目標',
|
||||
protectLastN: '保護最近訊息'
|
||||
},
|
||||
@@ -825,7 +826,8 @@ export const zhHant = defineLocale({
|
||||
engine: '長對話接近上下文上限時的管理策略。'
|
||||
},
|
||||
compression: {
|
||||
enabled: '對話變大時摘要較早的上下文。'
|
||||
enabled: '對話變大時摘要較早的上下文。',
|
||||
codexGpt55Autoraise: '為支援的 ChatGPT Codex OAuth 模型將壓縮閾值提高到 85%。'
|
||||
},
|
||||
browser: {
|
||||
useRealProfile:
|
||||
|
||||
@@ -965,6 +965,7 @@ export const zh = defineLocale({
|
||||
compression: {
|
||||
enabled: '自动压缩',
|
||||
threshold: '压缩阈值',
|
||||
codexGpt55Autoraise: 'Codex 压缩自动提高',
|
||||
targetRatio: '压缩目标',
|
||||
protectLastN: '保护最近消息'
|
||||
},
|
||||
@@ -1029,7 +1030,8 @@ export const zh = defineLocale({
|
||||
engine: '在接近上下文上限时管理长对话的策略。'
|
||||
},
|
||||
compression: {
|
||||
enabled: '当对话变大时对较早的上下文进行摘要。'
|
||||
enabled: '当对话变大时对较早的上下文进行摘要。',
|
||||
codexGpt55Autoraise: '为受支持的 ChatGPT Codex OAuth 模型将压缩阈值提高到 85%。'
|
||||
},
|
||||
browser: {
|
||||
useRealProfile:
|
||||
|
||||
Reference in New Issue
Block a user