Commit Graph

90 Commits

Author SHA1 Message Date
Théo Poizat 04696eecd7 Get and build prompt from local JSON file
Here we map our AI actions to the prompt from the JSON file
to be able to use them.
2026-03-25 11:52:35 +07:00
Théo Poizat 11fd808080 Add prompts.json in Scribe package
This is a default prompts.json used when no other will be available.
2026-03-25 11:52:35 +07:00
Théo Poizat fabf3ec54f Manage prompts as a "messages" object during prompt lifecycle
Before, our prompts were just a string like "Translate this text:
user text" and just before being sent to the backend, it was
converted to an "messages" object compatible with OpenAI API like [{
"role": "user", "content": "Translate this text: user text"}].

Now, we use "messages" object directly when building the prompt
because in the near future we will create more complex prompts with
system content and user content so we will need "messages" object
dirrectly.
2026-03-25 11:52:35 +07:00
Théo Poizat 2ab6e0df02 [Scribe] Add Improve button (#4335) 2026-03-25 11:52:35 +07:00
Théo Poizat c8253551b1 Add a toolbar to execute quick actions to Scribe suggestion
Actions :
 - copy
- regenerate
2026-03-25 11:52:35 +07:00
Théo Poizat 4ba6184a69 Rename bottomsheetIcon to secondaryIcon
To be able to reuse this color without loosing a correct semantic name.
2026-03-25 11:52:35 +07:00
dab246 b64aa4e4c7 feat(scribe-mobile):Fix sometimes the top part is cut off 2026-03-25 11:52:35 +07:00
dab246 5937055789 feat(scribe-mobile): Display the result prompt modal in the correct position relative to the inline scribe button on tablet 2026-03-25 11:52:35 +07:00
Théo Poizat 170bdd28c9 Autofocus Scribe input bar
Help user use the Scribe input bar. Also solves issues where Scribe bar is not well positioned when focused is removed from "To" field.
2026-03-25 11:52:35 +07:00
Théo Poizat d035e40853 fixup! Display Scribe modals correctly when a keyboard is opened
Manage multiline content in scribe bar and spacing between keyboard and scribe bar
2026-03-25 11:52:35 +07:00
Théo Poizat 269ca7116c Display Scribe modals correctly when a keyboard is opened 2026-03-25 11:52:35 +07:00
Théo Poizat ed53929323 fixup! Display Scribe mobile (bottomsheet) only when responsive mobile 2026-03-25 11:52:35 +07:00
Théo Poizat 03a03b9088 Fix Scribe on responsive mobile
- Button was not added in MobileResponsiveAppBar
- Mobile behavior related scripts were not correctly added for web composer
- Mobile behavior related scripts return value was not properly handled for web composer
- In responsive web, bottomsheet modal clicks were intercepted by iframe behind
2026-03-25 11:52:35 +07:00
Théo Poizat 17b9d97284 Adjust Scribe context menu to support tablet screens
- Support tap in addition to hover for context menu
- Improve clamping for greater screen sizes to avoid Scribe getting off screen
- Set a padding to 0 to avoid random padding depending on screen sizes
2026-03-25 11:52:35 +07:00
Théo Poizat 7a6a49fc7b Display Scribe mobile (bottomsheet) only when responsive mobile
Previosuly, we display Scribe mobile (bottomsheet) if platform was mobile, so also Android or iOS tablet.

Now we choose to display Scribe mobile relatively to display screens instead of platform to display the desktop Scribe (context menu) for tablets.
2026-03-25 11:52:35 +07:00
Théo Poizat 6540ed29d1 Add current text in a card in Scribe mobile
Because the Scribe mobile is a full screen modal, we do not see the
current content (so either the selected text or entire composer text)
when selecting our AI actions.

That's why we add here a scrollable card that displays the current
content.
2026-03-25 11:52:35 +07:00
Théo Poizat abd2453511 Do not display Scribe actions if no content in composer in mobile 2026-03-25 11:52:35 +07:00
Théo Poizat 84176cb113 Hide keyboard and selection icons when Scribe mobile modal opened
When opening Scribe mobile modal, we now unfocus the composer to hide the keyboard and the selection start and end icons from the OS.

Add new methods to save, restore, and clear text selection in HTML editor. These methods allow preserving and restoring user selection state when opening the Scribe mobile modal so that the "replace" action still works.
2026-03-25 11:52:35 +07:00
Théo Poizat 09fe002d3c Use proper icons and styles for bottomsheet icons in Scribe 2026-03-25 11:52:35 +07:00
Théo Poizat 14f2e557fa Add Scribe mobile
Same features than Scribe desktop but as a full screen modal instead of  a context menu.

Reuse menu and submenu components.
Reuse suggestion components.
Reuse 99% of Scribe desktop style.
2026-03-25 11:52:35 +07:00
Théo Poizat 089eb7b75f Fix correct grammar icon not present in submenu getIcon 2026-03-25 11:52:35 +07:00
Théo Poizat 0f4ed4537e Remove unused localizations arguments in Scribe suggestion 2026-03-25 11:52:35 +07:00
Théo Poizat 5abce414d4 Guard Scribe suggestion loading if interactor is null 2026-03-25 11:52:35 +07:00
Théo Poizat 5bdcff5aba Extract Scribe menu item text and icons in components 2026-03-25 11:52:35 +07:00
Théo Poizat d5a3400bb4 Allow boxShadow to be changed in AIScribeBar
We will need a custom boxShadow for mobile version.
2026-03-25 11:52:35 +07:00
Théo Poizat 4c75ec863d Extract AI Scribe menu item component
Scribe is always composed of menu (aka category) and submenu (aka action) :
- submenu item UI was already in an UI only component. I moved it to items folder.
- menu item UI was mixed in a component with desktop related UX. So I extract the UI to create an UI only component. I moved it also to items folder.
2026-03-25 11:52:35 +07:00
Théo Poizat 08899b1598 Extract AI Scribe suggestion logic
In Scribe desktop, the suggestion is displayed in a popup.
In Scribe mobile, it will be displayed in a full screen modal.

But it share the same logic about loading, success and error.

So here I extract this logic and use it in the AI Scribe desktop to be able to use it later in AI Scribe mobile.
2026-03-25 11:52:35 +07:00
dab246 2e8a11e7eb refactor(sentry): standardize exceptions to prevent Sentry minification 2026-03-10 11:06:16 +07:00
Théo Poizat b6959a5ab6 Add an animated AI icon for Scribe in desktop web
I moved the previous static icon in its own component and created a component that manage the loading of the appropriate icon: static or dynamic.
2026-02-09 23:29:43 +07:00
Théo Poizat 34e1dffa0a Add lottie package
To display lottie animation in web
2026-02-09 23:29:43 +07:00
Théo Poizat 7a4d0dbf46 Add missing languages in Scribe
To fit languages supported in tmail settings
2026-02-03 14:26:28 +07:00
Théo Poizat 5f2e4512bc Ensure fallback to English for unsupported locales in Scribe
- Implement locale validation with fallback to 'en'
- Disable automatic default locale setting
2026-02-03 14:26:28 +07:00
Théo Poizat 8b71b1e995 Fix some Scribe translations
- Added missing translations
- Removed missing translations
- Some small translations updates
2026-02-03 14:26:28 +07:00
Théo Poizat d739b61c83 Fix Scribe translations by using multiple_localization package
Even if all keys were translated, Scribe UI was always in default
language.

In short, it is not possible to load multiple localization delegates
with different .arb files. But we need these translations to be
located in a separate file because in the future we will move Scribe
in a separate module.

See
https://github.com/Innim/flutter_multiple_localization for more
explanation.
2026-02-03 14:26:28 +07:00
dab246 94fd6f8071 TF-4195 Add Label to Thread 2026-01-19 11:34:43 +07:00
dab246 5b94e23427 TF-4193 Update missing dependency in pubspec.lock of scribe module 2026-01-19 11:34:43 +07:00
dab246 b6f7f7d846 TF-4136 Fix duplicate Executor instance creation. 2026-01-15 09:46:51 +07:00
dab246 1514136f39 TF-4136 Replace logError to logWarning for some place 2026-01-15 09:46:51 +07:00
dab246 fedb8fed93 TF-4136 Apply early exit to prevent string operation in log 2026-01-15 09:46:51 +07:00
dab246 ec75bb3cab TF-4136 Add config Sentry 2026-01-15 09:46:51 +07:00
dab246 ad768f1552 TF-4223 Fix welcome email is not well displayed 2026-01-12 05:16:02 +07:00
dab246 29b54a76ee hotfix(ai-scribe): fix Safari keyboard input issue in AI Scribe search bar dialog 2025-12-23 17:27:26 +07:00
dab246 6e09d853fd feat(ai-scribe): Fix the English locale file `(intl_en.arb)` is missing all three AI Scribe keys
feat(ai-scribe): Fix async function declared without proper return type annotation.

feat(ai-scribe): Fix Async operations not properly awaited.

feat(ai-scribe): Fix inconsistent capitalization between button labels.

feat(ai-scribe): Fix GenerateAITextFailure check will never match.

feat(ai-scribe): Fix consider validating text input for predefined actions.

feat(ai-scribe): Using a subshell for directory isolation.

feat(ai-scribe): Fix verify the mock usage or document intent.

feat(ai-scribe): Using a more conventional import for Offset.

feat(ai-scribe): Adding error handling for consistency

feat(ai-scribe): Remove `fromJson` and `toJson` of AIResponse

feat(ai-scribe): Using constants for role values.

feat(ai-scribe): Using a more specific import.

feat(ai-scribe): Using Timer for cleaner lifecycle management

feat(ai-scribe): Adding error handling to fromMap() for consistency.

feat(ai-scribe): Disposing the ValueNotifier

feat(ai-scribe): Redundant null check after assignment

feat(ai-scribe): Fix calling `registerSelectionChangeListener` multiple times may be inefficient.

feat(ai-scribe): Safer type handling for JavaScript callback args

feat(ai-scribe): Fix async callbacks not awaited in switch statement.

feat(ai-scribe): Fix binding lifecycle mismatch for GetAIScribeConfigInteractor

feat(ai-scribe): Fix ai prompts

feat(ai-scribe): Fix unawaited async call to `_setupSelectionListener`

feat(ai-scribe): Fix switch cases use top-origin coordinates while `PositionedDirectional(bottom:)`` expects bottom-origin coordinates.

feat(ai-scribe): Adding error handling for selection listener setup.
2025-12-19 19:03:39 +07:00
dab246 6e56a50713 feat(ai-scribe): Load AI scribe config in dashboard 2025-12-19 19:03:39 +07:00
Théo Poizat 68e55a0e22 Improve AI Scribe prompts
- Mutualize some commands
- Avoid unexpected behavior
2025-12-19 19:03:39 +07:00
dab246 088b922b0e feat(ai-scribe): Fix alignment of prompt when AI button at very right of composer or response have long result but at the bottom of composer 2025-12-19 19:03:39 +07:00
dab246 89eb1ecc71 feat(ai-scribe): Fix click on response text of AI, dialog to be disappeared 2025-12-19 19:03:39 +07:00
Théo Poizat 9a8989a310 Make the AI Scribe suggestion success selectable text 2025-12-19 19:03:39 +07:00
dab246 fd33ccf5e4 feat(ai-scribe): Auto hide Replace action when perform prompt in new email without content 2025-12-19 19:03:39 +07:00
dab246 d62b3db985 feat(ai-scribe): Add Enter to send prompt directly and Shift + Enter to add new line 2025-12-19 19:03:39 +07:00