Skip to content

Commit 7ca0a7b

Browse files
committed
fix: Missing fields in exported logs
--bug=1054500 --user=王孝刚 【应用】对话日志导出,没有携带用户信息 https://www.tapd.cn/57709429/s/1681984
1 parent 2681d02 commit 7ca0a7b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

apps/application/serializers/chat_serializers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def to_row(row: Dict):
216216
"\n".join([
217217
f"{improve_paragraph_list[index].get('title')}\n{improve_paragraph_list[index].get('content')}"
218218
for index in range(len(improve_paragraph_list))]),
219+
row.get('asker').get('user_name'),
219220
row.get('message_tokens') + row.get('answer_tokens'), row.get('run_time'),
220221
str(row.get('create_time').astimezone(pytz.timezone(TIME_ZONE)).strftime('%Y-%m-%d %H:%M:%S')
221222
)]
@@ -242,7 +243,8 @@ def stream_response():
242243
gettext('answer'), gettext('User feedback'),
243244
gettext('Reference segment number'),
244245
gettext('Section title + content'),
245-
gettext('Annotation'), gettext('Consuming tokens'), gettext('Time consumed (s)'),
246+
gettext('Annotation'), gettext('USER'), gettext('Consuming tokens'),
247+
gettext('Time consumed (s)'),
246248
gettext('Question Time')]
247249
for col_idx, header in enumerate(headers, 1):
248250
cell = worksheet.cell(row=1, column=col_idx)

apps/application/sql/export_application_chat.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ SELECT
1010
application_chat_record_temp."index" as "index",
1111
application_chat_record_temp.improve_paragraph_list as improve_paragraph_list,
1212
application_chat_record_temp.vote_status as vote_status,
13-
application_chat_record_temp.create_time as create_time
13+
application_chat_record_temp.create_time as create_time,
14+
to_json(application_chat.asker) as asker
1415
FROM
1516
application_chat application_chat
1617
LEFT JOIN (

0 commit comments

Comments
 (0)