Skip to content

Commit

Permalink
fix(model): make sure AppModelConfig.model_dict returns a dict. (lang…
Browse files Browse the repository at this point in the history
  • Loading branch information
laipz8200 authored Nov 22, 2024
1 parent 8a83edc commit 535c72c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def app(self):

@property
def model_dict(self) -> dict:
return json.loads(self.model) if self.model else None
return json.loads(self.model) if self.model else {}

@property
def suggested_questions_list(self) -> list:
Expand Down Expand Up @@ -600,8 +600,8 @@ def model_config(self):
app_model_config = (
db.session.query(AppModelConfig).filter(AppModelConfig.id == self.app_model_config_id).first()
)

model_config = app_model_config.to_dict()
if app_model_config:
model_config = app_model_config.to_dict()

model_config["model_id"] = self.model_id
model_config["provider"] = self.model_provider
Expand Down

0 comments on commit 535c72c

Please sign in to comment.