This commit is contained in:
Timothy Jaeryang Baek
2026-07-16 02:35:44 -04:00
parent 8270aa59ab
commit 75894161e4
9 changed files with 188 additions and 60 deletions
+2
View File
@@ -1948,6 +1948,7 @@ async def get_app_config(request: Request):
'calendar.enable',
'automations.enable',
'notes.enable',
'chat.context_compaction.enable',
'web.search.enable',
'web.search.confirmation.enable',
'web.search.confirmation.content',
@@ -2017,6 +2018,7 @@ async def get_app_config(request: Request):
'enable_calendar': config.get('calendar.enable'),
'enable_automations': config.get('automations.enable'),
'enable_notes': config.get('notes.enable'),
'enable_context_compaction': config.get('chat.context_compaction.enable'),
'enable_web_search': config.get('web.search.enable'),
'enable_web_search_confirmation': config.get('web.search.confirmation.enable'),
'web_search_confirmation_content': config.get('web.search.confirmation.content'),
@@ -145,6 +145,8 @@ async def compact_messages_for_request(
async def compact_chat_branch(request, user, chat: Any, model_id: str, models: dict) -> dict:
config = await _load_config()
if not config['enable']:
return {'ok': True, 'compacted': False, 'reason': 'disabled'}
history = (chat.chat or {}).get('history') or {}
current_id = history.get('currentId')
@@ -225,6 +227,9 @@ async def get_chat_context_usage(chat: Any, model_id: str | None = None) -> dict
return None
config = await _load_config()
if not config['enable']:
return None
params = ((chat.chat or {}).get('params') or {}).copy()
if model_id:
params['model'] = model_id