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
94b54b7c
Unverified
Commit
94b54b7c
authored
Jul 27, 2023
by
TheFu527
Committed by
GitHub
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: replace the end user column in the web page Log & Ann. with the… (#653)
Co-authored-by:
Hao Fu
<
hao.fu@helloklarity.com
>
parent
f9412f5f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
2 deletions
+11
-2
conversation.py
api/controllers/console/app/conversation.py
+6
-0
model.py
api/models/model.py
+3
-1
list.tsx
web/app/components/app/log/list.tsx
+1
-1
log.ts
web/models/log.ts
+1
-0
No files found.
api/controllers/console/app/conversation.py
View file @
94b54b7c
...
@@ -95,6 +95,7 @@ class CompletionConversationApi(Resource):
...
@@ -95,6 +95,7 @@ class CompletionConversationApi(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_account_id'
:
fields
.
String
,
'from_account_id'
:
fields
.
String
,
'read_at'
:
TimestampField
,
'read_at'
:
TimestampField
,
'created_at'
:
TimestampField
,
'created_at'
:
TimestampField
,
...
@@ -135,6 +136,8 @@ class CompletionConversationApi(Resource):
...
@@ -135,6 +136,8 @@ class CompletionConversationApi(Resource):
query
=
db
.
select
(
Conversation
)
.
where
(
Conversation
.
app_id
==
app
.
id
,
Conversation
.
mode
==
'completion'
)
query
=
db
.
select
(
Conversation
)
.
where
(
Conversation
.
app_id
==
app
.
id
,
Conversation
.
mode
==
'completion'
)
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
...
@@ -246,6 +249,7 @@ class ChatConversationApi(Resource):
...
@@ -246,6 +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_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
,
...
@@ -288,6 +292,8 @@ class ChatConversationApi(Resource):
...
@@ -288,6 +292,8 @@ 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 @
94b54b7c
...
@@ -203,7 +203,7 @@ class Conversation(db.Model):
...
@@ -203,7 +203,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
)
from_end_user_id
=
db
.
Column
(
UUID
,
db
.
ForeignKey
(
'end_users.id'
)
)
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
)
...
@@ -213,6 +213,8 @@ class Conversation(db.Model):
...
@@ -213,6 +213,8 @@ 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
...
...
web/app/components/app/log/list.tsx
View file @
94b54b7c
...
@@ -412,7 +412,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
...
@@ -412,7 +412,7 @@ const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh })
</
thead
>
</
thead
>
<
tbody
className=
"text-gray-500"
>
<
tbody
className=
"text-gray-500"
>
{
logs
.
data
.
map
((
log
)
=>
{
{
logs
.
data
.
map
((
log
)
=>
{
const
endUser
=
log
.
from_end_user_
id
?.
slice
(
0
,
8
)
const
endUser
=
log
.
from_end_user_
session_id
const
leftValue
=
get
(
log
,
isChatMode
?
'summary'
:
'message.query'
)
const
leftValue
=
get
(
log
,
isChatMode
?
'summary'
:
'message.query'
)
const
rightValue
=
get
(
log
,
isChatMode
?
'message_count'
:
'message.answer'
)
const
rightValue
=
get
(
log
,
isChatMode
?
'message_count'
:
'message.answer'
)
return
<
tr
return
<
tr
...
...
web/models/log.ts
View file @
94b54b7c
...
@@ -79,6 +79,7 @@ export type CompletionConversationGeneralDetail = {
...
@@ -79,6 +79,7 @@ export type CompletionConversationGeneralDetail = {
status
:
'normal'
|
'finished'
status
:
'normal'
|
'finished'
from_source
:
'api'
|
'console'
from_source
:
'api'
|
'console'
from_end_user_id
:
string
from_end_user_id
:
string
from_end_user_session_id
:
string
from_account_id
:
string
from_account_id
:
string
read_at
:
Date
read_at
:
Date
created_at
:
number
created_at
:
number
...
...
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