Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📜 Recent review details🔇 Additional comments (6)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds retry log marking and retry-aware filtering through backend query handlers, model helpers, and usage-log frontend validation, query encoding, and row matching. Channel models now render fully inline, and the model selector supports custom creation. ChangesRetry Log Filter
Channel UI Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/default/src/features/channels/components/channels-columns.tsx (1)
840-850: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick winRestore a bounded models preview in the table.
Line 850 now renders every model badge inline, so a channel with a long/custom model list can expand one row into dozens of wrapped badges and make the table hard to scan and heavier to render. Keep the full list accessible, but cap the in-row badges and show the remainder behind a
+N moreaffordance or tooltip.Proposed fix
- const modelBadges = modelArray.map((model, idx) => ( + const visibleModels = modelArray.slice(0, 2) + const hiddenCount = Math.max(0, modelArray.length - visibleModels.length) + + const modelBadges = visibleModels.map((model, idx) => ( <StatusBadge key={idx} label={model} autoColor={model} size='sm' className='font-mono' /> )) - return <div className='flex max-w-full flex-wrap gap-1'>{modelBadges}</div> + return ( + <div className='flex max-w-full flex-wrap gap-1'> + {modelBadges} + {hiddenCount > 0 && ( + <StatusBadge + label={`+${hiddenCount} more`} + size='sm' + variant='neutral' + copyable={false} + /> + )} + </div> + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/channels/components/channels-columns.tsx` around lines 840 - 850, The channel models cell currently renders the entire modelArray as inline StatusBadge items in the table, which can blow up row height and hurt performance. Update the models preview logic in channels-columns.tsx so the in-row display is bounded to a small fixed count, and expose any remaining models through a “+N more” indicator, tooltip, or similar affordance. Keep the existing modelBadges rendering pattern in place for the visible subset, and preserve access to the full list via the same cell/component.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@controller/relay.go`:
- Around line 390-394: Deduplicate the retry metadata assembly currently in the
relay flow by extracting the shared use_channel/retry_log logic into a common
helper used by controller relay handling and service/log_info_generate.go, or
add a regression test that covers the error path as well. Update the
controller/relay.go block around useChannel and retry_log so it delegates to the
same logic as GenerateTextOtherInfo, keeping success and error log metadata in
sync.
In `@model/log_test.go`:
- Around line 22-81: The retry-filter coverage is incomplete because this test
only exercises GetAllLogs, while the PR also changes GetUserLogs and
SumUsedQuota with separate query paths. Add focused regression tests for those
two entrypoints using the same LogFilterRetry contract and representative log
rows so the filter behavior is verified across all query builders, not just
GetAllLogs.
In `@model/log.go`:
- Around line 80-85: The retry filter in applyRetryLogFilter is scanning the
unindexed logs.other JSON blob with leading-wildcard LIKE predicates, which will
not scale for list and stat queries. Update the retry marker handling in
applyRetryLogFilter and the related query paths to use a dedicated indexed
column or a generated/indexed expression for the retry flag, and keep the filter
logic pointed at that searchable field instead of logs.other.
In `@web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx`:
- Around line 60-70: The allowed log-type tuple is duplicated in
common-logs-filter-bar and the authenticated usage-logs route, which can drift
from the existing selectable options source. Move the permitted values into a
shared exported constant in usage-logs/constants and update both the
logTypeValues usage in common-logs-filter-bar and the route’s validation to
reference that single tuple instead of hardcoding their own copies.
---
Outside diff comments:
In `@web/default/src/features/channels/components/channels-columns.tsx`:
- Around line 840-850: The channel models cell currently renders the entire
modelArray as inline StatusBadge items in the table, which can blow up row
height and hurt performance. Update the models preview logic in
channels-columns.tsx so the in-row display is bounded to a small fixed count,
and expose any remaining models through a “+N more” indicator, tooltip, or
similar affordance. Keep the existing modelBadges rendering pattern in place for
the visible subset, and preserve access to the full list via the same
cell/component.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 65960301-b3ae-45b6-bc7e-7dee16333d9b
📒 Files selected for processing (15)
controller/log.gocontroller/relay.gomodel/log.gomodel/log_test.goservice/log_info_generate.goservice/log_info_generate_test.goweb/default/src/features/channels/components/channels-columns.tsxweb/default/src/features/channels/components/drawers/channel-mutate-drawer.tsxweb/default/src/features/usage-logs/components/columns/common-logs-columns.tsxweb/default/src/features/usage-logs/components/common-logs-filter-bar.tsxweb/default/src/features/usage-logs/constants.tsweb/default/src/features/usage-logs/lib/utils.test.tsweb/default/src/features/usage-logs/lib/utils.tsweb/default/src/features/usage-logs/types.tsweb/default/src/routes/_authenticated/usage-logs/$section.tsx
💤 Files with no reviewable changes (1)
- web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
📜 Review details
🔇 Additional comments (9)
service/log_info_generate.go (1)
61-65: LGTM!service/log_info_generate_test.go (1)
13-32: LGTM!Also applies to: 34-50
controller/log.go (1)
18-28: LGTM!Also applies to: 72-80, 160-168, 189-196
web/default/src/features/usage-logs/types.ts (1)
131-132: LGTM!Also applies to: 305-305, 336-336
web/default/src/features/usage-logs/constants.ts (1)
69-69: LGTM!Also applies to: 110-110
web/default/src/routes/_authenticated/usage-logs/$section.tsx (1)
27-27: LGTM!web/default/src/features/usage-logs/lib/utils.ts (1)
31-35: LGTM!Also applies to: 44-44, 98-116, 205-230, 248-270, 279-279
web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx (1)
55-55: LGTM!Also applies to: 297-297
web/default/src/features/usage-logs/lib/utils.test.ts (1)
23-125: LGTM!
| func applyRetryLogFilter(tx *gorm.DB) *gorm.DB { | ||
| retryPatterns := []string{ | ||
| `%"retry_log":true%`, | ||
| `%"empty_retry":true%`, | ||
| } | ||
| return tx.Where("(logs.other LIKE ? OR logs.other LIKE ?)", retryPatterns[0], retryPatterns[1]) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🔵 Trivial
Plan for a searchable retry flag.
logs.other is an unindexed text field here, and the new retry filter uses leading-wildcard LIKE predicates on it in both list and stat queries. If this filter is expected to see real usage at scale, consider materializing the retry marker into a dedicated column or indexed/generated expression instead of scanning JSON blobs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@model/log.go` around lines 80 - 85, The retry filter in applyRetryLogFilter
is scanning the unindexed logs.other JSON blob with leading-wildcard LIKE
predicates, which will not scale for list and stat queries. Update the retry
marker handling in applyRetryLogFilter and the related query paths to use a
dedicated indexed column or a generated/indexed expression for the retry flag,
and keep the filter logic pointed at that searchable field instead of
logs.other.
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)