Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
86a9dea4
Unverified
Commit
86a9dea4
authored
Oct 01, 2023
by
takatost
Committed by
GitHub
Oct 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: db not commit when streaming output (#1266)
parent
8606d80c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
requirements.txt
api/requirements.txt
+2
-1
completion_service.py
api/services/completion_service.py
+5
-4
No files found.
api/requirements.txt
View file @
86a9dea4
...
@@ -51,4 +51,5 @@ stripe~=5.5.0
...
@@ -51,4 +51,5 @@ stripe~=5.5.0
pandas==1.5.3
pandas==1.5.3
xinference==0.4.2
xinference==0.4.2
safetensors==0.3.2
safetensors==0.3.2
zhipuai==1.0.7
zhipuai==1.0.7
\ No newline at end of file
werkzeug==2.3.7
\ No newline at end of file
api/services/completion_service.py
View file @
86a9dea4
...
@@ -200,17 +200,14 @@ class CompletionService:
...
@@ -200,17 +200,14 @@ class CompletionService:
except
(
LLMBadRequestError
,
LLMAPIConnectionError
,
LLMAPIUnavailableError
,
except
(
LLMBadRequestError
,
LLMAPIConnectionError
,
LLMAPIUnavailableError
,
LLMRateLimitError
,
ProviderTokenNotInitError
,
QuotaExceededError
,
LLMRateLimitError
,
ProviderTokenNotInitError
,
QuotaExceededError
,
ModelCurrentlyNotSupportError
)
as
e
:
ModelCurrentlyNotSupportError
)
as
e
:
db
.
session
.
rollback
()
PubHandler
.
pub_error
(
user
,
generate_task_id
,
e
)
PubHandler
.
pub_error
(
user
,
generate_task_id
,
e
)
except
LLMAuthorizationError
:
except
LLMAuthorizationError
:
db
.
session
.
rollback
()
PubHandler
.
pub_error
(
user
,
generate_task_id
,
LLMAuthorizationError
(
'Incorrect API key provided'
))
PubHandler
.
pub_error
(
user
,
generate_task_id
,
LLMAuthorizationError
(
'Incorrect API key provided'
))
except
Exception
as
e
:
except
Exception
as
e
:
db
.
session
.
rollback
()
logging
.
exception
(
"Unknown Error in completion"
)
logging
.
exception
(
"Unknown Error in completion"
)
PubHandler
.
pub_error
(
user
,
generate_task_id
,
e
)
PubHandler
.
pub_error
(
user
,
generate_task_id
,
e
)
finally
:
finally
:
db
.
session
.
c
lose
()
db
.
session
.
c
ommit
()
@
classmethod
@
classmethod
def
countdown_and_close
(
cls
,
worker_thread
,
pubsub
,
user
,
generate_task_id
)
->
threading
.
Thread
:
def
countdown_and_close
(
cls
,
worker_thread
,
pubsub
,
user
,
generate_task_id
)
->
threading
.
Thread
:
...
@@ -388,6 +385,8 @@ class CompletionService:
...
@@ -388,6 +385,8 @@ class CompletionService:
logging
.
exception
(
e
)
logging
.
exception
(
e
)
raise
raise
finally
:
finally
:
db
.
session
.
commit
()
try
:
try
:
pubsub
.
unsubscribe
(
generate_channel
)
pubsub
.
unsubscribe
(
generate_channel
)
except
ConnectionError
:
except
ConnectionError
:
...
@@ -425,6 +424,8 @@ class CompletionService:
...
@@ -425,6 +424,8 @@ class CompletionService:
logging
.
exception
(
e
)
logging
.
exception
(
e
)
raise
raise
finally
:
finally
:
db
.
session
.
commit
()
try
:
try
:
pubsub
.
unsubscribe
(
generate_channel
)
pubsub
.
unsubscribe
(
generate_channel
)
except
ConnectionError
:
except
ConnectionError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment