feat(ai): AI optimization features (issues #94-#102)#122
Merged
Conversation
21535f6 to
e07a88b
Compare
Backend changes: - Add four-layer intent routing (Cache → Rule → History → LLM) - Add RuleMatcher for fast zero-latency classification - Add router feedback collection with PostgreSQL storage - Add Prometheus metrics and tracing support - Add context delta builder for efficient context updates - Add preload analyzer and scheduler for optimization - Add sensitive input filter for security - Add migration for router_feedback table Frontend changes: - Add ProgressIndicator component with phase animations - Add QuickReplies component for suggested actions - Add shimmer keyframe animation to default.css - Update UnifiedMessageBlock with progress display - Update AIChat page to support new features i18n fixes: - Fix zh-Hant.json: add 335 missing translation keys - Translate ai.progress.phases to Traditional Chinese - Ensure all locale files are synchronized Refs #97 (Progressive Progress Feedback) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add 🔑 Critical Context section with project structure table - Document key configuration (PostgreSQL container name, ports) - Add i18n completeness trap warning (check-i18n doesn't check zh-Hant.json) - Add Language-Specific Notes for TypeScript/React and Go - Add 🚫 Code Change Boundaries section with 4 workflow patterns - Update freshness status to v0.93.2 (2026-02-08) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Standardize field alignment in deltaStats, DeltaStats, TracingContext structs - Improve i18n validation script with complete zh-Hant.json check - Add cross-reference to DEBUG_LESSONS.md for migration notes - Refine terminology: GraphQL/Proto → Proto/Schema - Update code-reviewer agent description format All tests pass, build successful. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused Database import from ProgressIndicator - Fix Navigation i18n key path to ai.knowledge-graph.title - Merge duplicate ai.progress keys into first ai key (en.json, zh-Hans.json) - Apply auto-formatting fixes Refs #120 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix matchPool.Get() type assertion in sensitive.go - Add slog error handling in analyzer.go async save - Fix defer close error handling in exporter.go - Fix http.NewRequest nil to http.NoBody in prometheus_test.go - Rename testErr to errTest for staticcheck compliance - Remove unused matchPool.Put to avoid SA6002 - Simplify regex pattern using \S* instead of [^\s]* - Remove unused fields and imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add "Go Lint 常见陷阱" section with: - Type assertion must use comma-ok pattern - Defer error checking requirements - Error comparison with errors.Is - HTTP nil body should use http.NoBody - error variable naming convention - Regex simplification patterns - sync.Pool usage restrictions This section captures lessons learned from fixing 18 golangci-lint issues in commit 14900ad, preventing future repetitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…prompts - Update document.documentElement.lang in applyLocaleEarly() - Update document.documentElement.lang in loadLocale() - Map zh-Hans → zh-CN, zh-Hant → zh-TW for BCP 47 compliance This prevents Chrome/Google from offering to translate the page when the user's browser language matches the content language. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit fixes two issues with AI chat streaming: 1. **Tool call metadata fix**: tool_use events were incorrectly using response.eventData (JSON parameters) as toolName instead of eventMeta.toolName. Now correctly displays tool names like "schedule_query" instead of JSON strings. 2. **Optimistic block recreation fix**: Added blockAlreadyExists check to prevent recreating blocks on every SSE event, which was clearing the accumulated eventStream. 3. **Simplification**: Removed FIFO queue infrastructure (~250 lines) as SSE events are serial by nature - no concurrent updates occur. Root causes: - tool_use handler: toolName: response.eventData → toolMeta?.toolName - Every SSE event triggered block recreation, resetting eventStream - FIFO queue was over-engineering for serial SSE stream Refs streaming UI debugging session Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds two new debug lessons: 1. Tool call metadata error - using eventData instead of eventMeta.toolName 2. Over-engineering: FIFO queue - SSE is serial, queue was always empty Key takeaways: - Diagnose before treating - add logs to confirm assumptions - SSE doesn't need queuing - events are inherently serial - Simplify over complexity - React Query has internal batching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove console.log from eventTransformers.ts (extractToolCalls) - Remove console.log from ChatMessages.tsx (eventStream debugging) - Keep critical error logging in useAIQueries.ts These debug logs were added during the streaming UI fix investigation and are no longer needed now that the issue is resolved. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive technical specification for implementing full streaming tool calls (Solution A) in AI chat system. Key decisions: - Adopt complete streaming mode (DeepSeek native support) - Progressive enhancement strategy with backward compatibility - New ChatStreamWithTools interface Expected improvements: - First tool call latency: ~800ms → ~200ms (75% reduction) - Perceived latency: 3-5s → <1s (60% reduction) Refs #125 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e07a88b to
6b9e583
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
AI 聊天优化功能:路由反馈机制 + 流式事件处理优化 + 工具调用技术方案
关联 Issues
Resolves #94, #95, #96, #97, #98, #99, #100, #101, #102
Refs #125
主要变更
新增文档
docs/specs/streaming-tool-calls.md- 流式工具调用技术方案(669 行)功能优化
文档更新
方案要点(流式工具调用)
核心决策:
ChatStreamWithTools接口分阶段交付:
预期效果:
检查清单
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com