fix: native function calling system prompt duplication

This commit is contained in:
Timothy Jaeryang Baek
2026-01-08 23:08:47 +04:00
parent 7aee9c4783
commit 9223efaff0
4 changed files with 15 additions and 4 deletions
+3 -1
View File
@@ -1256,6 +1256,7 @@ async def generate_chat_completion(
url_idx: Optional[int] = None,
user=Depends(get_verified_user),
bypass_filter: Optional[bool] = False,
bypass_system_prompt: bool = False,
db: Session = Depends(get_session),
):
if BYPASS_MODEL_ACCESS_CONTROL:
@@ -1295,7 +1296,8 @@ async def generate_chat_completion(
system = params.pop("system", None)
payload = apply_model_params_to_body_ollama(params, payload)
payload = apply_system_prompt_to_body(system, payload, metadata, user)
if not bypass_system_prompt:
payload = apply_system_prompt_to_body(system, payload, metadata, user)
# Check if user has access to the model
if not bypass_filter and user.role == "user":
+3 -1
View File
@@ -800,6 +800,7 @@ async def generate_chat_completion(
form_data: dict,
user=Depends(get_verified_user),
bypass_filter: Optional[bool] = False,
bypass_system_prompt: bool = False,
db: Session = Depends(get_session),
):
if BYPASS_MODEL_ACCESS_CONTROL:
@@ -830,7 +831,8 @@ async def generate_chat_completion(
system = params.pop("system", None)
payload = apply_model_params_to_body_openai(params, payload)
payload = apply_system_prompt_to_body(system, payload, metadata, user)
if not bypass_system_prompt:
payload = apply_system_prompt_to_body(system, payload, metadata, user)
# Check if user has access to the model
if not bypass_filter and user.role == "user":