forked from Blizaine/Maestro
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(wizard): separate UI, conversation and content languages #108
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 all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
163ec21
feat(wizard): add durable multilingual intent contract
00704b5
Merge remote-tracking branch 'origin/main' into feat/wizard-language-…
7bc07e1
test(wizard): cover embedded multilingual live flow
6527e61
fix(wizard): persist language-only project intent
964dc99
fix(wizard): keep technical-only language intent
3def3bb
refactor(story): isolate language intent application
8b3c2fe
Merge remote-tracking branch 'origin/main' into feat/wizard-language-…
f3a6839
test(e2e): allow isolated preview ports
c8a11ee
fix(wizard): validate projects before language persistence
6336f55
fix(wizard): protect quoted user text deterministically
2ad3961
fix(wizard): honor explicit quoted speech language
66b2096
docs(i18n): explain deterministic literal protection
ed7ef13
refactor(wizard): keep language helpers behind capability port
7f5c753
fix(wizard): keep language updates transactional
65a975d
refactor(series): compare canon language semantically
9b361ce
fix(labs): keep visible language fields canonical
ee9c1e5
fix(series): preserve precise spoken language
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| """Canonical language intent for durable creative projects. | ||
|
|
||
| UI locale is deliberately absent: it is presentation state and cannot choose | ||
| the language of authored content or provider prompts. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
|
|
||
| VERBATIM_KINDS = {"dialogue", "lyrics", "visible_text", "subtitle", "name"} | ||
|
|
||
|
|
||
| def _text(value: Any, limit: int = 120) -> str: | ||
| return str(value or "").strip()[:limit] | ||
|
|
||
|
|
||
| def normalize_language_intent( | ||
| value: Any, | ||
| *, | ||
| content_language: str = "", | ||
| spoken_language: str = "", | ||
| ) -> dict[str, Any]: | ||
| """Accept LLM snake_case or persisted camelCase and return canonical JSON.""" | ||
| raw = value if isinstance(value, dict) else {} | ||
| raw_segments = raw.get("verbatimSegments", raw.get("verbatim_segments", [])) | ||
| segments: list[dict[str, str]] = [] | ||
| for candidate in raw_segments if isinstance(raw_segments, list) else []: | ||
| if not isinstance(candidate, dict): | ||
| continue | ||
| kind = _text(candidate.get("kind"), 40) | ||
| literal = str(candidate.get("text") or "")[:12_000] | ||
| if kind not in VERBATIM_KINDS or not literal.strip(): | ||
| continue | ||
| segment = { | ||
| "kind": kind, | ||
| "text": literal, | ||
| "language": _text(candidate.get("language")), | ||
| } | ||
| speaker = _text(candidate.get("speaker"), 300) | ||
| if speaker: | ||
| segment["speaker"] = speaker | ||
| segments.append(segment) | ||
| if len(segments) >= 40: | ||
| break | ||
| technical = _text( | ||
| raw.get("technicalPromptLanguage", raw.get("technical_prompt_language", "en")), | ||
| 20, | ||
| ) | ||
| return { | ||
| "conversationLanguage": _text( | ||
| raw.get("conversationLanguage", raw.get("conversation_language")) | ||
| ), | ||
| "contentLanguage": _text( | ||
| raw.get("contentLanguage", raw.get("content_language", content_language)) | ||
| ), | ||
| "spokenLanguage": _text( | ||
| raw.get("spokenLanguage", raw.get("spoken_language", spoken_language)) | ||
| ), | ||
| "technicalPromptLanguage": "auto" if technical == "auto" else "en", | ||
| "verbatimSegments": segments, | ||
| } |
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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.