Skip to content

fix: Missing fields in exported logs #2817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged

fix: Missing fields in exported logs #2817

merged 1 commit into from
Apr 8, 2025

Conversation

shaohuzhang1
Copy link
Contributor

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

--bug=1054500 --user=王孝刚 【应用】对话日志导出,没有携带用户信息 https://www.tapd.cn/57709429/s/1681984
Copy link

f2c-ci-robot bot commented Apr 8, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Apr 8, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wxg0103 wxg0103 merged commit 7ca0a7b into main Apr 8, 2025
4 checks passed
@wxg0103 wxg0103 deleted the pr@main@fix_1054500 branch April 8, 2025 02:12
@@ -242,7 +243,8 @@ def stream_response():
gettext('answer'), gettext('User feedback'),
gettext('Reference segment number'),
gettext('Section title + content'),
gettext('Annotation'), gettext('Consuming tokens'), gettext('Time consumed (s)'),
gettext('Annotation'), gettext('USER'), gettext('Consuming tokens'),
gettext('Time consumed (s)'),
gettext('Question Time')]
for col_idx, header in enumerate(headers, 1):
cell = worksheet.cell(row=1, column=col_idx)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of issues in the provided code:

  1. Potential Typographical Error: The string 'USER' is not quoted in workbook.update_cells(), which might lead to an issue if you intend it to be treated as a cell value rather than just plain text.

  2. Missing Line Breaks in Headers: There's no line break added after "ANNOTATION" and before the next label ("CONSUMING TOKENS"). This can make the headers harder to read on some systems.

  3. Inconsistent Header Formatting: Some labels use commas instead of spaces to separate words, while others do not. It would be consistent if we used a single convention across all header entries.

Here’s an improved version of the code with these considerations addressed:

@@ -215,6 +215,7 @@ def to_row(row: Dict):
                        f"{improve_paragraph_list[index].get('title')}\n{improve_paragraph_list[index].get('content')}"
                         for index in range(len(improve_paragraph_list))]),
+                    row.get('asker').get('user_name'),
                     row.get('message_tokens') + row.get('answer_tokens'), row.get('run_time'),
                     str(row.get('create_time').astimezone(pytz.timezone(TIME_ZONE)).strftime('%Y-%m-%d %H:%M:%S'))
                )
                 workbook.update_cells([(row_index + 2, col_idx) for col_idx, _ in enumerate(headers)], values=row_data)

@@ -242,8 +242,9 @@ def stream_response():
                                gettext('answer'), gettext('User feedback'),
                                gettext('Reference segment number'),
                                gettext('Section title + content'),
-                               gettext('Annotation'), gettext('Consuming tokens'), gettext('Time consumed (s)'),
+                               gettext('Annotation'), gettext('USER'), gettext('Consuming tokens'),
+                               gettext('TIME CONSUMED (S)'), # Consistent header formatting
                                gettext('Question Time')]
                         for col_idx, header in enumerate(headers, 1):
                             cell = worksheet.cell(row=1, column=col_idx)

These changes should improve readability and consistency in your spreadsheet output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants