-
Notifications
You must be signed in to change notification settings - Fork 0
feat: bilingual practice agent with helping phrases #4
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
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1718789
feat: bilingual practice agent with helping phrases
5c26c30
feat: ensure all encouragement/corrections in instruction_language + …
4940e98
feat: add conversation logging to realtime router + load helping phrases
c2bb4f1
fix: move /helping-phrases route before /{lesson_number}
45b0a0a
feat: add 'End Session' button that disconnects realtime WebSocket
e1e0a20
chore: add system prompt logging to realtime router for debugging
9be099d
chore: add detailed realtime event logging for debugging
a795e54
fix: handle content filter and empty audio errors in realtime session
3d6ad8b
feat: move helping phrases to chat bubble in conversation view
61c09e6
fix: handle null status_details in response.done event
20d89c2
fix: check error code field for empty audio buffer detection
fdc09ea
fix: add auto-scroll to mobile chat overlay
20dbe35
fix: address Copilot code review feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| """Add helping phrases table for bilingual practice support. | ||
|
|
||
| Revision ID: 005_add_helping_phrases | ||
| Revises: 004_add_jwt_auth | ||
| Create Date: 2026-01-28 | ||
|
|
||
| Helping phrases allow students to request assistance during practice | ||
| in their native language (e.g., "No entiendo", "Repite, por favor"). | ||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "005_add_helping_phrases" | ||
| down_revision: Union[str, None] = "ef47914574a5" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # Create helping_phrases table | ||
| op.create_table( | ||
| "helping_phrases", | ||
| sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), | ||
| sa.Column("language_code", sa.String(10), nullable=False), | ||
| sa.Column("phrase_key", sa.String(50), nullable=False), | ||
| sa.Column("phrase_text", sa.String(200), nullable=False), | ||
| sa.Column("english_meaning", sa.String(200), nullable=False), | ||
| sa.Column("usage_context", sa.Text(), nullable=True), | ||
| sa.Column("display_order", sa.Integer(), default=0), | ||
| sa.Column( | ||
| "created_at", sa.DateTime(), server_default=sa.func.now(), nullable=False | ||
| ), | ||
| sa.UniqueConstraint("language_code", "phrase_key", name="uq_helping_phrase_lang_key"), | ||
| ) | ||
|
|
||
| # Create index for language lookups | ||
| op.create_index( | ||
| "ix_helping_phrases_language_code", | ||
| "helping_phrases", | ||
| ["language_code"], | ||
| ) | ||
|
|
||
| # Seed Spanish helping phrases | ||
| op.execute( | ||
| """ | ||
| INSERT INTO helping_phrases (language_code, phrase_key, phrase_text, english_meaning, usage_context, display_order) VALUES | ||
| ('es', 'repeat', 'Repite, por favor', 'Please repeat', 'When you did not catch what was said', 1), | ||
| ('es', 'dont_understand', 'No entiendo', 'I don''t understand', 'When you need an explanation', 2), | ||
| ('es', 'slower', 'Más despacio, por favor', 'Slower, please', 'When speaking is too fast', 3), | ||
| ('es', 'example', 'Dame un ejemplo', 'Give me an example', 'When you need a concrete example', 4) | ||
| """ | ||
| ) | ||
|
|
||
| # Seed English helping phrases (for English-speaking learners) | ||
| op.execute( | ||
| """ | ||
| INSERT INTO helping_phrases (language_code, phrase_key, phrase_text, english_meaning, usage_context, display_order) VALUES | ||
| ('en', 'repeat', 'Please repeat', 'Please repeat', 'When you did not catch what was said', 1), | ||
| ('en', 'dont_understand', 'I don''t understand', 'I don''t understand', 'When you need an explanation', 2), | ||
| ('en', 'slower', 'Slower, please', 'Slower, please', 'When speaking is too fast', 3), | ||
| ('en', 'example', 'Give me an example', 'Give me an example', 'When you need a concrete example', 4) | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_index("ix_helping_phrases_language_code", table_name="helping_phrases") | ||
| op.drop_table("helping_phrases") | ||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Migration header comment says "Revises: 004_add_jwt_auth" but down_revision points to "ef47914574a5". Update the docstring metadata so it matches the actual Alembic dependency chain to avoid confusion during maintenance/review.