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
714b7986
Commit
714b7986
authored
Jul 17, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: some api bugs
parent
707b5b72
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
6 deletions
+33
-6
conversation.py
api/controllers/console/explore/conversation.py
+4
-1
conversation.py
api/controllers/console/universal_chat/conversation.py
+8
-3
message.py
api/controllers/console/universal_chat/message.py
+12
-1
conversation.py
api/controllers/web/conversation.py
+4
-1
model.py
api/models/model.py
+5
-0
No files found.
api/controllers/console/explore/conversation.py
View file @
714b7986
...
...
@@ -65,7 +65,10 @@ class ConversationApi(InstalledAppResource):
raise
NotChatAppError
()
conversation_id
=
str
(
c_id
)
ConversationService
.
delete
(
app_model
,
conversation_id
,
current_user
)
try
:
ConversationService
.
delete
(
app_model
,
conversation_id
,
current_user
)
except
ConversationNotExistsError
:
raise
NotFound
(
"Conversation Not Exists."
)
WebConversationService
.
unpin
(
app_model
,
conversation_id
,
current_user
)
return
{
"result"
:
"success"
},
204
...
...
api/controllers/console/universal_chat/conversation.py
View file @
714b7986
...
...
@@ -18,7 +18,7 @@ conversation_fields = {
'status'
:
fields
.
String
,
'introduction'
:
fields
.
String
,
'created_at'
:
TimestampField
,
'
agent_mode'
:
fields
.
Raw
,
# todo ADD AGENT MODE INFO
'
model_config'
:
fields
.
Raw
,
}
conversation_infinite_scroll_pagination_fields
=
{
...
...
@@ -60,7 +60,12 @@ class UniversalChatConversationApi(UniversalChatResource):
def
delete
(
self
,
universal_app
,
c_id
):
app_model
=
universal_app
conversation_id
=
str
(
c_id
)
ConversationService
.
delete
(
app_model
,
conversation_id
,
current_user
)
try
:
ConversationService
.
delete
(
app_model
,
conversation_id
,
current_user
)
except
ConversationNotExistsError
:
raise
NotFound
(
"Conversation Not Exists."
)
WebConversationService
.
unpin
(
app_model
,
conversation_id
,
current_user
)
return
{
"result"
:
"success"
},
204
...
...
@@ -110,4 +115,4 @@ api.add_resource(UniversalChatConversationRenameApi, '/universal-chat/conversati
api
.
add_resource
(
UniversalChatConversationListApi
,
'/universal-chat/conversations'
)
api
.
add_resource
(
UniversalChatConversationApi
,
'/universal-chat/conversations/<uuid:c_id>'
)
api
.
add_resource
(
UniversalChatConversationPinApi
,
'/universal-chat/conversations/<uuid:c_id>/pin'
)
api
.
add_resource
(
UniversalChatConversationUnPinApi
,
'/universal-chat
>
/conversations/<uuid:c_id>/unpin'
)
api
.
add_resource
(
UniversalChatConversationUnPinApi
,
'/universal-chat/conversations/<uuid:c_id>/unpin'
)
api/controllers/console/universal_chat/message.py
View file @
714b7986
...
...
@@ -25,6 +25,17 @@ class UniversalChatMessageListApi(UniversalChatResource):
'rating'
:
fields
.
String
}
agent_thought_fields
=
{
'id'
:
fields
.
String
,
'chain_id'
:
fields
.
String
,
'message_id'
:
fields
.
String
,
'position'
:
fields
.
Integer
,
'thought'
:
fields
.
String
,
'tool'
:
fields
.
String
,
'tool_input'
:
fields
.
String
,
'created_at'
:
TimestampField
}
message_fields
=
{
'id'
:
fields
.
String
,
'conversation_id'
:
fields
.
String
,
...
...
@@ -33,7 +44,7 @@ class UniversalChatMessageListApi(UniversalChatResource):
'answer'
:
fields
.
String
,
'feedback'
:
fields
.
Nested
(
feedback_fields
,
attribute
=
'user_feedback'
,
allow_null
=
True
),
'created_at'
:
TimestampField
,
'agent_thought
'
:
fields
.
Raw
,
# TODO ADD agent_thought
'agent_thought
s'
:
fields
.
List
(
fields
.
Nested
(
agent_thought_fields
))
}
message_infinite_scroll_pagination_fields
=
{
...
...
api/controllers/web/conversation.py
View file @
714b7986
...
...
@@ -62,7 +62,10 @@ class ConversationApi(WebApiResource):
raise
NotChatAppError
()
conversation_id
=
str
(
c_id
)
ConversationService
.
delete
(
app_model
,
conversation_id
,
end_user
)
try
:
ConversationService
.
delete
(
app_model
,
conversation_id
,
end_user
)
except
ConversationNotExistsError
:
raise
NotFound
(
"Conversation Not Exists."
)
WebConversationService
.
unpin
(
app_model
,
conversation_id
,
end_user
)
return
{
"result"
:
"success"
},
204
...
...
api/models/model.py
View file @
714b7986
...
...
@@ -418,6 +418,11 @@ class Message(db.Model):
def
in_debug_mode
(
self
):
return
self
.
override_model_configs
is
not
None
@
property
def
agent_thoughts
(
self
):
return
db
.
session
.
query
(
MessageAgentThought
)
.
filter
(
MessageAgentThought
.
message_id
==
self
.
id
)
\
.
order_by
(
MessageAgentThought
.
position
.
asc
())
.
all
()
class
MessageFeedback
(
db
.
Model
):
__tablename__
=
'message_feedbacks'
...
...
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