Skip to content

Commit

Permalink
fix: db session not commit before long llm call running (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Sep 27, 2023
1 parent d38eac9 commit a31466d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/core/model_providers/models/llm/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
import re
import time
from abc import abstractmethod
from typing import List, Optional, Any, Union, Tuple
import decimal
Expand All @@ -20,6 +21,8 @@
from core.third_party.langchain.llms.fake import FakeLLM
import logging

from extensions.ext_database import db

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -129,6 +132,8 @@ def run(self, messages: List[PromptMessage],
if self.deduct_quota:
self.model_provider.check_quota_over_limit()

db.session.commit()

if not callbacks:
callbacks = self.callbacks
else:
Expand Down

0 comments on commit a31466d

Please sign in to comment.