feat: refine codex live chat flow

This commit is contained in:
2026-04-24 21:02:01 +09:00
parent d53532508b
commit 63e5d263a7
18 changed files with 1747 additions and 297 deletions

View File

@@ -18,6 +18,7 @@ export type AppConfig = {
chat: {
maxContextMessages: number;
maxContextChars: number;
codexLiveMaxExecutionSeconds: number;
};
automation: {
autoRefreshEnabled: boolean;
@@ -70,6 +71,7 @@ export const DEFAULT_APP_CONFIG: AppConfig = {
chat: {
maxContextMessages: 12,
maxContextChars: 3200,
codexLiveMaxExecutionSeconds: 600,
},
automation: {
autoRefreshEnabled: true,
@@ -243,6 +245,14 @@ function normalizeChatContextCharLimit(value: number | undefined, fallback: numb
return Math.min(20_000, Math.max(500, Math.round(value)));
}
function normalizeCodexLiveMaxExecutionSeconds(value: number | undefined, fallback: number) {
if (value === undefined || !Number.isFinite(value)) {
return fallback;
}
return Math.min(7200, Math.max(60, Math.round(value)));
}
function normalizeConfig(raw?: Partial<AppConfig>): AppConfig {
const chat = raw?.chat;
const automation = raw?.automation;
@@ -258,6 +268,10 @@ function normalizeConfig(raw?: Partial<AppConfig>): AppConfig {
DEFAULT_APP_CONFIG.chat.maxContextMessages,
),
maxContextChars: normalizeChatContextCharLimit(chat?.maxContextChars, DEFAULT_APP_CONFIG.chat.maxContextChars),
codexLiveMaxExecutionSeconds: normalizeCodexLiveMaxExecutionSeconds(
chat?.codexLiveMaxExecutionSeconds,
DEFAULT_APP_CONFIG.chat.codexLiveMaxExecutionSeconds,
),
},
automation: {
autoRefreshEnabled: automation?.autoRefreshEnabled ?? DEFAULT_APP_CONFIG.automation.autoRefreshEnabled,