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
f5b2271c
Unverified
Commit
f5b2271c
authored
May 15, 2023
by
John Wang
Committed by
GitHub
May 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: import wrong user (#32)
parent
a8155cba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
conversation_message_task.py
api/core/conversation_message_task.py
+5
-7
No files found.
api/core/conversation_message_task.py
View file @
f5b2271c
...
...
@@ -2,8 +2,6 @@ import decimal
import
json
from
typing
import
Optional
,
Union
from
gunicorn.config
import
User
from
core.callback_handler.entity.agent_loop
import
AgentLoop
from
core.callback_handler.entity.dataset_query
import
DatasetQueryObj
from
core.callback_handler.entity.llm_message
import
LLMMessage
...
...
@@ -269,7 +267,7 @@ class ConversationMessageTask:
class
PubHandler
:
def
__init__
(
self
,
user
:
Union
[
Account
|
User
],
task_id
:
str
,
def
__init__
(
self
,
user
:
Union
[
Account
|
End
User
],
task_id
:
str
,
message
:
Message
,
conversation
:
Conversation
,
chain_pub
:
bool
=
False
,
agent_thought_pub
:
bool
=
False
):
self
.
_channel
=
PubHandler
.
generate_channel_name
(
user
,
task_id
)
...
...
@@ -282,12 +280,12 @@ class PubHandler:
self
.
_agent_thought_pub
=
agent_thought_pub
@
classmethod
def
generate_channel_name
(
cls
,
user
:
Union
[
Account
|
User
],
task_id
:
str
):
def
generate_channel_name
(
cls
,
user
:
Union
[
Account
|
End
User
],
task_id
:
str
):
user_str
=
'account-'
+
user
.
id
if
isinstance
(
user
,
Account
)
else
'end-user-'
+
user
.
id
return
"generate_result:{}-{}"
.
format
(
user_str
,
task_id
)
@
classmethod
def
generate_stopped_cache_key
(
cls
,
user
:
Union
[
Account
|
User
],
task_id
:
str
):
def
generate_stopped_cache_key
(
cls
,
user
:
Union
[
Account
|
End
User
],
task_id
:
str
):
user_str
=
'account-'
+
user
.
id
if
isinstance
(
user
,
Account
)
else
'end-user-'
+
user
.
id
return
"generate_result_stopped:{}-{}"
.
format
(
user_str
,
task_id
)
...
...
@@ -366,7 +364,7 @@ class PubHandler:
redis_client
.
publish
(
self
.
_channel
,
json
.
dumps
(
content
))
@
classmethod
def
pub_error
(
cls
,
user
:
Union
[
Account
|
User
],
task_id
:
str
,
e
):
def
pub_error
(
cls
,
user
:
Union
[
Account
|
End
User
],
task_id
:
str
,
e
):
content
=
{
'error'
:
type
(
e
)
.
__name__
,
'description'
:
e
.
description
if
getattr
(
e
,
'description'
,
None
)
is
not
None
else
str
(
e
)
...
...
@@ -379,7 +377,7 @@ class PubHandler:
return
redis_client
.
get
(
self
.
_stopped_cache_key
)
is
not
None
@
classmethod
def
stop
(
cls
,
user
:
Union
[
Account
|
User
],
task_id
:
str
):
def
stop
(
cls
,
user
:
Union
[
Account
|
End
User
],
task_id
:
str
):
stopped_cache_key
=
cls
.
generate_stopped_cache_key
(
user
,
task_id
)
redis_client
.
setex
(
stopped_cache_key
,
600
,
1
)
...
...
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