Conversation
…dd new lessons for Chinese, English, French, Japanese, Korean, and Spanish; implement shared lesson creation logic.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR localizes UI strings to Traditional Chinese, implements a full Profile screen, modularizes lesson data into per-language files via a shared createLesson factory, refactors lessons aggregation, and updates vision-agent prompts to Taiwan Mandarin. ChangesComprehensive Localization & Lesson Data Restructuring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/api/stream/audio-call+api.ts (1)
1-1:⚠️ Potential issue | 🔴 CriticalFix lint/typecheck failures before finishing this change (gates currently fail)
npm run lintfails (41 errors), includingapp/api/stream/audio-call+api.tsimport@stream-io/node-sdk(import/no-unresolved).npm run typecheckfails with TS2307 forapp/api/stream/audio-call+api.ts(@stream-io/node-sdk) and many additional TS errors (e.g., TS7006 implicitany, missing type declarations) across the repo.🤖 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 `@app/api/stream/audio-call`+api.ts at line 1, The import of StreamClient from '`@stream-io/node-sdk`' is unresolved and causing lint/typecheck failures; fix by replacing or installing the correct SDK package and types (e.g., install the official Stream Node SDK package that exports StreamClient or update the import to the correct module name), add or install corresponding `@types` if needed, and annotate any implicit- any variables used with StreamClient so TS no longer reports TS7006 (search for StreamClient usage in this module). Also ensure ESLint import resolver is configured or update the import to a path the resolver recognizes, then run npm run lint and npm run typecheck and address remaining missing type declarations across functions referenced in this diff until both pass.
🧹 Nitpick comments (2)
vision-agent/agent.py (1)
369-383: ⚡ Quick winUse
USER_LANGUAGEin opening prompts to avoid config drift.These prompts hardcode
台灣國語instead of reusing the module constant.Proposed refactor
- "請用台灣國語溫暖地問候學習者,語氣自然、有精神、專注。" + f"請用{USER_LANGUAGE}溫暖地問候學習者,語氣自然、有精神、專注。" ... - "現在請用台灣國語,以這堂課的 AI 老師身分溫暖問候學習者。" + f"現在請用{USER_LANGUAGE},以這堂課的 AI 老師身分溫暖問候學習者。"🤖 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 `@vision-agent/agent.py` around lines 369 - 383, The opening_prompt and the earlier prompt strings currently hardcode "台灣國語"; change them to use the module constant USER_LANGUAGE instead so config changes propagate. Locate the block that sets opening_prompt (and any nearby literal prompt strings used when custom_data is present) and replace the hardcoded language with USER_LANGUAGE, preserving the rest of the text and concatenation and keeping calls to build_teacher_instructions(custom=custom_data) and apply_agent_instructions(agent, lesson_instructions) unchanged.components/audio-teacher-session.tsx (1)
50-52: ⚡ Quick winSwitch tab state prop from label-based to route-based.
activeTabLabelis still an English-label union while tab behavior is now route-driven. This keeps an unnecessary i18n coupling. Prefer anactiveTabRoute: "/ai-teacher" | "/learn"(orHref) prop and compare directly.Proposed refactor
type AudioTeacherSessionProps = { - activeTabLabel?: "AI Teacher" | "Learn"; + activeTabRoute?: "/ai-teacher" | "/learn"; autoStartCall?: boolean; lesson?: Lesson; onCallEnded?: () => void; showEmbeddedTabBar?: boolean; }; export function AudioTeacherSession({ - activeTabLabel = "AI Teacher", + activeTabRoute = "/ai-teacher", autoStartCall = false, lesson, onCallEnded, showEmbeddedTabBar = false, }: AudioTeacherSessionProps) { ... return ( <AudioTeacherSessionContent - activeTabLabel={activeTabLabel} + activeTabRoute={activeTabRoute} ... /> ); } type AudioTeacherSessionContentProps = { - activeTabLabel: "AI Teacher" | "Learn"; + activeTabRoute: "/ai-teacher" | "/learn"; ... }; function AudioTeacherSessionContent({ - activeTabLabel, + activeTabRoute, ... }: AudioTeacherSessionContentProps) { ... - {showEmbeddedTabBar ? <LessonTabBar activeTabLabel={activeTabLabel} /> : null} + {showEmbeddedTabBar ? <LessonTabBar activeTabRoute={activeTabRoute} /> : null} } type LessonTabBarProps = { - activeTabLabel: "AI Teacher" | "Learn"; + activeTabRoute: "/ai-teacher" | "/learn"; }; -function LessonTabBar({ activeTabLabel }: LessonTabBarProps) { +function LessonTabBar({ activeTabRoute }: LessonTabBarProps) { const insets = useSafeAreaInsets(); - const activeRoute = activeTabLabel === "AI Teacher" ? "/ai-teacher" : "/learn"; return ( ... - const isActive = item.route === activeRoute; + const isActive = item.route === activeTabRoute;Also applies to: 100-101, 761-768
🤖 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 `@components/audio-teacher-session.tsx` around lines 50 - 52, Replace the label-based prop with a route-based prop: change AudioTeacherSessionProps to use activeTabRoute: "/ai-teacher" | "/learn" (or Href) instead of activeTabLabel, update the component prop destructuring and type signature in the AudioTeacherSession component, and change all internal checks that compare activeTabLabel (e.g., tab switching logic and conditional rendering) to compare activeTabRoute against "/ai-teacher" or "/learn" directly; also update any callers of AudioTeacherSessionProps to pass the new activeTabRoute value.
🤖 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 `@data/course-lessons/shared.ts`:
- Around line 28-30: The code assumes seed.vocabulary has items and directly
uses seed.vocabulary[0]/[1], which can be undefined and crash createLesson when
building goals/activities; add a guard at the start of createLesson to handle
empty or missing seed.vocabulary (e.g., if (!Array.isArray(seed.vocabulary) ||
seed.vocabulary.length === 0) either throw a clear error or set safe defaults
like primaryVocabulary = [] and secondaryVocabulary = primaryVocabulary) and
replace all direct accesses (primaryVocabulary, secondaryVocabulary and any
later uses in the goal/activity builders) to use these safe values so building
goals/activities (the code blocks referencing
primaryVocabulary/secondaryVocabulary around the goal/activity creation) cannot
dereference undefined.
In `@vision-agent/agent.py`:
- Around line 309-310: The two literals f"除非使用者明確要求換語言,否則不要用英文解釋、寒暄或串場。" and
f"英文、法文、西班牙文、日文、韓文等外語只能出現在本課要練習的目標單字或短句。" are plain strings incorrectly marked
as f-strings (causing Ruff F541); remove the leading f prefix from these string
literals in agent.py (where they appear in the list/sequence) so they become
normal string constants.
---
Outside diff comments:
In `@app/api/stream/audio-call`+api.ts:
- Line 1: The import of StreamClient from '`@stream-io/node-sdk`' is unresolved
and causing lint/typecheck failures; fix by replacing or installing the correct
SDK package and types (e.g., install the official Stream Node SDK package that
exports StreamClient or update the import to the correct module name), add or
install corresponding `@types` if needed, and annotate any implicit- any variables
used with StreamClient so TS no longer reports TS7006 (search for StreamClient
usage in this module). Also ensure ESLint import resolver is configured or
update the import to a path the resolver recognizes, then run npm run lint and
npm run typecheck and address remaining missing type declarations across
functions referenced in this diff until both pass.
---
Nitpick comments:
In `@components/audio-teacher-session.tsx`:
- Around line 50-52: Replace the label-based prop with a route-based prop:
change AudioTeacherSessionProps to use activeTabRoute: "/ai-teacher" | "/learn"
(or Href) instead of activeTabLabel, update the component prop destructuring and
type signature in the AudioTeacherSession component, and change all internal
checks that compare activeTabLabel (e.g., tab switching logic and conditional
rendering) to compare activeTabRoute against "/ai-teacher" or "/learn" directly;
also update any callers of AudioTeacherSessionProps to pass the new
activeTabRoute value.
In `@vision-agent/agent.py`:
- Around line 369-383: The opening_prompt and the earlier prompt strings
currently hardcode "台灣國語"; change them to use the module constant USER_LANGUAGE
instead so config changes propagate. Locate the block that sets opening_prompt
(and any nearby literal prompt strings used when custom_data is present) and
replace the hardcoded language with USER_LANGUAGE, preserving the rest of the
text and concatenation and keeping calls to
build_teacher_instructions(custom=custom_data) and
apply_agent_instructions(agent, lesson_instructions) unchanged.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0878c903-307a-4d30-bc23-8ada5bd302c6
📒 Files selected for processing (28)
app/(tabs)/_layout.tsxapp/(tabs)/chat.tsxapp/(tabs)/home.tsxapp/(tabs)/learn.tsxapp/(tabs)/profile.tsxapp/LanguageSelection.tsxapp/api/stream/audio-call+api.tsapp/api/vision-agent/captions+api.tsapp/api/vision-agent/session+api.tsapp/lesson/[lessonId].tsxapp/onboarding.tsxcomponents/audio-teacher-session.tsxcomponents/auth-screen.tsxcomponents/bottom-tab-bar.tsxcomponents/lesson-card.tsxdata/course-lessons/chinese.tsdata/course-lessons/english.tsdata/course-lessons/french.tsdata/course-lessons/japanese.tsdata/course-lessons/korean.tsdata/course-lessons/shared.tsdata/course-lessons/spanish.tsdata/languages.tsdata/lessons.tsdata/units.tshooks/useStreamAudioCall.tsvision-agent/README.mdvision-agent/agent.py
…ateLesson 函數以確保詞彙項目有效性,並更新教師指示以使用動態語言變數。
…dd new lessons for Chinese, English, French, Japanese, Korean, and Spanish; implement shared lesson creation logic.
Summary by CodeRabbit
New Features
New Content
Localization
Improvements