mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-16 06:16:53 +08:00
fix: count down thread in completion db not commit (#1267)
This commit is contained in:
@@ -106,13 +106,7 @@ class OpenAIModel(BaseLLM):
|
||||
raise ModelCurrentlyNotSupportError("Dify Hosted OpenAI GPT-4 currently not support.")
|
||||
|
||||
prompts = self._get_prompt_from_messages(messages)
|
||||
|
||||
try:
|
||||
return self._client.generate([prompts], stop, callbacks)
|
||||
finally:
|
||||
thread_context = api_requestor._thread_context
|
||||
if hasattr(thread_context, "session") and thread_context.session:
|
||||
thread_context.session.close()
|
||||
return self._client.generate([prompts], stop, callbacks)
|
||||
|
||||
def get_num_tokens(self, messages: List[PromptMessage]) -> int:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user