chore: update live chat and work server changes
This commit is contained in:
@@ -19,6 +19,8 @@ export type AppConfig = {
|
||||
maxContextMessages: number;
|
||||
maxContextChars: number;
|
||||
codexLiveMaxExecutionSeconds: number;
|
||||
codexLiveIdleTimeoutSeconds: number;
|
||||
receiveRoomNotifications: boolean;
|
||||
};
|
||||
automation: {
|
||||
autoRefreshEnabled: boolean;
|
||||
@@ -72,6 +74,8 @@ export const DEFAULT_APP_CONFIG: AppConfig = {
|
||||
maxContextMessages: 12,
|
||||
maxContextChars: 3200,
|
||||
codexLiveMaxExecutionSeconds: 600,
|
||||
codexLiveIdleTimeoutSeconds: 180,
|
||||
receiveRoomNotifications: true,
|
||||
},
|
||||
automation: {
|
||||
autoRefreshEnabled: true,
|
||||
@@ -253,6 +257,22 @@ function normalizeCodexLiveMaxExecutionSeconds(value: number | undefined, fallba
|
||||
return Math.min(7200, Math.max(60, Math.round(value)));
|
||||
}
|
||||
|
||||
function normalizeCodexLiveIdleTimeoutSeconds(value: number | undefined, fallback: number) {
|
||||
if (value === undefined || !Number.isFinite(value)) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return Math.min(3600, Math.max(30, Math.round(value)));
|
||||
}
|
||||
|
||||
function normalizeBooleanValue(value: boolean | undefined, fallback: boolean) {
|
||||
if (typeof value !== 'boolean') {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function normalizeConfig(raw?: Partial<AppConfig>): AppConfig {
|
||||
const chat = raw?.chat;
|
||||
const automation = raw?.automation;
|
||||
@@ -272,6 +292,14 @@ function normalizeConfig(raw?: Partial<AppConfig>): AppConfig {
|
||||
chat?.codexLiveMaxExecutionSeconds,
|
||||
DEFAULT_APP_CONFIG.chat.codexLiveMaxExecutionSeconds,
|
||||
),
|
||||
codexLiveIdleTimeoutSeconds: normalizeCodexLiveIdleTimeoutSeconds(
|
||||
chat?.codexLiveIdleTimeoutSeconds,
|
||||
DEFAULT_APP_CONFIG.chat.codexLiveIdleTimeoutSeconds,
|
||||
),
|
||||
receiveRoomNotifications: normalizeBooleanValue(
|
||||
chat?.receiveRoomNotifications,
|
||||
DEFAULT_APP_CONFIG.chat.receiveRoomNotifications,
|
||||
),
|
||||
},
|
||||
automation: {
|
||||
autoRefreshEnabled: automation?.autoRefreshEnabled ?? DEFAULT_APP_CONFIG.automation.autoRefreshEnabled,
|
||||
|
||||
Reference in New Issue
Block a user