feat(config): support assistant briefing runtime edits and setup defaults
This commit is contained in:
@@ -176,6 +176,50 @@ const PATCHABLE_KEYS: Record<string, (config: Config, value: unknown) => boolean
|
||||
config.automation.daily_briefing.enabled = value;
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.output.channel': (config, value) => {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.output ??= { channel: 'webchat', peer: 'assistant' };
|
||||
config.automation.daily_briefing.output.channel = value.trim();
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.output.peer': (config, value) => {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.output ??= { channel: 'webchat', peer: 'assistant' };
|
||||
config.automation.daily_briefing.output.peer = value.trim();
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.prompt': (config, value) => {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.prompt = value;
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.schedule': (config, value) => {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.schedule = value.trim();
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.timezone': (config, value) => {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.timezone = value.trim();
|
||||
return true;
|
||||
},
|
||||
'automation.daily_briefing.model_tier': (config, value) => {
|
||||
if (value !== 'fast' && value !== 'default' && value !== 'complex' && value !== 'local') {return false;}
|
||||
config.automation ??= {} as Config['automation'];
|
||||
config.automation.daily_briefing ??= {} as Config['automation']['daily_briefing'];
|
||||
config.automation.daily_briefing.model_tier = value;
|
||||
return true;
|
||||
},
|
||||
'memory.daily_log.enabled': (config, value) => {
|
||||
if (typeof value !== 'boolean') {return false;}
|
||||
config.memory ??= {} as Config['memory'];
|
||||
|
||||
@@ -1145,6 +1145,9 @@ describe('config handlers', () => {
|
||||
'server.nodes.push.enabled': true,
|
||||
'automation.delivery_mode': 'announce',
|
||||
'automation.daily_briefing.enabled': true,
|
||||
'automation.daily_briefing.output.channel': 'telegram',
|
||||
'automation.daily_briefing.output.peer': '12345',
|
||||
'automation.daily_briefing.model_tier': 'fast',
|
||||
'memory.daily_log.enabled': true,
|
||||
'memory.proactive_extract.enabled': true,
|
||||
'memory.proactive_extract.min_tool_calls': 2,
|
||||
@@ -1165,6 +1168,9 @@ describe('config handlers', () => {
|
||||
'server.nodes.push.enabled',
|
||||
'automation.delivery_mode',
|
||||
'automation.daily_briefing.enabled',
|
||||
'automation.daily_briefing.output.channel',
|
||||
'automation.daily_briefing.output.peer',
|
||||
'automation.daily_briefing.model_tier',
|
||||
'memory.daily_log.enabled',
|
||||
'memory.proactive_extract.enabled',
|
||||
'memory.proactive_extract.min_tool_calls',
|
||||
@@ -1182,6 +1188,9 @@ describe('config handlers', () => {
|
||||
expect(config.server.nodes.push.enabled).toBe(true);
|
||||
expect(getPath(config, 'automation', 'delivery_mode')).toBe('announce');
|
||||
expect(getPath(config, 'automation', 'daily_briefing', 'enabled')).toBe(true);
|
||||
expect(getPath(config, 'automation', 'daily_briefing', 'output', 'channel')).toBe('telegram');
|
||||
expect(getPath(config, 'automation', 'daily_briefing', 'output', 'peer')).toBe('12345');
|
||||
expect(getPath(config, 'automation', 'daily_briefing', 'model_tier')).toBe('fast');
|
||||
expect(getPath(config, 'memory', 'daily_log', 'enabled')).toBe(true);
|
||||
expect(getPath(config, 'memory', 'proactive_extract', 'enabled')).toBe(true);
|
||||
expect(getPath(config, 'memory', 'proactive_extract', 'min_tool_calls')).toBe(2);
|
||||
@@ -1222,6 +1231,7 @@ describe('config handlers', () => {
|
||||
'server.queue.cap': 0,
|
||||
'memory.proactive_extract.min_tool_calls': 99,
|
||||
'tts.enabled_channels': [1, 2, 3],
|
||||
'automation.daily_briefing.model_tier': 'ultra',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1234,6 +1244,7 @@ describe('config handlers', () => {
|
||||
'server.queue.cap',
|
||||
'memory.proactive_extract.min_tool_calls',
|
||||
'tts.enabled_channels',
|
||||
'automation.daily_briefing.model_tier',
|
||||
]);
|
||||
expect(r.persisted).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user