refac
This commit is contained in:
1 parent
5278eb906e
commit
69e449e318
5 files changed
+76
-55
No files matched your search
@@ -364,11 +364,21 @@ async def _generate_summary(
|
||||
) -> str:
|
||||
from open_webui.utils.chat import generate_chat_completion
|
||||
|
||||
task_model_id = get_task_model_id(
|
||||
model_id,
|
||||
await Config.get('task.model.default'),
|
||||
await Config.get('task.model.external'),
|
||||
models,
|
||||
task_config = await Config.get_many(
|
||||
'task.model.default',
|
||||
'task.model.external',
|
||||
'chat.context_compaction.model',
|
||||
)
|
||||
context_compaction_model = task_config.get('chat.context_compaction.model')
|
||||
task_model_id = (
|
||||
context_compaction_model
|
||||
if context_compaction_model in models
|
||||
else get_task_model_id(
|
||||
model_id,
|
||||
task_config.get('task.model.default'),
|
||||
task_config.get('task.model.external'),
|
||||
models,
|
||||
)
|
||||
)
|
||||
if task_model_id not in models:
|
||||
task_model_id = model_id
|
||||
|
||||
@@ -2332,6 +2332,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
||||
if is_saved_chat_id(chat_id) and user_message_id:
|
||||
if getattr(request.state, 'direct', False) and hasattr(request.state, 'model'):
|
||||
compaction_models = {
|
||||
**request.app.state.MODELS,
|
||||
request.state.model['id']: request.state.model,
|
||||
}
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user