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
396197e8
Unverified
Commit
396197e8
authored
Jul 31, 2023
by
takatost
Committed by
GitHub
Jul 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: not annotation error in log (#686)
parent
6a564e2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
conversation.py
api/controllers/console/app/conversation.py
+1
-3
model.py
api/models/model.py
+10
-3
No files found.
api/controllers/console/app/conversation.py
View file @
396197e8
...
@@ -249,7 +249,7 @@ class ChatConversationApi(Resource):
...
@@ -249,7 +249,7 @@ class ChatConversationApi(Resource):
'status'
:
fields
.
String
,
'status'
:
fields
.
String
,
'from_source'
:
fields
.
String
,
'from_source'
:
fields
.
String
,
'from_end_user_id'
:
fields
.
String
,
'from_end_user_id'
:
fields
.
String
,
'from_end_user_session_id'
:
fields
.
String
(
attribute
=
'end_user.session_id'
)
,
'from_end_user_session_id'
:
fields
.
String
,
'from_account_id'
:
fields
.
String
,
'from_account_id'
:
fields
.
String
,
'summary'
:
fields
.
String
(
attribute
=
'summary_or_query'
),
'summary'
:
fields
.
String
(
attribute
=
'summary_or_query'
),
'read_at'
:
TimestampField
,
'read_at'
:
TimestampField
,
...
@@ -292,8 +292,6 @@ class ChatConversationApi(Resource):
...
@@ -292,8 +292,6 @@ class ChatConversationApi(Resource):
query
=
db
.
select
(
Conversation
)
.
where
(
Conversation
.
app_id
==
app
.
id
,
Conversation
.
mode
==
'chat'
)
query
=
db
.
select
(
Conversation
)
.
where
(
Conversation
.
app_id
==
app
.
id
,
Conversation
.
mode
==
'chat'
)
query
=
query
.
options
(
joinedload
(
Conversation
.
end_user
))
if
args
[
'keyword'
]:
if
args
[
'keyword'
]:
query
=
query
.
join
(
query
=
query
.
join
(
Message
,
Message
.
conversation_id
==
Conversation
.
id
Message
,
Message
.
conversation_id
==
Conversation
.
id
...
...
api/models/model.py
View file @
396197e8
...
@@ -226,7 +226,7 @@ class Conversation(db.Model):
...
@@ -226,7 +226,7 @@ class Conversation(db.Model):
system_instruction_tokens
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
,
server_default
=
db
.
text
(
'0'
))
system_instruction_tokens
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
,
server_default
=
db
.
text
(
'0'
))
status
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
status
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
from_source
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
from_source
=
db
.
Column
(
db
.
String
(
255
),
nullable
=
False
)
from_end_user_id
=
db
.
Column
(
UUID
,
db
.
ForeignKey
(
'end_users.id'
)
)
from_end_user_id
=
db
.
Column
(
UUID
)
from_account_id
=
db
.
Column
(
UUID
)
from_account_id
=
db
.
Column
(
UUID
)
read_at
=
db
.
Column
(
db
.
DateTime
)
read_at
=
db
.
Column
(
db
.
DateTime
)
read_account_id
=
db
.
Column
(
UUID
)
read_account_id
=
db
.
Column
(
UUID
)
...
@@ -236,8 +236,6 @@ class Conversation(db.Model):
...
@@ -236,8 +236,6 @@ class Conversation(db.Model):
messages
=
db
.
relationship
(
"Message"
,
backref
=
"conversation"
,
lazy
=
'select'
,
passive_deletes
=
"all"
)
messages
=
db
.
relationship
(
"Message"
,
backref
=
"conversation"
,
lazy
=
'select'
,
passive_deletes
=
"all"
)
message_annotations
=
db
.
relationship
(
"MessageAnnotation"
,
backref
=
"conversation"
,
lazy
=
'select'
,
passive_deletes
=
"all"
)
message_annotations
=
db
.
relationship
(
"MessageAnnotation"
,
backref
=
"conversation"
,
lazy
=
'select'
,
passive_deletes
=
"all"
)
end_user
=
db
.
relationship
(
"EndUser"
,
backref
=
"conversations"
)
is_deleted
=
db
.
Column
(
db
.
Boolean
,
nullable
=
False
,
server_default
=
db
.
text
(
'false'
))
is_deleted
=
db
.
Column
(
db
.
Boolean
,
nullable
=
False
,
server_default
=
db
.
text
(
'false'
))
@
property
@
property
...
@@ -346,6 +344,15 @@ class Conversation(db.Model):
...
@@ -346,6 +344,15 @@ class Conversation(db.Model):
def
app
(
self
):
def
app
(
self
):
return
db
.
session
.
query
(
App
)
.
filter
(
App
.
id
==
self
.
app_id
)
.
first
()
return
db
.
session
.
query
(
App
)
.
filter
(
App
.
id
==
self
.
app_id
)
.
first
()
@
property
def
from_end_user_session_id
(
self
):
if
self
.
from_end_user_id
:
end_user
=
db
.
session
.
query
(
EndUser
)
.
filter
(
EndUser
.
id
==
self
.
from_end_user_id
)
.
first
()
if
end_user
:
return
end_user
.
session_id
return
None
@
property
@
property
def
in_debug_mode
(
self
):
def
in_debug_mode
(
self
):
return
self
.
override_model_configs
is
not
None
return
self
.
override_model_configs
is
not
None
...
...
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