mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-29 08:31:48 -05:00
refac
This commit is contained in:
1 parent
cbaefab3d4
commit
18f7633afa
6 files changed
+51
-12
No files matched your search
@@ -15,6 +15,16 @@ log = logging.getLogger(__name__)
|
||||
# Let the right tool be given for the work at hand,
|
||||
# not the one that flatters, but the one that serves.
|
||||
def get_task_model_id(default_model_id: str, task_model: str, task_model_external: str, models) -> str:
|
||||
if default_model_id.startswith('agent:'):
|
||||
# Agent sessions cannot serve ordinary completion requests for background tasks.
|
||||
return next(
|
||||
(
|
||||
model
|
||||
for model in (task_model_external, task_model)
|
||||
if model and model in models and not model.startswith('agent:')
|
||||
),
|
||||
default_model_id,
|
||||
)
|
||||
task_model_id = default_model_id
|
||||
# Use an available task model override for the local or external connection.
|
||||
if models.get(task_model_id, {}).get('connection_type') == 'local':
|
||||
|
||||
Reference in new issue
Block a user