diff --git a/api/apps/services/models_api_service.py b/api/apps/services/models_api_service.py index b6fcf1492c..1daf0b28c7 100644 --- a/api/apps/services/models_api_service.py +++ b/api/apps/services/models_api_service.py @@ -373,6 +373,6 @@ def list_tenant_added_models(tenant_id: str, model_type_filter: str = None): } ) - added_models.sort(key=lambda x: (factory_rank_mapping.get(x["provider_name"]), x["provider_name"], x["instance_name"], -x["rank"], x["name"])) + added_models.sort(key=lambda x: (factory_rank_mapping.get(x["provider_name"], -500), x["provider_name"], x["instance_name"], -x["rank"], x["name"])) return True, added_models diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index 0ab017bd2f..c19f89a3ec 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -396,6 +396,7 @@ class Base(ABC): hist.append( { "role": "assistant", + "content": None, "tool_calls": [ { "index": getattr(tool_call, "index", None), @@ -425,6 +426,7 @@ class Base(ABC): hist.append( { "role": "assistant", + "content": None, "tool_calls": [ { "index": getattr(tc, "index", None), @@ -1884,6 +1886,7 @@ class LiteLLMBase(ABC): def _append_history(self, hist, tool_call, tool_res, reasoning_content=None): assistant_msg = { "role": "assistant", + "content": None, "tool_calls": [ { "index": getattr(tool_call, "index", None), @@ -1914,6 +1917,7 @@ class LiteLLMBase(ABC): """ assistant_msg = { "role": "assistant", + "content": None, "tool_calls": [ { "index": getattr(tc, "index", None),