-
Notifications
You must be signed in to change notification settings - Fork 404
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
fix: improve chat reporter #3832
Conversation
This PR was not deployed automatically as @Ricbet does not have access to the Railway project. In order to get automatic PR deploys, please add @Ricbet to the project inside the project settings page. |
Walkthrough此次更改涉及对多个文件的调整,主要集中在将字符串常量替换为 Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- packages/ai-native/src/browser/chat/chat.internal.service.ts (1 hunks)
- packages/ai-native/src/browser/chat/chat.view.tsx (4 hunks)
- packages/ai-native/src/browser/components/ChatReply.tsx (2 hunks)
- packages/ai-native/src/browser/contrib/rename/rename.handler.ts (1 hunks)
- packages/ai-native/src/browser/contrib/terminal/ps1-terminal.service.tsx (2 hunks)
- packages/ai-native/src/common/index.ts (1 hunks)
- packages/core-common/src/types/ai-native/reporter.ts (3 hunks)
Files skipped from review due to trivial changes (1)
- packages/ai-native/src/browser/chat/chat.internal.service.ts
Additional comments not posted (11)
packages/core-common/src/types/ai-native/reporter.ts (3)
12-12
: 新增的枚举值TerminalAICommand
添加的
TerminalAICommand
枚举值看起来是为了支持终端AI命令的报告。这是一个很好的改进,可以确保终端AI命令的类型安全和一致性。
56-60
: 新增的接口ChatRT
新增的
ChatRT
接口扩展了CommonLogInfo
,并添加了agentId
,userMessage
,assistantMessage
属性。这些属性对于聊天记录的追踪和报告是有用的。
114-116
: 扩展ReportInfo
类型扩展
ReportInfo
类型以包括Chat
和Agent
类型,并关联到ChatRT
接口。这是一个很好的改进,有助于在报告中包含更多的聊天相关信息。packages/ai-native/src/browser/contrib/rename/rename.handler.ts (1)
37-40
: 更新aiReporter.start
调用将
aiReporter.start
的第一个参数从字符串'rename'
改为枚举值AISerivceType.Rename
。这提高了代码的类型安全性和可读性。packages/ai-native/src/common/index.ts (1)
75-78
: 将ChatCompletionRequestMessageRoleEnum
转换为const enum
将
ChatCompletionRequestMessageRoleEnum
转换为const enum
可以优化性能,因为const enum
在编译时会被内联,而不是在运行时访问。packages/ai-native/src/browser/contrib/terminal/ps1-terminal.service.tsx (2)
8-14
: 添加AISerivceType
导入添加
AISerivceType
的导入是为了使用AISerivceType.TerminalAICommand
枚举值。这是必要的改动,以支持终端AI命令的报告。
231-231
: 更新aiReporter.start
调用将
aiReporter.start
的第一个参数从字符串'terminalAICommand'
改为枚举值AISerivceType.TerminalAICommand
。这提高了代码的类型安全性和可读性。packages/ai-native/src/browser/components/ChatReply.tsx (2)
Line range hint
200-204
: 更新aiReporter.end
调用将
aiReporter.end
调用中的message
属性从request.response.responseText
改为assistantMessage
。这提高了代码的可读性和一致性。
223-226
: 更新aiReporter.end
调用将
aiReporter.end
调用中的message
属性从request.response.responseText
改为assistantMessage
。这提高了代码的可读性和一致性。packages/ai-native/src/browser/chat/chat.view.tsx (2)
194-194
: 确保更改符合预期功能在这里使用
AISerivceType.Chat
作为报告类型是合理的,因为这是在处理聊天消息列表的启动。请确保这与预期的功能一致,没有遗漏其他可能的类型。
333-338
: 验证报告类型的确定逻辑此处的逻辑根据
agentId
确定报告类型,并启动报告器。确保ChatProxyService.AGENT_ID
和AISerivceType.Chat
的使用是正确的,并且没有遗漏其他可能的类型。
done Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/ai-native/src/browser/chat/chat.view.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/ai-native/src/browser/chat/chat.view.tsx
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3832 +/- ##
==========================================
- Coverage 55.06% 55.02% -0.04%
==========================================
Files 1553 1553
Lines 94634 94682 +48
Branches 19375 19380 +5
==========================================
- Hits 52106 52099 -7
- Misses 35331 35379 +48
- Partials 7197 7204 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Types
Background or solution
Changelog
修正 chat 面板的埋点上报
Summary by CodeRabbit
新功能
优化
aiReporter.start
方法调用中的参数结构,使其更加清晰和一致。Bug 修复