mirror of
https://github.com/open-webui/open-webui
synced 2025-04-10 15:45:45 +00:00
Minor bugfixes
This commit is contained in:
parent
1a2d7a1a51
commit
4d3a4736fa
@ -562,18 +562,18 @@ async def generate_chat_completion(
|
||||
|
||||
model_info = Models.get_model_by_id(form_data.get("model"))
|
||||
|
||||
if model_info is None:
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="Model not found. Please check the model ID is correct.",
|
||||
)
|
||||
|
||||
has_chat_id = "chat_id" in metadata and metadata["chat_id"] is not None
|
||||
|
||||
# Initialize the credit cost variable
|
||||
model_message_credit_cost = 0
|
||||
|
||||
if has_chat_id:
|
||||
if model_info is None:
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="Model not found. Please check the model ID is correct.",
|
||||
)
|
||||
|
||||
# Check for base_model_id first in case of user defined custom model
|
||||
model_id = model_info.base_model_id if model_info.base_model_id else model_info.id
|
||||
model_message_credit_cost = ModelMessageCreditCosts.get_cost_by_model(model_id)
|
||||
@ -616,6 +616,9 @@ async def generate_chat_completion(
|
||||
|
||||
# Check model info and override the payload
|
||||
if model_info:
|
||||
# Initialize model_id here to ensure it's always defined
|
||||
model_id = model_info.id
|
||||
|
||||
if model_info.base_model_id:
|
||||
payload["model"] = model_info.base_model_id
|
||||
model_id = model_info.base_model_id
|
||||
|
Loading…
Reference in New Issue
Block a user