Compare commits

...

1738 Commits

Author SHA1 Message Date
Enrico Ros 6ba1afa540 ChatDrawer: virtualize scroll (for very numerous chats) 2025-01-15 00:49:43 -08:00
Enrico Ros 04e54d898e ChatDrawer: optimize hook 2025-01-15 00:18:41 -08:00
Enrico Ros 20a85a5dfb Web Links: per-link options 2025-01-14 22:17:04 -08:00
Enrico Ros 849eb58a8f AIX: un-race-cond, debug-last-request 2025-01-14 21:50:56 -08:00
Enrico Ros 558d73a858 AIX: only stream 'conversation' messages in dev mode 2025-01-14 21:24:49 -08:00
Enrico Ros e6948d4186 Clarify 'Link Message' 2025-01-14 21:02:28 -08:00
Enrico Ros 55e2e09797 Restore non-relaxed URL casting. Only cast it on the WIM. 2025-01-14 20:56:51 -08:00
Enrico Ros b2a3b78d44 Improve the dark mode toggle 2025-01-14 09:38:53 -08:00
Enrico Ros 135c957b7e Fix half px 2025-01-14 09:38:39 -08:00
Enrico Ros 624b99c8fe Browse: more informative 2025-01-14 09:24:19 -08:00
Enrico Ros fef0b27a33 Browse/Google: copy 2025-01-14 09:22:38 -08:00
Enrico Ros 75897cc162 Settings: improve icons 2025-01-14 09:22:22 -08:00
Enrico Ros 26733d6fea Remove /browse since we have better support 2025-01-14 09:06:26 -08:00
Enrico Ros 2a29ccdcf5 Browse: improve messaging 2025-01-14 09:01:17 -08:00
Enrico Ros efdcf26c10 Browse: improve desc 2025-01-14 08:48:48 -08:00
Enrico Ros 89d915a266 Move auto-speak to the right section 2025-01-14 08:46:12 -08:00
Enrico Ros 31c9b5c516 Settings: style more 2025-01-14 08:45:56 -08:00
Enrico Ros b9563eaac9 Settings: style 2025-01-14 08:12:08 -08:00
Enrico Ros 396abe01ec GCE: add site restriction 2025-01-14 07:47:20 -08:00
Enrico Ros 6880ba8651 Tool.Search: return 10 items. 2025-01-14 07:47:16 -08:00
Enrico Ros 4aa0d4a8ae Improved the Clean HTML function 2025-01-12 03:28:58 -08:00
Enrico Ros 50ede8baa8 misc 2025-01-12 03:28:55 -08:00
Enrico Ros 685edd12b9 o1: option to restore markdown 2025-01-12 01:11:46 -08:00
Enrico Ros 213241eae9 Web Input: multiball 2025-01-12 00:13:59 -08:00
Enrico Ros 2b9a5b5746 Improve URL validations 2025-01-12 00:13:59 -08:00
Enrico Ros 6ea0347a06 YT: don't clog the console 2025-01-12 00:13:59 -08:00
Enrico Ros 0df68444b3 Web Input Modal 2025-01-12 00:13:59 -08:00
Enrico Ros 290fd285c5 Fix composer icons stretch 2025-01-11 21:04:36 -08:00
Enrico Ros bd0b60ad26 Attach web pages 2025-01-11 21:03:48 -08:00
Enrico Ros d3c7daac50 Puppeteer: client with mostly unsupported downloads (disabled by default) 2025-01-11 20:43:53 -08:00
Enrico Ros c7805566ae Puppeteer: allow file download 2025-01-11 20:20:26 -08:00
Enrico Ros 6be3f274ed Browsing: fix timeouts with streaming results conversion 2025-01-11 20:18:15 -08:00
Enrico Ros 40d05771c1 Doc edit pane: improve edit buttons, swap the order for assistant segments 2025-01-11 16:12:43 -08:00
Enrico Ros dfec14620d CodePanelFrame: remove visual-flow-breaking borders 2025-01-11 16:09:45 -08:00
Enrico Ros 27f57d6f22 BlockEdit_TextFragment: support square top rad 2025-01-11 15:51:44 -08:00
Enrico Ros 78db633f25 Attachments: new attach buttons 2025-01-11 15:43:54 -08:00
Enrico Ros 440f368c36 CodePanelFrame: selected border 2025-01-11 15:43:49 -08:00
Enrico Ros 78186ad442 useAttachmentDrafts: support direct URL attachments, rather than through pastes or drag/drop 2025-01-11 15:43:46 -08:00
Enrico Ros 75182df441 YouTube URLs - improve matching, incl regional, shortlinks, etc. 2025-01-11 15:43:43 -08:00
Enrico Ros 213de18ecc AIX: dispatchers reuse the same doc wrapping 2025-01-10 03:50:01 -08:00
Enrico Ros 08437f1e8d AIX: broaden Docs support 2025-01-10 03:49:57 -08:00
Enrico Ros 3ba9200d0c AIX: skip Anthropic cache-control on empty system messages 2025-01-10 01:16:54 -08:00
Enrico Ros 1ad20a1579 AIX: Gemini: assumption fix 2025-01-10 01:16:50 -08:00
Enrico Ros 1a53484064 AIX: Gemini: multi-key support. Fixes #653 2025-01-10 00:58:10 -08:00
Enrico Ros bdcbf7ebc8 AIX: Gemini: pre-fix protocol wire 2025-01-10 00:41:45 -08:00
Enrico Ros 25b0cb47ac Fix a disabled menu option 2025-01-10 00:40:11 -08:00
Enrico Ros a1fa8d6480 AIX: update Gemini's wires 2025-01-10 00:40:01 -08:00
Enrico Ros 3240e527e8 Gemini: add 'OFF' safety filtering. Fixes #718, Fixes #720 2025-01-10 00:34:58 -08:00
Enrico Ros fa80848dd5 Attachments: show caption in tooltip 2025-01-09 22:49:16 -08:00
Enrico Ros 085f97b10c LFS: support missing callbacks 2025-01-09 21:49:13 -08:00
Enrico Ros d96937a92f DocAttachmentFragment: auto-disable when outside a workspaceId provider 2025-01-09 21:42:22 -08:00
Enrico Ros e2cd16d5d2 ScrollToBottom: allow use outside of a provider 2025-01-09 21:41:38 -08:00
Enrico Ros 9a783ebe6d Doc Attachments: improve lines 2025-01-09 21:41:35 -08:00
Enrico Ros 1db98ea0b0 Don't crash here also 2025-01-09 19:12:37 -08:00
Enrico Ros 775808c472 Don't crash here 2025-01-09 19:12:29 -08:00
Enrico Ros 251f57372c LLMAttachments: allow files wrapping 2025-01-09 19:12:28 -08:00
Enrico Ros 32b0ac2fa1 LLMAttachments: allow absence of inlining ops 2025-01-09 19:12:28 -08:00
Enrico Ros dc5b338914 Fragments: quick out 2025-01-09 19:12:24 -08:00
Enrico Ros 473a73d2c5 Fragments: splitting utility function 2025-01-09 19:12:24 -08:00
Enrico Ros d303a24300 Fragments: move buckets hook 2025-01-09 19:12:20 -08:00
Enrico Ros c8cbeffda3 LLMAttachments: made the AGI prompts optional 2025-01-09 17:18:44 -08:00
Enrico Ros b1d94e790f AttachmentDraftsStoreApi: improve typing 2025-01-09 17:18:43 -08:00
Enrico Ros 59966546cf Uniform Attach buttons 2025-01-09 16:06:08 -08:00
Enrico Ros 31eac468bc Add .disabled 2025-01-09 16:06:06 -08:00
Enrico Ros 672cc4801b Attachments: document the main hook 2025-01-09 16:06:03 -08:00
Enrico Ros 9e7b950cda Attachments: rename enableLoadURLsOnPaste 2025-01-09 16:06:00 -08:00
Enrico Ros 21e0180e88 Attachments: single vanilla store option 2025-01-09 16:05:58 -08:00
Enrico Ros e2801a0fef Attachments: rename slice 2025-01-09 16:05:55 -08:00
Enrico Ros 9ae9170ddb DLLMs: ModelConfigurations 2025-01-09 13:11:36 -08:00
Enrico Ros 7a092a9140 DLLMs: Config: pad context window 2025-01-09 04:42:03 -08:00
Enrico Ros d453adc438 DLLMs: Options: Visual indication of overrides over the baseline 2025-01-09 04:42:03 -08:00
Enrico Ros e5e9f489d3 DLLMs: Recyclable Parameters configurator 2025-01-09 02:33:42 -08:00
Enrico Ros 792f3f20f7 Confirmation Modal: remove warning 2025-01-09 00:44:26 -08:00
Enrico Ros 2581632f4b Roll packages 2025-01-08 22:27:31 -08:00
Enrico Ros 7c4df2cbf5 DLLMs: improve param typing on store-llms, for decoupling 2025-01-08 22:20:43 -08:00
Enrico Ros 5af67e4be8 LLM Select: miniscule change 2025-01-08 22:20:41 -08:00
Enrico Ros eaa534d590 Improve useLLM() 2025-01-08 22:20:38 -08:00
Enrico Ros f8630e3213 Optima Dropdowns: fix labels and decorators 2025-01-08 19:25:54 -08:00
Enrico Ros 48c64aed9f DLLMs: fix fallback value 2025-01-08 19:25:15 -08:00
Enrico Ros e7e5d2b901 Merge pull request #719 from Jonathan523/v2-dev
fix(gemini): fix FormHelperText for safety settings visibility
2025-01-08 09:30:07 -08:00
Jonathan Zhang 1051d6461c fix(gemini): make FormHelperText for safety settings invisible when advanced is not activated 2025-01-08 22:31:42 +08:00
Enrico Ros baec2b8a3a Use puppeteer-core for browsing instead of @cloudflare/puppeteer 2025-01-07 22:41:50 -08:00
Enrico Ros bfa5c510ef Fix punycode on eslint 2025-01-07 21:59:45 -08:00
Enrico Ros 970d024c10 Disable prisma hints 2025-01-07 20:59:19 -08:00
Enrico Ros bc74c97ca2 Revert "Improve useRef"
This reverts commit f593cb6b04.
2025-01-07 20:51:52 -08:00
Enrico Ros a5b92ec93a Lints 2025-01-07 20:33:55 -08:00
Enrico Ros f593cb6b04 Improve useRef 2025-01-07 20:33:55 -08:00
Enrico Ros 50717b339f Use @dnd-kit, remove the deprecated react-beautiful-dnd (thanks). Fixes #713 2025-01-07 19:23:38 -08:00
Enrico Ros 4400f33209 Roll pdfjs 2025-01-07 17:00:07 -08:00
Enrico Ros b2d21d3426 Image OCR: w/ text 2025-01-07 16:58:09 -08:00
Enrico Ros f9b102ffb8 Roll Tesseract (image OCR) 2025-01-07 16:55:47 -08:00
Enrico Ros 20d7d6b2ee Roll packages deep 2025-01-07 16:33:46 -08:00
Enrico Ros f947a650b0 Roll packages 2025-01-07 16:31:17 -08:00
Enrico Ros da2be7be50 Gemini: improve the chat message labels 2025-01-07 01:44:46 -08:00
Enrico Ros f1257556f3 Small cleanup post #716 2025-01-07 01:40:33 -08:00
Enrico Ros df3c4b5971 Merge pull request #716
feat: add custom API endpoint support for Google Gemini
2025-01-07 01:39:17 -08:00
Enrico Ros 403f5795f8 LLMOptions: restore the flame - Fixes #717 2025-01-07 01:15:56 -08:00
Jonathan Zhang e971db1c60 Merge branch 'enricoros:v2-dev' into v2-dev 2025-01-07 10:40:09 +08:00
Jonathan Zhang 9411cd4f9b fix: set advanced mode default to false in GeminiServiceSetup 2025-01-07 10:39:56 +08:00
Enrico Ros 271e5f3fc9 Grok: update models 2025-01-06 13:47:42 -08:00
Enrico Ros ce58fb5419 Together: update models 2025-01-06 13:05:05 -08:00
Jonathan Zhang ceca769a20 feat: add custom API endpoint support for Google Gemini 2025-01-06 14:20:15 +08:00
Enrico Ros 473f73c23f Optima Headings: _styles & Mobile 2024-12-31 15:00:06 -08:00
Enrico Ros aab84f6e67 PMix: renames 2024-12-31 04:39:21 -08:00
Enrico Ros 95e988dc9a PMix: parameters propagate 2024-12-31 03:10:09 -08:00
Enrico Ros 3cb9183cc0 PMix: parameters 2024-12-31 03:08:55 -08:00
Enrico Ros 79119c4770 PMix: remove former description 2024-12-31 03:08:09 -08:00
Enrico Ros 64933bea7e Recognize Emojis 2024-12-31 03:08:06 -08:00
Enrico Ros bae15f3bb6 Popups: improvements v2 2024-12-30 19:56:59 -08:00
Enrico Ros 35733e86b9 UI - Mobile: Nav 2024-12-30 19:56:59 -08:00
Enrico Ros e42dc3a755 UI - improve Mobile layout 2024-12-30 19:56:59 -08:00
Enrico Ros 215c45c823 UI - Chat Panels 2024-12-30 19:56:56 -08:00
Enrico Ros 6d68f599df UI - Panes & Mobile 2024-12-30 19:55:22 -08:00
Enrico Ros c5b4dadb83 Mermaid: stick errors 2024-12-30 17:27:29 -08:00
Enrico Ros 5d942eec41 Mermaid: update to 11.4.1 2024-12-30 16:40:09 -08:00
Enrico Ros 613665665d Beam: disable auto-stick on Mobile 2024-12-30 14:55:36 -08:00
Enrico Ros b14e28e03b Update icons 2024-12-30 14:42:26 -08:00
Enrico Ros 9969ccb530 getConversation: reduce usage 2024-12-30 14:19:23 -08:00
Enrico Ros ec9243b8dd Rename throwing head 2024-12-30 13:50:08 -08:00
Enrico Ros 8584a56a6d Beam: begin history rationalization 2024-12-30 13:41:00 -08:00
Enrico Ros af78068f48 Beam Fusion: sticky header 2024-12-30 12:42:46 -08:00
Enrico Ros 0a002a0d78 Beam Ray: edit with sticky header 2024-12-30 12:34:51 -08:00
Enrico Ros 66572a970f New Voice Chat intent 2024-12-30 12:03:13 -08:00
Enrico Ros ff1d3686b6 Call icon on Manifest 2024-12-30 11:32:38 -08:00
Enrico Ros 7626b48b70 AIX: suppress warning on completion_tokens=0 2024-12-30 10:59:54 -08:00
Enrico Ros 9bfcb50735 DeepSeek: cache pricing support 2024-12-29 23:54:54 -08:00
Enrico Ros c18be131a1 DeepSeek: V3 models 2024-12-29 23:54:42 -08:00
Enrico Ros 692a1ef90e Roll packages 2024-12-29 22:24:10 -08:00
Enrico Ros 3c3fae6039 Roll packages 2024-12-29 21:41:12 -08:00
Enrico Ros c090334093 require node 20+. fixes #710 2024-12-27 15:05:56 -08:00
Enrico Ros a2942a32e6 AIX: OpenAI: latest models 2024-12-24 20:49:55 -08:00
Enrico Ros 1bd327e410 AIX: OpenAI: wire support for Audio-input, Audio-output (non-streaming only), and Prediction (rewrite acceleration) modes. 2024-12-24 20:06:58 -08:00
Enrico Ros 557886f93f Support for per-model OpenAI Reasoning Effort settings. #698 2024-12-24 18:31:25 -08:00
Enrico Ros f52e35029c AIX: server-side Top-P 2024-12-24 18:17:33 -08:00
Enrico Ros b2d66af440 DLLMs: client-side OAI reasoning effort 2024-12-24 18:12:04 -08:00
Enrico Ros 897d7fb7e0 Optimize LLM Dropdown (skip rendering on invisible changes) 2024-12-24 17:29:59 -08:00
Enrico Ros 0407d228fb Merge pull request #706 from jayrepo/patch-1
link ssl3 for latest alpine
2024-12-23 23:13:59 -08:00
Enrico Ros a58f703744 DLLMs: o-models reasoning efforts 2024-12-23 02:48:34 -08:00
Enrico Ros 5186df3748 DLLMs: server-side-driven par-specs 2024-12-23 02:48:11 -08:00
Enrico Ros a5f0527eec DLLMs: keep user edits by default 2024-12-23 02:14:27 -08:00
Enrico Ros 6e851713b9 DLLMs: dynamic parameters system 2024-12-23 02:09:23 -08:00
Enrico Ros b4a586fab2 Optima page heading: add end deco 2024-12-22 23:00:18 -08:00
Enrico Ros cb2d6dbfd4 +react-hook-form 2024-12-22 23:00:15 -08:00
Enrico Ros 4162158413 useLLMSelect: optimize 2024-12-22 23:00:04 -08:00
Enrico Ros 18234ec199 ConfirmationModal: relax 2024-12-22 23:00:01 -08:00
Jay Chen 18dbf916ef link ssl3 2024-12-23 13:39:47 +08:00
Enrico Ros 26df5bc889 Optima: no gap dropdown 2024-12-20 01:47:16 -08:00
Enrico Ros 0f33ae1a8d AIX: demuxer dev message 2024-12-20 00:44:53 -08:00
Enrico Ros e7a463399f Gemini: another removed model 2024-12-20 00:42:27 -08:00
Enrico Ros 632efafcbd Anthropic: dynamic models list - still need hardcoded details 2024-12-20 00:39:58 -08:00
Enrico Ros bfbfe4d122 Gemini: roll models 2024-12-19 17:05:58 -08:00
Enrico Ros 21f42159c8 OpenAI: o1 support: image inputs, dev messages, reasoning, etc. 2024-12-19 16:32:29 -08:00
Enrico Ros b750a2bb9b AIX: OpenAI: server-side dispatch developer message 2024-12-19 16:32:29 -08:00
Enrico Ros 475ff1e88e AIX: client-side HotFixes 2024-12-19 16:18:58 -08:00
Enrico Ros c2a577bf65 LLMs: update model interfaces 2024-12-19 16:18:22 -08:00
Enrico Ros 12f4fdde93 AIX: OpenAI wire: support 'developer' messages 2024-12-19 16:17:50 -08:00
Enrico Ros db0aa36ccb UI: Add breadcrumbs support 2024-12-19 14:26:27 -08:00
Enrico Ros 69192689b8 Optima Page heading: made tagline optional 2024-12-19 14:26:27 -08:00
Enrico Ros 078c6400ba Update heading 2024-12-19 11:23:14 -08:00
Enrico Ros 6074a5bb16 Gemini: update wiretypes 2024-12-19 01:11:54 -08:00
Enrico Ros 79c71a1740 Optima: page heading 2024-12-19 00:35:47 -08:00
Enrico Ros caa9cb6a16 Hook for uiComplexityMode 2024-12-19 00:35:47 -08:00
Enrico Ros 795126ccde roll packages 2024-12-18 11:19:41 -08:00
Enrico Ros 7728efebad Continue system message encapsulation 2024-12-17 12:07:02 -08:00
Enrico Ros a896cb827a v2-dev: begin docker build 2024-12-16 23:51:21 -08:00
Enrico Ros b9c62b45f9 Merge pull request #695 from matrix303/matrix303/issue694
[BUG] DockerFile Build -- suggest update to node:22-alpile
2024-12-16 23:07:24 -08:00
Enrico Ros 9e2f815e1e Relocate helpers 2024-12-16 22:50:30 -08:00
Enrico Ros f88c18ddde Helper for system instruction split 2024-12-16 21:31:00 -08:00
matrix303 2de70fa87d [BUG] DockerFile Build -- suggest update to node:22-alpile
Fixes #694
2024-12-16 18:03:21 +00:00
Enrico Ros eb49717065 UI Bits 2024-12-15 21:45:22 -08:00
Enrico Ros 268b1d8a19 Conversation Zero state 2024-12-15 21:10:32 -08:00
Enrico Ros 8768d9e946 Fix helper 2024-12-15 20:33:42 -08:00
Enrico Ros d83d29054d Drawer: show where to remove but don't do it - makes transitions slow 2024-12-15 19:51:16 -08:00
Enrico Ros c39e378235 systemInstruction: support null 2024-12-15 15:04:19 -08:00
Enrico Ros 7be72acff3 Helper for conceptual system instruction split 2024-12-15 12:53:18 -08:00
Enrico Ros 41a2f1e526 Actile: improve, multi-provider, label attachments 2024-12-15 12:04:37 -08:00
Enrico Ros 36eda51789 Conceptually split the system Instruction with the rest of the history 2024-12-12 17:59:37 -08:00
Enrico Ros 6ffcb731a3 Personas: allow to switch out null personas 2024-12-12 17:41:40 -08:00
Enrico Ros ce9fcbd4a1 Typeshift: prework 1 2024-12-11 15:38:22 -08:00
Enrico Ros 022cdd0b37 disable dead protocol code 2024-12-11 15:38:09 -08:00
Enrico Ros ab5b6f1769 Fix: store-chats: don't partialize if there's a single chat 2024-12-11 15:04:10 -08:00
Enrico Ros 1811e31ea5 Gemini: update models, including 2.0 Flash 2024-12-11 14:47:58 -08:00
Enrico Ros b0430b0a18 Mobile llm options fix 2024-12-11 14:47:32 -08:00
Enrico Ros 122d6c9da5 Show Free models 2024-12-11 14:47:22 -08:00
Enrico Ros 480aaed108 remove optional package 2024-12-11 14:31:01 -08:00
Enrico Ros bf312265de more roll packages 2024-12-11 14:23:50 -08:00
Enrico Ros ea15d8e0e9 roll pdfjs 2024-12-11 14:07:21 -08:00
Enrico Ros 0947100b13 roll packages 2024-12-11 14:05:44 -08:00
Enrico Ros c0dca032e4 Cleanup after AIX migration 2024-12-11 14:00:52 -08:00
Enrico Ros f0df743f12 Remove messageSingleTextOrThrow 2024-12-11 14:00:52 -08:00
Enrico Ros b6ee04e140 Persona Viewer: fix 2024-12-11 01:03:20 -08:00
Enrico Ros 75333df458 OpenRouter: update models sorting 2024-12-10 22:43:15 -08:00
Enrico Ros f980bffd11 Ollama: default context to 4096 2024-12-10 22:24:39 -08:00
Enrico Ros 8aeb4dce76 Ollama: doc PNG images 2024-12-10 22:15:29 -08:00
Enrico Ros 24e8539b3e Ollama: update dispatch, Fixes #678 2024-12-10 22:00:41 -08:00
Enrico Ros 8bc118c060 Ollama: update models 2024-12-10 21:35:18 -08:00
Enrico Ros f0e595b3ff Gemini: forcefully delete the models replaced without official comms/updates. Fixes #690 2024-12-10 21:10:50 -08:00
Enrico Ros 44b9eebe1c Don't use GitHub as CDN - Fixes #691 2024-12-10 20:49:45 -08:00
Enrico Ros 68630a0bd5 Persona Creator: correct display. #685 2024-12-10 20:39:54 -08:00
Enrico Ros 3bf0c10b42 AIX: calls: no system messages 2024-12-10 20:39:54 -08:00
Enrico Ros 6fcd87aba7 AIX: misc 2024-12-10 20:39:54 -08:00
Enrico Ros 4183e1e2c5 AIX: remove llms's legacy VChatMessage and llmStreamingChatGenerate 2024-12-10 20:39:54 -08:00
Enrico Ros 2506d60058 AIX: port Telephone (aixCGR_fromHistory) 2024-12-10 20:39:54 -08:00
Enrico Ros 7221151f2f AIX: port Persona Creator (LLMChain) 2024-12-10 18:53:30 -08:00
Enrico Ros 4c259eb9e5 AIX: port FlattenerModal (useStreamChatText) 2024-12-10 17:51:21 -08:00
Enrico Ros 334b3aba86 idUtils: nanoId -> uuidv4 2024-12-09 17:26:03 -08:00
Enrico Ros 83e601ad3a idUtils: add uuidV4 2024-12-09 17:25:54 -08:00
Enrico Ros 6e8a25bc23 Beam: remove /beam, it's not really a command 2024-12-09 17:22:41 -08:00
Enrico Ros 70764e9ca2 Gemini: support for 1206 2024-12-06 12:17:34 -08:00
Enrico Ros 148eba8feb OpenAI: o1: re-enable streaming 2024-12-06 12:17:34 -08:00
Enrico Ros 0ee2d04d48 OpenAI: resort 2024-12-06 12:17:34 -08:00
Enrico Ros 311b91788b OpenAI: wire notes 2024-12-06 12:17:34 -08:00
Enrico Ros ab30bf213c OpenAI: update models 2024-12-06 12:17:34 -08:00
Enrico Ros f0cb5c63cf Models list: more compact on mobile 2024-12-06 12:17:34 -08:00
Enrico Ros b8f4ad674b Vector Clocks implementation 2024-12-02 23:07:13 -08:00
Enrico Ros 0a27544db3 DConversation: converters update 2024-12-02 23:06:44 -08:00
Enrico Ros fa8501b73d Sherpa/chats: delay GC to delay loading the conversations store 2024-11-30 23:52:45 -08:00
Enrico Ros 8074be9b2e Type normalization Metrics 2024-11-30 23:02:55 -08:00
Enrico Ros 2e2a664c82 Normalize PricingChatGenerate 2024-11-30 23:02:55 -08:00
Enrico Ros 88ed387b75 .gitignore 2024-11-30 23:02:55 -08:00
Enrico Ros 1006d8041e roll packages 2024-11-30 22:29:39 -08:00
Enrico Ros 004b26bff4 Add Beauty 2024-11-30 22:26:34 -08:00
Enrico Ros eb41a245e8 Theme update 2024-11-30 22:06:23 -08:00
Enrico Ros 22a219f1e4 Update min width 2024-11-30 19:45:55 -08:00
Enrico Ros 6435619fba Sync: add DeviceID, stored 2024-11-30 18:50:54 -08:00
Enrico Ros 68ca331e02 Gemini: add 1121 2024-11-30 18:48:29 -08:00
Enrico Ros bf1c734101 Smaller panes 2024-11-30 18:48:14 -08:00
Enrico Ros e5870e43ce Lint: thanks typescript 2024-11-30 18:47:00 -08:00
Enrico Ros 1cda4d443a Roll packages 2024-11-30 18:45:57 -08:00
Enrico Ros cdc3fe38ca Enable Node 22 2024-11-30 18:45:57 -08:00
Enrico Ros f5cb3150b1 Add the "2 days ago" option 2024-11-30 18:42:59 -08:00
Enrico Ros 38f700b383 Tryfix RenderCode (was all vertical) 2024-11-21 23:28:06 -08:00
Enrico Ros dc46497dfe AIX: disable comments in the demuxer parse 2024-11-21 22:55:37 -08:00
Enrico Ros cf0ca2a17e AIX: support forwarded OpenRouter errors 2024-11-21 22:46:09 -08:00
Enrico Ros 0df17ec7bf Support .sh files 2024-11-21 03:23:44 -08:00
Enrico Ros 26d6924ba1 Gemini: update models 2024-11-21 00:42:40 -08:00
Enrico Ros aef56df7a3 Gemini: code execution flags 2024-11-21 00:38:59 -08:00
Enrico Ros 25a6f1fd5c Roll packages. 2024-11-21 00:38:32 -08:00
Enrico Ros 010de2b1f1 SVG: improve detection 2024-11-21 00:14:14 -08:00
Enrico Ros c498c31050 UI: Fix Beam ctrl+enter 2024-11-21 00:12:11 -08:00
Enrico Ros ea9aaa6524 tRPC: relocate 2024-11-20 22:44:48 -08:00
Enrico Ros dfcd590fb3 tRPC: rename rooters 2024-11-20 22:43:13 -08:00
Enrico Ros 5d8b06c928 Exclusions 2024-11-18 12:07:18 -08:00
Enrico Ros a10ddbe103 Unused, comment 2024-11-18 12:01:25 -08:00
Enrico Ros b439180d4e roll packages 2024-11-18 10:33:25 -08:00
Enrico Ros 629dc3c3b8 UI: Persona Icons in Drawer: off by default 2024-11-18 10:10:08 -08:00
Enrico Ros 99a8f900df Nav: change names 2024-11-18 09:21:27 -08:00
Enrico Ros d713edfcab Beam: start all/stop all shortcuts 2024-11-14 14:11:33 -08:00
Enrico Ros cfead98e01 Beam: ctrl+up/down 2024-11-14 14:11:32 -08:00
Enrico Ros 85242d2417 Improve shadow 2024-11-14 14:11:32 -08:00
Enrico Ros 3682a86b49 xAI: fix inversion 2024-11-14 13:24:37 -08:00
Enrico Ros 7c418966f0 _fetchFromTRPC: types for PUT and DELETE 2024-11-14 13:22:43 -08:00
Enrico Ros f773910846 Hide costs counter when < $0.0001 (initial visual clutter) 2024-11-14 13:10:52 -08:00
Enrico Ros cfbc1160ab ChatMessage: menu within screen bounds 2024-11-14 13:08:58 -08:00
Enrico Ros 2d11873af8 Fix react dep 2024-11-13 18:39:04 -08:00
Enrico Ros ee322b45eb Incognito: visual indicator 2024-11-13 18:39:04 -08:00
Enrico Ros c472fbad1c Remove empty chats from the history (don't even save them until we have content) 2024-11-13 18:25:23 -08:00
Enrico Ros b62932ac9c Sherpa: add modal 2024-11-10 23:36:51 -08:00
Enrico Ros bd35be8e13 Icons: Google and GitHub
The icons are from the Authjs project.
2024-11-10 23:34:50 -08:00
Enrico Ros b5eff8b2da Tryfix reload for clipboardUtils 2024-11-10 23:34:35 -08:00
Enrico Ros 6bf0b7c83a Backend debug 2024-11-10 23:34:27 -08:00
Enrico Ros 3a5dc71fc0 Roll packages 2024-11-10 14:33:55 -08:00
Enrico Ros bddd1474c4 xAI: full support 2024-11-08 23:00:53 -08:00
Enrico Ros b90b71bb58 Bits 2024-11-08 23:00:49 -08:00
Enrico Ros d75307691f BackendCaps: refresh on reconnect 2024-11-07 16:22:25 -08:00
Enrico Ros acc3bc4403 Simplify: remove backend analytics 2024-11-07 14:14:02 -08:00
Enrico Ros 4c1b1213b1 ElevenLabs: tRPC streaming - supports new v2 and Turbo 2.5 models 2024-11-07 03:13:30 -08:00
Enrico Ros 40850dde0a AudioLivePlayer: convert for buffers 2024-11-07 03:11:59 -08:00
Enrico Ros 10d5fca3b3 UrlUtils: b64 2024-11-07 03:11:57 -08:00
Enrico Ros 71085408a5 roll packages 2024-11-07 00:06:14 -08:00
Enrico Ros 52cdc95103 Aix - misc 2024-11-06 17:19:37 -08:00
Enrico Ros 638977cc74 DSV: speed 2024-11-06 17:11:26 -08:00
Enrico Ros 5e7e838714 Remove @sanity's diff library (slow, old). 2024-11-06 17:11:26 -08:00
Enrico Ros 965e3282a8 Roll packages (incl. pdfjs) 2024-11-06 17:03:22 -08:00
Enrico Ros 7a1d9cc352 DataStreamViz: speed 2024-11-06 16:29:32 -08:00
Enrico Ros 07dfc8ee07 Config: TOS 2024-11-06 16:29:24 -08:00
Enrico Ros 414250f5d0 Bits 2024-11-06 04:59:17 -08:00
Enrico Ros e6854ab946 Inform about the issue dragging from Obsidian 2024-11-05 21:59:38 -08:00
Enrico Ros 026d2fbc40 SQL highlight 2024-11-05 21:39:51 -08:00
Enrico Ros 66a557a7e1 Anthropic: add Haiku 3.5 2024-11-05 03:20:17 -08:00
Enrico Ros 28ae055c28 More Aggregate Error unpacking 2024-11-03 19:44:03 -08:00
Enrico Ros 0f8fda5c43 Unpack Aggregate Errors 2024-11-03 16:09:06 -08:00
Enrico Ros 9bacedb48c Mobile: don't blur the TextArea when the mic is pressed 2024-11-03 16:09:04 -08:00
Enrico Ros 9894684784 Tools: FC Invocations: support no inputs 2024-11-03 01:47:55 -08:00
Enrico Ros 741b9dae41 Tools: Definitions: support no-params 2024-11-03 01:47:55 -08:00
Enrico Ros 45b4deb7c7 Visual indication of incognito 2024-11-02 19:32:39 -07:00
Enrico Ros 38bdbfeee3 Messages: fix missing text replacement 2024-11-02 19:32:39 -07:00
Enrico Ros 4e3386f589 Fix: Data sanitization 2024-11-02 19:32:39 -07:00
Enrico Ros 88999fe3f5 Incognito (Shift + click on New) 2024-11-02 19:32:39 -07:00
Enrico Ros ce1b5b73b7 Mic: add 5s 2024-11-02 19:32:39 -07:00
Enrico Ros 864eaa7a02 Anthropic: 2024-10-22 changes 2024-11-02 19:32:38 -07:00
Enrico Ros 8848b13f33 Roll packages 2024-11-02 19:15:32 -07:00
Enrico Ros 147da2bc95 Set TenantId 2024-11-02 19:12:44 -07:00
Enrico Ros f94edc7543 Fix URLs 2024-11-01 16:23:03 -07:00
Enrico Ros 9439007f2b Beam: update urls for branch switches 2024-11-01 16:19:45 -07:00
Enrico Ros fa80b7278f Update branch names 2024-10-28 20:15:53 -07:00
Enrico Ros a7af365dc2 v1: document branch names 2024-10-28 20:15:49 -07:00
Enrico Ros 013d952092 Roll Eventsource-parser. 2024-10-28 17:11:25 -07:00
Enrico Ros 0182f9885d Add diff 2024-10-28 15:44:09 -07:00
Enrico Ros 5934a715ee Upgrade to next15 2024-10-28 15:28:17 -07:00
Enrico Ros 41b21af3c3 Roll packages 2024-10-28 15:27:58 -07:00
Enrico Ros 4db42c5f91 Fragments: safer duplication (would rather crash here than later) 2024-10-26 17:17:12 -07:00
Enrico Ros f05472baea GoodModal: definitely need another update lol 2024-10-25 12:19:08 -07:00
Enrico Ros 72b0e77168 Lint 2024-10-25 09:26:01 -07:00
Enrico Ros aa06ac4756 Fix Players 2024-10-25 09:25:41 -07:00
Enrico Ros 2ff060ba38 Ctrl+Up/Down message navigation: improve 3 2024-10-25 09:15:14 -07:00
Enrico Ros 9468f29aae GoodModal: improve theming 2024-10-25 08:58:50 -07:00
Enrico Ros c4b894ec65 Ctrl+Up/Down message navigation: improve 2 2024-10-25 08:58:18 -07:00
Enrico Ros b774073c7f Update Video player 2024-10-24 23:16:42 -07:00
Enrico Ros 911bf97a38 GoodModal: themeable 2024-10-24 23:12:11 -07:00
Enrico Ros e91e0f273a Ctrl+Up/Down message navigation: improve 2024-10-24 21:44:06 -07:00
Enrico Ros 4279e94499 Ctrl+Up/Down message navigation 2024-10-24 21:29:01 -07:00
Enrico Ros ec34f3a6b1 Speech Recognition: fix abstraction 2024-10-24 19:48:43 -07:00
Enrico Ros 86fed99288 Misc 2024-10-24 15:52:49 -07:00
Enrico Ros 934f29dcfd Doc Part/Aix: support version 2024-10-24 15:50:21 -07:00
Enrico Ros b3cf624a39 AppChat: Dev debug test 2024-10-24 15:28:29 -07:00
Enrico Ros f4463e0113 DevBuild: single place support 2024-10-24 15:28:06 -07:00
Enrico Ros 57ca1270e6 Refetch after a long idle in case of a new version. 2024-10-23 22:50:54 -07:00
Enrico Ros 03417c5186 Speech Recognition: Engines abstraction 2024-10-23 22:16:37 -07:00
Enrico Ros 9bcbe58f4a Versioning system update 2024-10-22 13:51:04 -07:00
Enrico Ros 8d66e1c804 Anthropic: update models
Haiku 3.5 coming later this month
2024-10-22 13:20:31 -07:00
Enrico Ros 089ddee9de Optima fixes 2024-10-21 14:29:24 -07:00
Enrico Ros 12965b81c7 News: show build date 2024-10-21 14:26:29 -07:00
Enrico Ros 62b64ac1bd Beam: copy/use all #660 2024-10-20 19:29:58 -07:00
Enrico Ros 9fecbe1005 Beam: keep the header on mobile 2024-10-20 19:29:48 -07:00
Enrico Ros 0c90b296f9 CHandler: cleanup 2024-10-20 04:39:09 -07:00
Enrico Ros 1bc38e3760 Composer: min size 2024-10-20 04:16:35 -07:00
Enrico Ros 32497dbb7b UI bits 2024-10-19 20:38:27 -07:00
Enrico Ros 0a07f2a447 Ephemerals: improve layout 2024-10-19 20:38:10 -07:00
Enrico Ros fbc6265543 Prompt template: support ternaries 2024-10-19 20:38:01 -07:00
Enrico Ros 82c0ed475b Aix: responsive and lighter decimation, relieving pressure. 2024-10-18 04:03:41 -07:00
Enrico Ros e9add70f8a Storage: new delayed serialization backend. 2024-10-18 04:00:35 -07:00
Enrico Ros f3bd5e4d58 Selective Search 2024-10-18 04:00:31 -07:00
Enrico Ros a525b7437a Blocks: disable Enhanced rendering for untitled, below 3 lines 2024-10-17 17:29:15 -07:00
Enrico Ros 915bc6cc89 Booting sequence activated. 2024-10-17 14:40:03 -07:00
Enrico Ros 51fdf2705d Warn if the application version is desynced. 2024-10-17 14:00:41 -07:00
Enrico Ros 5d814c6bb5 Optimize Boot. 2024-10-17 14:00:30 -07:00
Enrico Ros e379526f14 Confirmation without Close 2024-10-17 14:00:00 -07:00
Enrico Ros c9057f0c25 Composer: minimize 2024-10-17 13:59:28 -07:00
Enrico Ros c3c65ea3d3 Tools: render fragments 2024-10-17 12:48:36 -07:00
Enrico Ros ddee6aecfb Tools: edit invocation/responses 2024-10-17 12:48:33 -07:00
Enrico Ros 1a6f56ef62 OpenAI: Fix 3.5 2024-10-17 12:48:07 -07:00
Enrico Ros 680e031be6 Edit: tool in/out 2024-10-16 21:15:07 -07:00
Enrico Ros a7ab95e905 Fragments: ITCF. 2024-10-16 20:10:13 -07:00
Enrico Ros 57bb1edcfc Fragments: Void. 2024-10-16 20:07:06 -07:00
Enrico Ros 216fe20e52 Fragments: cleanup 2024-10-16 19:13:37 -07:00
Enrico Ros a27669fd63 Gemini: update models 2024-10-16 15:41:10 -07:00
Enrico Ros 5034ecc4df Attachments: view Docs 2024-10-16 15:41:03 -07:00
Enrico Ros 55700d5218 Attachments: bits. 2024-10-16 15:40:00 -07:00
Enrico Ros 35c03e5b44 Aix: constrain tool_response.function_call.result to be JSON-parseable objects for now
This is done as it seems to be the only supported input for Gemini's functionResponse
2024-10-16 14:01:16 -07:00
Enrico Ros cfb3a071c8 Docs. 2024-10-16 13:59:11 -07:00
Enrico Ros 677645b81c Aix: Fix Gemini functionResponse 2024-10-16 13:58:46 -07:00
Enrico Ros 297f93b8ad Aix: Tool Responses 2024-10-16 13:58:40 -07:00
Enrico Ros 765eec0492 Aix: cleanup CGR creation 2024-10-16 13:58:19 -07:00
Enrico Ros da32c2c59a Improve Aix debugger. 2024-10-16 02:40:35 -07:00
Enrico Ros 091f1b1936 Versioning System 2024-10-16 01:52:17 -07:00
Enrico Ros e9dc735989 Cleanup Stores. [server] 2024-10-15 23:54:40 -07:00
Enrico Ros 4d01f8620a bits 2024-10-15 23:45:55 -07:00
Enrico Ros 3edf89d98f GSearch: misc. 2024-10-15 23:45:44 -07:00
Enrico Ros 7681ff3f3e GoodModal: optimize 2024-10-15 16:43:13 -07:00
Enrico Ros 42d947f13e Composer: disable call when responding 2024-10-15 03:24:31 -07:00
Enrico Ros b5772f3765 Composer: complete dictation then send, and disable while sending (even early stages) 2024-10-15 02:25:46 -07:00
Enrico Ros 639f02346e Attachments: skip text-less PDFs 2024-10-15 00:13:58 -07:00
Enrico Ros cf1cb7b112 bits 2024-10-14 23:05:17 -07:00
Enrico Ros 1b60f1062f Aix: push down throttling. 2024-10-14 23:04:44 -07:00
Enrico Ros d105e28ca8 Z5: stabilize the transport access object in useServiceSetup 2024-10-14 20:56:45 -07:00
Enrico Ros 3ff88fffe5 Update Debug Hooks to detect changes 2024-10-14 20:41:08 -07:00
Enrico Ros d87d0aa146 Z5: Stabilize useWorkspaceContentsMetadata 2024-10-14 20:19:36 -07:00
Enrico Ros c7c43780a3 Soft-update the version number. 2024-10-14 18:08:00 -07:00
Enrico Ros bc24afe859 Upgrade to Zustand 5 (released 5h ago) 2024-10-14 13:03:26 -07:00
Enrico Ros e25f46b5c0 Anthropic: fix build. 2024-10-14 02:17:29 -07:00
Enrico Ros 3907449ec0 Anthropic: try fix functions. 2024-10-14 02:12:54 -07:00
Enrico Ros 8230eafe25 Roll deps. 2024-10-13 04:32:18 -07:00
Enrico Ros a43e83d9ed Roll pdfjs. 2024-10-13 04:32:18 -07:00
Enrico Ros fce3b6e538 Aider glue. 2024-10-13 04:32:18 -07:00
Enrico Ros f7decf8210 Search: optimize. 2024-10-13 04:06:20 -07:00
Enrico Ros 6d6c9afe97 Merge remote-tracking branch 'opensource/big-agi-2' into big-agi-2-OPEN 2024-10-13 03:12:41 -07:00
Enrico Ros 6876390456 Search: fix instability 2024-10-13 03:12:33 -07:00
Enrico Ros 1e95ec6154 Search: count for > 10 2024-10-13 02:47:02 -07:00
Enrico Ros 6756e4e027 Attachments: copy name 2024-10-12 19:52:12 -07:00
Enrico Ros c0573c56c4 Attachments: View Preview, View on Click 2024-10-12 19:52:12 -07:00
Enrico Ros 1338014942 Attachments: scraping timestamps 2024-10-12 19:52:12 -07:00
Enrico Ros 011b76f8e2 Update Ephemerals 2024-10-12 19:52:12 -07:00
Enrico Ros b2c07471d8 bits 2024-10-12 19:43:18 -07:00
Enrico Ros 950e1c8779 Build and lint fixes. 2024-10-12 19:38:39 -07:00
Enrico Ros 61df9819e6 SpeechReco: improve casts. 2024-10-11 22:15:36 -07:00
Enrico Ros 5afc8ad69b Tall screen support for panes. 2024-10-11 22:15:18 -07:00
Enrico Ros a472c618a3 Abort: explore solutions 2024-10-11 22:15:18 -07:00
Enrico Ros 9f00772dd4 [DEV] ICE: Text parts cleanup 2024-10-11 22:15:18 -07:00
Enrico Ros 478d792565 ReAct: disable calculate (arbitrary code execution) 2024-10-11 22:15:18 -07:00
Enrico Ros b20f1667f7 Improve command execution. 2024-10-11 22:15:18 -07:00
Enrico Ros 899695e32c Snackbar: center-title and unexpected 2024-10-11 22:13:00 -07:00
Enrico Ros 56e99785ea Tables: copy as markdown 2024-10-11 22:12:43 -07:00
Enrico Ros a778165ee7 This branch is 1242 commits on top of main :) 2024-10-11 21:59:39 -07:00
Enrico Ros dc55be87d2 Merge remote-tracking branch 'opensource/main' into big-agi-2-OPEN 2024-10-11 21:58:38 -07:00
Enrico Ros 8eb7d7f80b Big-AGI 2 is coming with loads of features. 2024-10-11 21:57:50 -07:00
Enrico Ros ee01085f8e Merge remote-tracking branch 'opensource/main-stable' 2024-10-11 21:56:09 -07:00
Enrico Ros 1adff7481b Dev survey for Big-AGI 2. 2024-10-11 21:55:46 -07:00
Enrico Ros 054a8d9050 Aix: +Diagram 2024-10-10 17:56:45 -07:00
Enrico Ros ed98829869 Aix: re-fix for o1 2024-10-10 17:43:35 -07:00
Enrico Ros 4810975148 Aix: unified chat-generate context 2024-10-10 17:37:35 -07:00
Enrico Ros a99895166c Aix: adapt downstream. 2024-10-10 16:39:52 -07:00
Enrico Ros cf62128095 Aix: Absorb Complexity - simpler T2T API. 2024-10-10 15:42:38 -07:00
Enrico Ros 2a5d418425 Aix: rename CGRs 2024-10-10 15:20:25 -07:00
Enrico Ros 3e865d68dc Aix: +select-Draw 2024-10-10 15:19:20 -07:00
Enrico Ros e882358af4 Aix: +auto-UI, +auto-Diagram 2024-10-10 15:15:40 -07:00
Enrico Ros f86649fe02 Aix: Titles (simplify) 2024-10-10 15:15:34 -07:00
Enrico Ros 3892f0c82a Aix: rationalize non_abortable 2024-10-10 15:15:32 -07:00
Enrico Ros da2266fcfe ReAct: port to V2 - now Stops, all llms, proper error handling, llm in state, works great! 2024-10-10 15:15:05 -07:00
Enrico Ros 7bf6c9c77a AIX: remove undefined from outgoing superjson's 2024-10-10 15:14:31 -07:00
Enrico Ros 27f031eb57 Notify: remember state for new messages. 2024-10-09 16:51:14 -07:00
Enrico Ros 7ce58fb594 TimeUtils: fix buckets 2024-10-09 16:51:14 -07:00
Enrico Ros bc0f6a4cd2 BlockPartError: un-bold 2024-10-08 23:58:05 -07:00
Enrico Ros 0b3b2860bb Fix fenced block parsing. 2024-10-08 20:07:08 -07:00
Enrico Ros a21342384e Anthropic: update models. 2024-10-08 16:51:03 -07:00
Enrico Ros 79bb6f07c9 AutoBlocks: relax end-of-block parser, removing spaces and tabs, but not newlines 2024-10-08 16:50:58 -07:00
Enrico Ros 80f77aee4e Show that a message Stopped on !Zen 2024-10-08 16:50:52 -07:00
Enrico Ros b0b3bcbf61 Anthropic: auto-caching indicators only on Extra 2024-10-08 16:50:29 -07:00
Enrico Ros f83d6ca4ac Smallfixes 2024-10-08 16:50:09 -07:00
Enrico Ros 2c6a9fbea6 Dev: rewrite conventions. 2024-10-08 16:49:55 -07:00
Enrico Ros df945dc36b RenderImage: support onClick 2024-10-06 21:02:07 -07:00
Enrico Ros b6eccbf860 Attachment Menu Chips: fix div 2024-10-06 21:00:27 -07:00
Enrico Ros 4332d21637 Onboard: unfilter models selector 2024-10-06 20:59:57 -07:00
Enrico Ros b0809734aa Fix mimetype change on conversions 2024-10-06 20:59:28 -07:00
Enrico Ros 74ed8c9e5e Code: option to show line numbers also in 'Pro', not just 'Extra' 2024-10-06 20:53:20 -07:00
Enrico Ros 98b1d5068b AIX: update context wiretypes 2024-10-06 20:53:06 -07:00
Enrico Ros 07cc34ba2b Radically improve model preference. 2024-10-05 08:53:30 -07:00
Enrico Ros 239867d8c5 Roll packages 2024-10-05 08:27:44 -07:00
Enrico Ros aa31d92986 autotitle: clear when clearing usertitle 2024-10-04 11:26:26 -07:00
Enrico Ros f012b99b17 Adjust all Vendors ranks 2024-10-04 11:26:22 -07:00
Enrico Ros d5fd66f07c AutoConf w/ rerank of Vendors 2024-10-04 11:26:19 -07:00
Enrico Ros f07c19f69c View images: improve margin 2024-10-04 11:25:56 -07:00
Enrico Ros 5541a4e531 Anim: enter Models Modal 2024-10-04 11:25:24 -07:00
Enrico Ros 3055fe9347 Anim: reorg 2024-10-04 11:25:14 -07:00
Enrico Ros 369324ad5d Container Layout 2024-10-04 11:24:59 -07:00
Enrico Ros 4e5b1f1306 Sync scores 2024-10-04 11:24:35 -07:00
Enrico Ros 81c70b21b9 Roll packages 2024-10-04 11:23:37 -07:00
Enrico Ros 44a00df49d Move to user-defined personas configuration. 2024-10-04 11:23:05 -07:00
Enrico Ros 8754bbada9 Will be replaced. 2024-10-04 11:22:13 -07:00
Enrico Ros f37cdcb20c Need to fix this. 2024-10-04 11:16:34 -07:00
Enrico Ros 393e19dda9 Vercel: fix timeout 2024-10-03 12:37:21 -07:00
Enrico Ros 766cc06206 Vercel: fix timeout 2024-10-03 12:34:26 -07:00
Enrico Ros 710f03d037 OpenAI: remove gpt4 list ref 2024-10-02 19:51:50 -07:00
Enrico Ros ec956da51c Progressive Disclosure: increase time 2024-10-02 19:50:51 -07:00
Enrico Ros da3dddf502 RenderImageURL: adjust shadow 2024-10-02 19:50:21 -07:00
Enrico Ros 77efabb883 Disable filters for now 2024-10-02 19:49:59 -07:00
Enrico Ros 116415b238 Fullscreen render code line numbers. 2024-10-02 19:49:52 -07:00
Enrico Ros dd33e3ea28 Fix. 2024-10-01 23:50:18 -07:00
Enrico Ros ad703f9483 Remove FuncLLM. 2024-10-01 23:49:28 -07:00
Enrico Ros 9058c2d2fa Integrate Aider prompts: Convert to JavaScript and add Apache 2.0 licensing. 2024-10-01 23:49:08 -07:00
Enrico Ros 3cd2b29a37 Prod: fixes 2024-10-01 18:50:11 -07:00
Enrico Ros 51cd6a7e07 Text 2024-10-01 18:05:54 -07:00
Enrico Ros 30fe814eb1 Show costs wherever available. 2024-10-01 18:04:00 -07:00
Enrico Ros ff0ea188c1 OpenAI: support for costs and saving calculation 2024-10-01 17:38:42 -07:00
Enrico Ros 34c6129d25 OpenAI: update wiretypes 2024-10-01 16:16:14 -07:00
Enrico Ros 0378eb8f1e OpenAI: add caching info 2024-10-01 14:54:18 -07:00
Enrico Ros d09d4455aa Improve Fast LLM auto-select (py price) 2024-10-01 14:19:15 -07:00
Enrico Ros dcce5a5b1d OpenAI: update Elos. 2024-10-01 12:56:58 -07:00
Enrico Ros 2f856e64bb OpenAI: add realtime 2024-10-01 12:41:49 -07:00
Enrico Ros cd8c931df8 OpenAI: update models 2024-10-01 12:41:42 -07:00
Enrico Ros cefe208abd OpenAI: mark the prompt caching models 2024-10-01 11:25:11 -07:00
Enrico Ros 0e566edf42 OpenAI: extract models 2024-10-01 11:12:46 -07:00
Enrico Ros 8c735e971e Group labels fix. 2024-09-29 14:17:27 -07:00
Enrico Ros 48740c7183 Improve regex 2024-09-29 02:56:39 -07:00
Enrico Ros 1ec2acd250 Improve Steam. 2024-09-28 14:48:30 -07:00
Enrico Ros b572c6d962 Improve Steam. 2024-09-28 14:21:44 -07:00
Enrico Ros 01197952f4 Screenshare on Safari: add notices about a 60 seconds processing bug (no upstream safari reference yet). 2024-09-28 12:36:01 -07:00
Enrico Ros f94240110d Charts: try-expand 2024-09-28 11:32:43 -07:00
Enrico Ros 7a139e50c5 Aix: improve FC error messaging 2024-09-28 11:32:43 -07:00
Enrico Ros d11a38db83 Proper transparent BG 2024-09-28 11:14:06 -07:00
Enrico Ros 9f10ed1930 Revert "FF: Tryzoom"
This reverts commit 98f8117b
2024-09-28 10:51:01 -07:00
Enrico Ros 8a9e2151b8 Bits 2024-09-28 10:50:44 -07:00
Enrico Ros 98f8117b50 FF: Tryzoom 2024-09-28 10:45:30 -07:00
Enrico Ros 21d2d7be30 FF: Fixup shift to omit background 2024-09-28 10:24:44 -07:00
Enrico Ros 3a644ec4d5 FF: Fixup with Chat llm 2024-09-28 10:13:47 -07:00
Enrico Ros 4cd7936bf3 Fix edit mode for Fixmode 2024-09-27 18:49:29 -07:00
Enrico Ros 19769c8238 Fix chart copy on Safari 2024-09-27 18:30:04 -07:00
Enrico Ros 7ecd1aa371 Misc 2024-09-27 18:29:19 -07:00
Enrico Ros 9cd5194629 Shortcuts: priorities 2024-09-27 18:01:57 -07:00
Enrico Ros a2cda7e791 DataStreamViz: clear canvas 2024-09-27 17:48:09 -07:00
Enrico Ros 1084e3d5e2 DMessage: duplicate without Placeholders 2024-09-27 17:47:53 -07:00
Enrico Ros 7aa02e91c8 Capy 2024-09-27 17:28:11 -07:00
Enrico Ros 35b9bbf0e6 Gemini: fix parsing 2024-09-27 17:28:11 -07:00
Enrico Ros 2ae834366c Messaging 2024-09-27 17:28:11 -07:00
Enrico Ros cdd08b5df3 Fixup: allow thinking before fixing 2024-09-27 17:28:11 -07:00
Enrico Ros 3d566aa102 Clipboard: explain copy errors 2024-09-27 17:28:11 -07:00
Enrico Ros b110580123 Data: updata proompt 2024-09-27 17:28:11 -07:00
Enrico Ros 7df767119b AIX: Temperature override 2024-09-27 17:28:11 -07:00
Enrico Ros 17008c30f6 Disable opacity, as the colors already are sort of premultiplied 2024-09-27 17:28:11 -07:00
Enrico Ros 1efd9bc55a Steam Viz. 2024-09-27 00:28:05 -07:00
Enrico Ros 1e7b77928f Attachments: view images better 2024-09-26 22:27:45 -07:00
Enrico Ros fc8c984cd4 Attachments: view images 2024-09-26 22:16:08 -07:00
Enrico Ros 23cf01d4b4 Attachments: allow to delete a single fragment 2024-09-26 19:54:02 -07:00
Enrico Ros 8dde79c607 Swap 2024-09-26 18:36:35 -07:00
Enrico Ros 78f409b056 Python: open in Colab 2024-09-26 18:35:00 -07:00
Enrico Ros fd4f1ae0c0 Blocks: reduce ABR usage. 2024-09-26 18:21:15 -07:00
Enrico Ros 93797afa7a Blocks: rationalize, reduce PH usage and ABR usage. 2024-09-26 18:14:29 -07:00
Enrico Ros 5242d09b53 Reduce CPPH 2024-09-26 15:54:14 -07:00
Enrico Ros d9cb9e6aed Improve Open in external editors. 2024-09-26 14:42:39 -07:00
Enrico Ros 913fa45e73 Increase FS contrast. 2024-09-26 13:34:16 -07:00
Enrico Ros b21bd47ea5 Minutiae 2024-09-26 13:28:20 -07:00
Enrico Ros 340c298572 FS and presenter mode 2024-09-26 13:21:38 -07:00
Enrico Ros 06e899343b Cleaner chat message menu 2024-09-26 12:35:40 -07:00
Enrico Ros 104b95a5a4 Fix send of partial while mic'ing 2024-09-26 12:19:28 -07:00
Enrico Ros 1d9b309552 Clean icons 2024-09-26 12:11:18 -07:00
Enrico Ros 7c3d7a8596 Proper edit mentions 2024-09-26 12:00:56 -07:00
Enrico Ros 966f57cb0e Proper reset on Beam/Merge 2024-09-26 11:53:08 -07:00
Enrico Ros 36260aaf8d Message stats on Beam/Merge 2024-09-26 11:34:47 -07:00
Enrico Ros 3158d5b340 Gemini 1.5 - also allow latest 2024-09-26 03:23:31 -07:00
Enrico Ros 938a896de3 Gemini 1.5 002 - Fix #648 2024-09-26 03:21:13 -07:00
Enrico Ros 7573f014d0 Gemini: update models 2024-09-26 03:16:10 -07:00
Enrico Ros 76b8a1582b LLMAttachmentButton: moved explanation 2024-09-26 01:43:53 -07:00
Enrico Ros 96acd7a307 LLMAttachmentButton: reduce ellipses 2024-09-26 01:43:53 -07:00
Enrico Ros a41688f378 LLMAttachmentButton: reorder 2024-09-26 01:43:52 -07:00
Enrico Ros ff9b1650f9 Bits 2024-09-26 01:43:52 -07:00
Enrico Ros 116bdcdd43 Chart: shift to add background 2024-09-25 22:26:56 -07:00
Enrico Ros bb8e7a283c Chart: good boy 2024-09-25 22:07:01 -07:00
Enrico Ros 825c565a24 Chart: improve fixup 2024-09-25 21:35:44 -07:00
Enrico Ros fe35c2ec82 Chart: apply theme 2024-09-25 21:35:38 -07:00
Enrico Ros 21451af9b3 Download/Copy chart images 2024-09-25 20:15:47 -07:00
Enrico Ros 0852dc5dc9 Add Download utils 2024-09-25 20:08:48 -07:00
Enrico Ros e90b71b2c2 Improve Camera & Screen capture format deliberacy. 2024-09-25 20:08:37 -07:00
Enrico Ros 6ea2674f35 Camera: switch to JPEG from PNG (4x smaller, neglegible loss, as it's a noisy source, and also rescaled) 2024-09-25 20:05:14 -07:00
Enrico Ros 62f809a8d3 Extract canvasUtils 2024-09-25 17:50:55 -07:00
Enrico Ros 0eb04a3f6a Misc 2024-09-25 17:44:35 -07:00
Enrico Ros 367894abc9 Charting @2x. 2024-09-25 17:36:43 -07:00
Enrico Ros febf758aa7 Typo 2024-09-25 16:54:10 -07:00
Enrico Ros a2407157d1 Undo partially. 2024-09-25 16:50:18 -07:00
Enrico Ros 6eccdf74d1 Charts: DPR*2 test 2024-09-25 16:26:09 -07:00
Enrico Ros 57ebb8f9fb AIX/tRPC: disable batching to stay under 1MB (Vercel limitation) 2024-09-25 15:14:36 -07:00
Enrico Ros 1d02079b09 Zustand: stabilize 2024-09-25 15:14:36 -07:00
Enrico Ros 6a7e9ea131 useDeep. 2024-09-25 02:23:30 -07:00
Enrico Ros 8c5a8d2044 Charts: removed devDependency 2024-09-25 02:04:09 -07:00
Enrico Ros 6d47b6024a Charts: User Fix. 2024-09-25 01:40:58 -07:00
Enrico Ros e7bd6f6746 Agi Code Fixup Framework 2024-09-25 01:19:18 -07:00
Enrico Ros d3a7e2a310 Blocks: propagate an inner replacement function 2024-09-24 23:27:20 -07:00
Enrico Ros d901cafe82 Roll implicits 2024-09-24 23:26:53 -07:00
Enrico Ros 77e374b92b Roll prisma 2024-09-24 23:26:53 -07:00
Enrico Ros 0989796f87 EnhancedRenderCode: auto-open 2024-09-24 20:24:13 -07:00
Enrico Ros 1e61998b50 ChartJS: improvements 2024-09-24 20:11:37 -07:00
Enrico Ros 4a896be01b ChartJS: defaults 2024-09-24 16:27:25 -07:00
Enrico Ros a44408c87c Aix: express the error 2024-09-24 16:16:54 -07:00
Enrico Ros 504d2b7c5a ChartJS: compress the generation code 2024-09-24 16:08:09 -07:00
Enrico Ros 9446f0b23d Improve ChartJS handling 2024-09-24 15:40:20 -07:00
Enrico Ros 671ba95975 Notification avatar. 2024-09-24 14:00:16 -07:00
Enrico Ros 6fc5acfeb9 Drop the charts module as-is, will fix later. 2024-09-24 10:03:15 -07:00
Enrico Ros 1236d7c1ac Fix shift+ctrl+enter on system/assistant messages. 2024-09-23 22:59:06 -07:00
Enrico Ros ef2ee9280d More visible tooltips 2024-09-23 15:36:03 -07:00
Enrico Ros 3e05f751e3 presentErrorToDevelopers 2024-09-23 14:08:56 -07:00
Enrico Ros b0f2ad6742 Drag in conversations 2024-09-23 14:06:59 -07:00
Enrico Ros 63a82a6da6 Drag in conversations 2024-09-23 14:01:44 -07:00
Enrico Ros 57082b23d8 Debug errors. 2024-09-23 12:31:19 -07:00
Enrico Ros 361511fc5d Roll packages. 2024-09-23 08:43:45 -07:00
Enrico Ros f81beb5cae Camera: done for real. 2024-09-22 15:36:55 -07:00
Enrico Ros 2318cd3329 Camera: done. 2024-09-22 15:34:48 -07:00
Enrico Ros 0fa3ea0ff6 Camera: flip better 2024-09-22 15:29:37 -07:00
Enrico Ros 00093e42be Camera: style 2024-09-22 15:29:32 -07:00
Enrico Ros cfa7ce2019 Camera: flip 2024-09-22 15:15:40 -07:00
Enrico Ros f1397eff4a Camera: final render 2024-09-22 14:59:11 -07:00
Enrico Ros 67a4a79a6c Camera: darker render 2024-09-22 14:37:20 -07:00
Enrico Ros 29fba943de Camera: lighter render 2024-09-22 14:23:11 -07:00
Enrico Ros 69e6fb4dbd Camera: lighter render 2024-09-22 12:55:27 -07:00
Enrico Ros 96cbd95996 Camera: relist devices on permissions change and devices change 2024-09-22 12:39:50 -07:00
Enrico Ros e88180a6f5 Camera: add button 2024-09-22 12:19:34 -07:00
Enrico Ros 6b817cde0a Camera: improve 2024-09-22 11:21:30 -07:00
Enrico Ros b7b7dfb4af Roll deps 2024-09-22 10:43:59 -07:00
Enrico Ros afdfb83fc8 Lints 2024-09-22 10:42:22 -07:00
Enrico Ros f3a1fa624a Fix 2024-09-22 10:35:17 -07:00
Enrico Ros 90c05ba2d9 .ignore 2024-09-22 10:33:55 -07:00
Enrico Ros de3aa4a5f7 Double-mode attachments 2024-09-22 10:33:14 -07:00
Enrico Ros 2258dee8c7 Change Models/Personas 2024-09-22 02:45:01 -07:00
Enrico Ros feec32b3ac Bits 2024-09-22 02:14:54 -07:00
Enrico Ros e189f30285 Notify on responses 2024-09-22 02:14:50 -07:00
Enrico Ros 58e97d20fd Dropdowns: shortcuts 2024-09-22 00:17:07 -07:00
Enrico Ros 378948e522 Optima Dropdowns: controllable 2024-09-22 00:11:17 -07:00
Enrico Ros a19804d450 Bits 2024-09-21 23:56:03 -07:00
Enrico Ros c445c36f84 Composer: improve showing actions 2024-09-21 23:36:23 -07:00
Enrico Ros fa9886e2dc Composer: quality cleanup 2024-09-21 23:29:41 -07:00
Enrico Ros b7c7609ac4 Attachment Compatibility: Send & Beam 2024-09-21 23:03:17 -07:00
Enrico Ros 217a40c19c Keep the image attachments while editing text 2024-09-21 03:24:31 -07:00
Enrico Ros 5cb568023b Correct duplication. 2024-09-21 02:44:00 -07:00
Enrico Ros 8ced2593ff Safari: preliminary workaround for WebP encoding issues 2024-09-20 15:48:57 -07:00
Enrico Ros 4db373e46e Disambiguate Clone and Branch 2024-09-20 15:00:18 -07:00
Enrico Ros 79a870a752 Aix: potentially fix a beam issue 2024-09-20 03:44:23 -07:00
Enrico Ros e6d68a4970 Aix: debug abort status 2024-09-20 03:44:03 -07:00
Enrico Ros 3087e2316f Aix: debug abort status 2024-09-20 03:43:54 -07:00
Enrico Ros c59a7cc0bc Aix: remove stopped empty messages 2024-09-20 03:43:40 -07:00
Enrico Ros c948b58eb5 Aix: all for a dot-dot-dot 2024-09-20 03:05:12 -07:00
Enrico Ros fde57ca12d Aix: push throttling down a level 2024-09-20 02:44:00 -07:00
Enrico Ros e9cebe435a Pricing: note on Perplexity's per-request 2024-09-20 01:40:14 -07:00
Enrico Ros 3280a58dd0 Perplexity: updated models. Fixes #642. 2024-09-20 01:38:52 -07:00
Enrico Ros 597214b955 Perplexity: move models. 2024-09-20 01:32:10 -07:00
Enrico Ros d43f84e31e Docs: begin a Tips & Tricks (will add to it over time) 2024-09-20 01:26:13 -07:00
Enrico Ros 7ad118d51b Aix: push down the pendingIncomplete 2024-09-20 01:00:22 -07:00
Enrico Ros d980d97227 Aix: continue cleanup 2024-09-20 00:32:28 -07:00
Enrico Ros ee7c1cc12b Metrics: cleanups 2024-09-20 00:28:13 -07:00
Enrico Ros 94200cfc6d Aix: continued client renaming 2024-09-19 23:24:26 -07:00
Enrico Ros 8c5a2bce0d Aix: improve Low-Level 2024-09-19 23:08:36 -07:00
Enrico Ros 259505190b More uniform configuration 2024-09-19 21:38:57 -07:00
Enrico Ros e407eba674 Aix: move code away from the client 2024-09-19 21:37:09 -07:00
Enrico Ros 13462b6b71 Fix order of precedence of esc for chat stop vs mic 2024-09-19 20:52:53 -07:00
Enrico Ros 15661b3b8c User-Attach data personas: Fix auto-select of the first converter. 2024-09-19 20:34:00 -07:00
Enrico Ros b97c4c5a43 FF: PDF multimodal 2024-09-19 18:04:20 -07:00
Enrico Ros aeda478d51 FF: Fix Safari Attachment appearance 2024-09-19 16:05:05 -07:00
Enrico Ros 9bd6b12789 Unzero. 2024-09-19 15:01:57 -07:00
Enrico Ros 476a212ee8 LiveFile: doc update2 2024-09-19 13:38:13 -07:00
Enrico Ros 0470285338 LiveFile: doc update 2024-09-19 13:34:13 -07:00
Enrico Ros ab28ae2940 LiveFile: doc 2024-09-19 13:31:55 -07:00
Enrico Ros 169fa86ec4 Composer: mic: autoscroll and perfect match 2024-09-19 12:10:27 -07:00
Enrico Ros cafd491e35 Merge remote-tracking branch 'origin/main' into big-agi-2
# Conflicts:
#	docs/README.md
#	docs/environment-variables.md
2024-09-19 11:35:38 -07:00
Enrico Ros b8ae9648e6 LiveFile: unsupported on Safari 2024-09-19 11:23:59 -07:00
Enrico Ros 0de8d5dd1c Sel: resilient and not logging 2024-09-19 11:22:15 -07:00
Enrico Ros 356b15a3ea Sel: resilient 2024-09-19 11:20:22 -07:00
Enrico Ros 2002255c07 o1: port refer to 2024-09-19 11:08:47 -07:00
Enrico Ros b19a4be485 Sel fixes 2024-09-19 11:08:36 -07:00
Enrico Ros eec845486d FF: Mic Placeholder 2024-09-19 04:22:00 -07:00
Enrico Ros 29f7224b22 Roll deps 2024-09-19 01:56:31 -07:00
Enrico Ros e7a4c92e61 FF: Open Files debug 2024-09-19 01:56:09 -07:00
Enrico Ros 4d59ba6797 Mistral: update models 2024-09-18 21:05:07 -07:00
Enrico Ros acae4c31ab Editing: Don't disappear docs 2024-09-18 20:40:03 -07:00
Enrico Ros f1449b60e2 Mistral: update models and pricing 2024-09-18 20:29:24 -07:00
Enrico Ros 32739fa15c Mistral: update models and pricing 2024-09-18 20:28:45 -07:00
Enrico Ros fff385b5e8 Pmix supports a {{LowRL:...}} for models to deeply steer 2024-09-18 20:07:44 -07:00
Enrico Ros 40faa35678 Roll Mermaid 10 -> 11 2024-09-18 20:06:15 -07:00
Enrico Ros 78af46ed4a Perfect Data Analyst 2024-09-18 18:31:31 -07:00
Enrico Ros ea94fc2185 Perfect Data Analyst 2024-09-18 18:27:27 -07:00
Enrico Ros c8abb75194 Reorder Data Analyst 2024-09-18 18:10:51 -07:00
Enrico Ros 6a59ad338d Prompt Examples can require user attachments. This includes a neat files-auto-convert-to-fragments immediate pipeline. 2024-09-18 18:06:20 -07:00
Enrico Ros 40aa737480 Personas: auto-expand examples on Extra 2024-09-18 18:01:49 -07:00
Enrico Ros 717a6c90ef openFilesForAttaching: await completion (may mean full conversion and AI processing) 2024-09-18 17:53:47 -07:00
Enrico Ros f4b1b292b7 Data Analysis persona 2024-09-18 17:49:43 -07:00
Enrico Ros 446df24f5a HTML pmix 2024-09-18 17:49:14 -07:00
Enrico Ros 39ab5cabf1 Personas: allow for user-action personas 2024-09-18 17:06:13 -07:00
Enrico Ros 2671ff1228 Examples: improve on mobile 2024-09-18 17:05:40 -07:00
Enrico Ros 1932c31c35 Move Modals 2024-09-18 15:59:45 -07:00
Enrico Ros 9b1b6ebceb Roll next 2024-09-18 14:51:29 -07:00
Enrico Ros f683d263ad o1 hotfix for images 2024-09-18 14:13:32 -07:00
Enrico Ros 53c87cc560 Typo 2024-09-18 14:13:07 -07:00
Enrico Ros 63c90dc70d LLM shortnames 2024-09-18 13:54:48 -07:00
Enrico Ros 20927d4da6 Shiftclick on llm 2024-09-18 13:54:19 -07:00
Enrico Ros e1664458c5 Edit: shift-doubleclick to quickly edit any fragment 2024-09-18 12:43:18 -07:00
Enrico Ros 09da682bcf Better shiftlogs 2024-09-18 12:42:52 -07:00
Enrico Ros ac70a7d8c2 Edit: margin 2024-09-18 12:16:28 -07:00
Enrico Ros 638155eae7 Edit: consistent placement 2024-09-18 12:16:21 -07:00
Enrico Ros 782c0cf172 Link help-feature-microphone to the README 2024-09-17 16:22:17 -07:00
Enrico Ros c3b907f94c Improve bubble 2024-09-17 15:49:11 -07:00
Enrico Ros 78a773dec7 support for strikethrough 2024-09-17 15:43:55 -07:00
Enrico Ros b1ffe04ccb show Free (local) chats 2024-09-17 14:51:56 -07:00
Enrico Ros cf9568aaa0 Fix thinking message 2024-09-17 14:51:40 -07:00
Enrico Ros 5e2d609332 Roll packages, incl. pdfjs, tesseract 2024-09-17 14:19:25 -07:00
Enrico Ros 1962f119e5 FF: Speech reco Typo. 2024-09-17 13:43:25 -07:00
Enrico Ros 06d2bf2ba5 Update help-feature-microphone.md 2024-09-17 11:30:39 -07:00
Enrico Ros 9b902e0f8b Update help-feature-microphone.md 2024-09-17 11:29:50 -07:00
Enrico Ros 05e74a7cd8 Update help-feature-microphone.md 2024-09-17 02:50:04 -07:00
Enrico Ros 4ea0d3b974 FF: Safari fix. 2024-09-17 01:59:40 -07:00
Enrico Ros 0b1a914015 FF: Speech reco comments. 2024-09-17 01:56:15 -07:00
Enrico Ros 6c405c3807 FF: Speech reco fixes. 2024-09-17 01:53:54 -07:00
Enrico Ros 49cbda39b8 Improve Browser/OS clustering 2024-09-17 01:53:46 -07:00
Enrico Ros f9d511c4b4 FF: Microphone update. 2024-09-16 16:47:13 -07:00
Enrico Ros 30c7421877 FF: Microphone help. 2024-09-16 13:47:20 -07:00
Enrico Ros 91a5878460 Help: microphone troubleshooting. 2024-09-16 13:08:36 -07:00
Enrico Ros 1af77749e9 FF: Microphone support. More debuggable. 2024-09-16 13:07:51 -07:00
Enrico Ros d3fdd5f85a FF: Sidebar: Better Icon 2024-09-15 23:59:42 -07:00
Enrico Ros f5c819f576 Cam ok. 2024-09-15 23:26:34 -07:00
Enrico Ros 4640b13195 Fix chat bubble and camera 2024-09-15 23:12:53 -07:00
Enrico Ros 52a89c3d76 Proper highlight 2024-09-15 22:18:09 -07:00
Enrico Ros a92b605c25 Note on #631. 2024-09-15 20:08:13 -07:00
Enrico Ros 2de8a8f2c0 Bits. 2024-09-15 20:07:52 -07:00
Enrico Ros 9e5f332dc6 Untangle #596 2024-09-15 20:00:01 -07:00
Enrico Ros fce21ad8eb Merge pull request #629 from darshmashru/patch-1
Fixed a redirection link typo
2024-09-15 00:12:51 -07:00
Enrico Ros 36b4ee9589 Reasoning costs breakdown for o1-preview, o1-mini support. 2024-09-14 13:37:41 -07:00
Enrico Ros ec24b70d81 Full o1-preview, o1-mini support. 2024-09-14 12:57:04 -07:00
Enrico Ros b3c2794a60 Attach: Camera icon smaller on mobile 2024-09-13 22:20:26 -07:00
Enrico Ros 194115231a Roll tiktoken and zustand 2024-09-13 17:19:36 -07:00
Enrico Ros 175015eade Roll packages 2024-09-13 17:15:58 -07:00
Enrico Ros 6ce3cf9e29 Roll next 2024-09-13 17:08:31 -07:00
Enrico Ros 8358949c9b FF: Roll tRPC to fix the "invalid response or stream interrupted." issue - bug: unstable_httpBatchStreamLink gets broken when resolver returns null 2024-09-13 17:05:31 -07:00
Enrico Ros 78d8b69bc7 Attach: restart on non-assistant 2024-09-13 17:02:22 -07:00
Enrico Ros 80a5cca30e Attach: File 2024-09-13 17:02:13 -07:00
Enrico Ros 21e7756a74 Attach: Camera icon just under the mic on mobile 2024-09-13 16:43:55 -07:00
Enrico Ros b1b23e7c4e Merge branch 'main' into big-agi-2
# Conflicts:
#	src/modules/llms/server/openai/models.data.ts
2024-09-13 14:14:41 -07:00
Enrico Ros bfa73ec6c5 Merge branch 'main-stable' 2024-09-13 14:10:08 -07:00
Enrico Ros 39c5c7c9ba Call out to Big-AGI 2 2024-09-13 14:06:12 -07:00
Enrico Ros e64a5e59ef 1.16.8 Release 2024-09-13 13:50:00 -07:00
Enrico Ros 574c2cf0e3 Call out to Big-AGI 2 2024-09-13 13:49:11 -07:00
Enrico Ros 1d3321b336 OpenAI: o1 support label 2024-09-13 11:02:33 -07:00
Enrico Ros de25e5822d OpenAI: o1 relabel 2024-09-13 10:59:40 -07:00
Enrico Ros 6a904c9f37 OpenAI: 3.5 non legacy 2024-09-13 10:59:32 -07:00
Enrico Ros 30c3283572 OpenAI: add o1 2024-09-13 10:53:42 -07:00
Enrico Ros 10bba19079 OpenAI: add ChatGPT-4o-latest 2024-09-13 10:53:32 -07:00
Enrico Ros 713079f2f2 OpenAI: bits 2024-09-13 10:53:20 -07:00
Enrico Ros 6e16e989ac OpenAI: move 4o-mini 2024-09-13 10:53:09 -07:00
Enrico Ros 4e89e0b1e4 OpenAI: clean IDs 2024-09-13 10:52:19 -07:00
Enrico Ros 6067c289ab OpenAI: remove vision previews 2024-09-13 10:52:00 -07:00
Enrico Ros 508c4bf80c Merge branch 'main' into big-agi-2
# Conflicts:
#	src/modules/llms/server/openai/models.data.ts
2024-09-13 10:24:47 -07:00
Enrico Ros 93b03bf87c Merge branch 'main-stable' 2024-09-13 10:21:27 -07:00
Enrico Ros 32ebfea9cb OpenAI: reorder 2024-09-13 10:20:52 -07:00
Darsh Mashru f1f28bca61 Fixed a redirection link typo
Changed "config-local-ollama" to "config-local-ollama.md" in link
2024-08-27 22:32:11 +05:30
Enrico Ros 1960e0bb3a Prod: fix titles 2024-08-27 03:07:35 -07:00
Enrico Ros 362eb46a7a Prod: document notImplemented() 2024-08-26 01:08:38 -07:00
Enrico Ros 9d86c30267 Prod: Better Pane 2024-08-26 01:04:56 -07:00
Enrico Ros 7a34fb4aba Prod: Chat Pane 2024-08-26 00:07:25 -07:00
Enrico Ros f3ccb46570 Prod: More panel improvements 2024-08-25 23:52:27 -07:00
Enrico Ros 2c60571702 Prod: Improve Panel 2024-08-25 23:29:24 -07:00
Enrico Ros 4c073202c0 Prod: Improve Restart & messaging 2024-08-25 23:29:04 -07:00
Enrico Ros 015534dbeb Optima: route the app menu to the optima panel, on mobile and when the app requests it 2024-08-25 03:57:56 -07:00
Enrico Ros 2ca0f0fc1c Optima: More Panel 2024-08-25 03:00:21 -07:00
Enrico Ros 7bea2a8191 Optima: Panel 2024-08-25 02:42:31 -07:00
Enrico Ros e828aa8580 Optima: appMenu rename, add panel 2024-08-25 02:21:35 -07:00
Enrico Ros b4285832e5 Optima: reorg 2024-08-25 02:07:41 -07:00
Enrico Ros f5a2313e46 Arrow 2024-08-24 21:01:14 -07:00
Enrico Ros 1ae14e94ae Prod: avatar label tooltip 2024-08-24 16:31:30 -07:00
Enrico Ros f396ce189a Prod: txt 2024-08-24 15:02:48 -07:00
Enrico Ros e83ae9150c Prod: fix share icons 2024-08-24 15:01:16 -07:00
Enrico Ros a93f99d5a2 Reorder 2024-08-24 05:24:21 -07:00
Enrico Ros fb055b6cf6 LFS: mention patch, but don't show it 2024-08-24 05:22:31 -07:00
Enrico Ros ce2f327b79 Allow for Bold edits 2024-08-24 05:12:49 -07:00
Enrico Ros 15694a59ba Improve PlantUML/Mermaid error messages 2024-08-24 05:03:46 -07:00
Enrico Ros 54e890b8e2 Anthropic: default to saving money 2024-08-24 04:44:27 -07:00
Enrico Ros efbbc8ec43 LiveEnhance: false by default 2024-08-24 04:41:12 -07:00
Enrico Ros cec3065830 Beam: fix generators 2024-08-24 04:40:55 -07:00
Enrico Ros 9b98c43b92 --!AIX;
remove much pre-AIX code.
2024-08-24 04:39:53 -07:00
Enrico Ros 0603a48e1e Beam: multimodal output, re-beam the correct model 2024-08-24 04:32:53 -07:00
Enrico Ros e001fc5449 Beam: port to AIX 2024-08-24 03:44:51 -07:00
Enrico Ros b0c46f4fe8 Improve render code menu 2024-08-24 03:35:46 -07:00
Enrico Ros f2f9365d64 Nothing 2024-08-23 00:40:59 -07:00
Enrico Ros c62423d7e3 Agi: what can I do? (I've been thinking about you) 2024-08-22 17:11:42 -07:00
Enrico Ros f4e488d658 Aix: disable different abort checks 2024-08-22 15:23:55 -07:00
Enrico Ros 87b57ff8ac Metrics: type 2024-08-22 04:34:12 -07:00
Enrico Ros e13070e15c Metrics: display Anthropic savings 2024-08-22 04:24:25 -07:00
Enrico Ros c4ce659c88 Aix: fix warning on abort while fetching hasn't completed 2024-08-22 04:12:45 -07:00
Enrico Ros 3e4a6432f0 Aix: fix Anthropic cached metrics presence 2024-08-22 02:28:40 -07:00
Enrico Ros 721fc0a33f Aix: fix full-stack 2024-08-22 02:28:40 -07:00
Enrico Ros 7354ff4023 Aix: select metrics for Aix CG 2024-08-21 23:15:30 -07:00
Enrico Ros a70e31e199 Fix Fred's demo 2024-08-21 23:01:02 -07:00
Enrico Ros 2958b2a96a AIX: large Client API improvement. Add DMessageGenerator (Aix)
Fix a number of bugs, including the last packet from the reassembler being ignored.
2024-08-21 04:37:25 -07:00
Enrico Ros a4ccd53ccc Support hiding messages from the AI 2024-08-20 17:15:29 -07:00
Enrico Ros dd428f433c Aix: begin clean 2024-08-20 15:40:28 -07:00
Enrico Ros 8f577396d5 Vnd.Ant.Cache: done 2024-08-20 14:47:15 -07:00
Enrico Ros 4ca7b60162 Vnd.Ant.Cache: only when > 1000 tokens 2024-08-20 14:38:07 -07:00
Enrico Ros 48b85edf20 Vnd.Ant.Cache: explain auto-cache in the menu 2024-08-19 22:43:46 -07:00
Enrico Ros f9980deac4 Vnd.Ant.Cache: proper Auto-Caching: in-proto, pre-submit, w/+manual, immediate setting, any-submit, remove pmix time 2024-08-19 15:22:03 -07:00
Enrico Ros 9dda4ff241 reduce usage of useModelsStore 2024-08-19 13:57:48 -07:00
Enrico Ros 3ad83f79ff Debug 2024-08-19 13:12:36 -07:00
Enrico Ros 3361fb3921 Aix: User Breakpoint full support. Supported by Anthropic. 2024-08-18 03:14:52 -07:00
Enrico Ros 25b88237a0 Anthropic cache breakpoint: UI and DMessage support (as a User Flag) 2024-08-18 02:06:47 -07:00
Enrico Ros bb20234a74 Vendors: instanceLimit optional, and 1 by default 2024-08-18 02:01:24 -07:00
Enrico Ros 88bf939d23 ChatMessage: Try ListItem -> Box 2024-08-18 02:01:24 -07:00
Enrico Ros 7c1d2cad66 Begin of Metrics 2024-08-18 02:01:24 -07:00
Enrico Ros 71f5ab96d4 Models: support breakpoints 2024-08-18 02:01:24 -07:00
Enrico Ros 746dd0ad05 DConversation: min 2024-08-17 23:43:41 -07:00
Enrico Ros d4324a8ba9 DMessage: cleanups 2024-08-17 23:42:19 -07:00
Enrico Ros 2550f345fc DMessage: flag 2024-08-17 23:30:13 -07:00
Enrico Ros 8d6ae13d65 Close post-dialog 2024-08-17 23:26:09 -07:00
Enrico Ros 1df31946c2 Come on 2024-08-17 23:13:14 -07:00
Enrico Ros 79108537d7 Even more vars update 2024-08-17 23:03:25 -07:00
Enrico Ros 5f61ccb6c3 More vars update 2024-08-17 23:00:49 -07:00
Enrico Ros 02739a9951 Tokens: update vars 2024-08-17 22:59:17 -07:00
Enrico Ros af49ee72b6 ERC: Save As 2024-08-17 20:05:40 -07:00
Enrico Ros 47b146aa38 fix padding 2024-08-17 16:26:18 -07:00
Enrico Ros 9ae8542100 ERC: /all 2024-08-17 16:18:21 -07:00
Enrico Ros 77596ffdfb Share: shorter IDs 2024-08-17 16:12:11 -07:00
Enrico Ros 07665ece59 Share: fix workspace 2024-08-17 16:12:11 -07:00
Enrico Ros c1fbd72785 Cleanup rate limiter 2024-08-17 15:46:22 -07:00
Enrico Ros ae43a1d8af Good metrics for non-streaming too: 2024-08-17 15:30:22 -07:00
Enrico Ros 6265868658 Chat Generation metrics: 2024-08-17 15:20:35 -07:00
Enrico Ros c6d4f2834e Non-linear pricing support. 2024-08-17 03:26:59 -07:00
Enrico Ros 77777da122 Rewind (no one's got time for this) 2024-08-17 02:52:40 -07:00
Enrico Ros 93ac4d59a3 Try to centralize - yet doesn't build 2024-08-17 02:42:17 -07:00
Enrico Ros e483050608 AIX: Define ListModels' output, and use it everywhere 2024-08-17 02:15:36 -07:00
Enrico Ros 4f1afc3221 Models Pricing: update all 2024-08-17 02:06:14 -07:00
Enrico Ros c098afe818 React deps 2024-08-16 23:53:59 -07:00
Enrico Ros 21045f5e72 Refactor: Source to Service, and move the store 2024-08-16 23:53:02 -07:00
Enrico Ros e827e9810a Gfx bug 2024-08-16 04:39:22 -07:00
Enrico Ros 9bc6fd6ad1 AIX: Anthropic: update pricing #623 2024-08-16 04:12:32 -07:00
Enrico Ros 590843f2a5 AIX: Anthropic: Disable breakpoint on the system message. Too short for typical chats (for now). #623 2024-08-16 04:11:50 -07:00
Enrico Ros d4bba26a2b AIX: Anthropic: Model-Driven Auto-Prompt-Caching. Fixes #623
Note: if there aren't enough tokens in the chat, the Anthropic API will throw. Nothing to do there for now.
We will wait for Anthropic to step in and fix the issue before fixing something on our end that's clearly not our issue.
2024-08-16 03:48:29 -07:00
Enrico Ros b591e1ab64 FormLabel: tooltips: top & arrow 2024-08-16 03:20:31 -07:00
Enrico Ros 245add3e15 Revert "Anthropic: fix #618" - Anthropic came out with Caching/Cost reduction and this gets in the way.
This reverts commit dfe6d3cf72.
2024-08-16 03:08:34 -07:00
Enrico Ros 42c8095665 Style fix 2024-08-16 02:21:26 -07:00
Enrico Ros 17f7057ec3 ChatMessage: bits 2024-08-16 00:05:31 -07:00
Enrico Ros c4a6f60562 ChatMessage: marking done 2024-08-16 00:00:35 -07:00
Enrico Ros 0faf0c4422 ChatMessage: improve selection matching 2024-08-15 23:29:34 -07:00
Enrico Ros e6163d227a ChatMessage: add highlighting 2024-08-15 22:53:25 -07:00
Enrico Ros 81bbd9f4f5 ChatMessage: improve sel matching 2024-08-15 22:52:46 -07:00
Enrico Ros 380e5fa664 ChatMessage: improve fragments bucket splitting 2024-08-15 22:52:26 -07:00
Enrico Ros ebfc67ed4a Fix render bug 2024-08-15 21:19:09 -07:00
Enrico Ros 1a215390e2 Render of highlighted Markdown 2024-08-15 20:33:47 -07:00
Enrico Ros 8f9d5cd5d7 Markdown: reorder renderers 2024-08-15 19:42:21 -07:00
Enrico Ros 128b259288 LFS: Overwrite (simple) 2024-08-15 18:12:41 -07:00
Enrico Ros e96c9247c3 Prioritize shortcut matching by level 2024-08-14 13:51:10 -07:00
Enrico Ros a7812b7bb9 Esc to cancel gen 2024-08-14 13:47:53 -07:00
Enrico Ros 2f7de4f43b Fix shift+ctrl+enter, big times 2024-08-14 13:30:37 -07:00
Enrico Ros cbcdb8a572 Mimes: add Python Notebooks support 2024-08-14 12:53:19 -07:00
Enrico Ros 6ed57cca24 ERC x LFS: extract patching hook 2024-08-14 02:42:59 -07:00
Enrico Ros 8fa7181a6d Rename folder 2024-08-14 02:05:46 -07:00
Enrico Ros 7400a03ee8 ERC x LFS: begin process 2024-08-14 01:53:51 -07:00
Enrico Ros 1df2b82c56 ERC x LFS: patch box 2024-08-14 01:40:41 -07:00
Enrico Ros 136dcbcd4c ERC x LFS: begin wire 2024-08-14 01:30:54 -07:00
Enrico Ros 29f9f22eff ERC x LFS: UX update2 2024-08-14 01:10:34 -07:00
Enrico Ros b5308caea1 ERC x LFS: UX update 2024-08-14 00:59:09 -07:00
Enrico Ros 0bb4fd4517 ERC x LFS: workspace supports d/d 2024-08-14 00:44:46 -07:00
Enrico Ros c745aae281 ERC x LFS: pick an additional file 2024-08-14 00:06:12 -07:00
Enrico Ros 9194b3b5f5 ERC x LFS: select new files 2024-08-13 23:48:55 -07:00
Enrico Ros 12c5c0a058 ERC x LFS: microstrings 2024-08-13 23:33:10 -07:00
Enrico Ros 04a96e47d7 ERC x LFS: superstrings 2024-08-13 23:32:07 -07:00
Enrico Ros 4ddaa75880 ERC x LFS: strings 2024-08-13 23:27:27 -07:00
Enrico Ros 085ff56654 ERC x LFS: disable auto-pick 2024-08-13 23:24:43 -07:00
Enrico Ros 5251232319 Draw: disclaimer 2024-08-13 23:11:41 -07:00
Enrico Ros 72fb677087 OpenPipe: updated the models list endpoint 2024-08-13 22:55:20 -07:00
Enrico Ros 23be99aef7 LF: note about the former 500ms coalesce idea 2024-08-13 22:52:11 -07:00
Enrico Ros 9f5093bf32 LF: reload from disk 2024-08-13 15:05:40 -07:00
Enrico Ros f386cf9b1b Fix code buttons on mobile 2024-08-13 15:02:32 -07:00
Enrico Ros 6e1bb66dbf LFS: disable on iPhone 2024-08-13 14:40:29 -07:00
Enrico Ros 1c0b8120e5 LFS: disable on Android. 2024-08-13 14:40:05 -07:00
Enrico Ros d342220b09 LFS: debug on Android. 2024-08-13 14:28:26 -07:00
Enrico Ros 1c09786d37 EnhancedRenderCode x LiveFileSync: move picker 2024-08-13 02:35:04 -07:00
Enrico Ros 694cd7483e EnhancedRenderCode x LiveFileSync: Apply To 2024-08-13 02:18:26 -07:00
Enrico Ros aeb6aa52e8 EnhancedRenderCode x LiveFileSync: update 2024-08-13 01:58:59 -07:00
Enrico Ros 04938c80f2 EnhancedRenderCode x LiveFileSync: extract WorkspaceLiveFilePicker 2024-08-13 01:49:27 -07:00
Enrico Ros f99c266255 EnhancedRenderCode x LiveFileSync: starts to look neat 2024-08-13 01:30:06 -07:00
Enrico Ros 830f972c43 EnhancedRenderCode x LiveFileSync: patch icon 2024-08-13 01:03:13 -07:00
Enrico Ros b07d7b81a7 EnhancedRenderCode x LiveFileSync: workspace File selection 2024-08-13 00:56:29 -07:00
Enrico Ros 859453fc02 EnhancedRenderCode x LiveFileSync: glue 2024-08-13 00:04:00 -07:00
Enrico Ros 7810445c39 AutoBlocks: move enhanced-code 2024-08-12 23:47:12 -07:00
Enrico Ros f7f1b5ad21 AutoBlocks: organize code 2024-08-12 23:45:42 -07:00
Enrico Ros bee7ee406d LiveFileSync: restrict to DocAttachmentFragment 2024-08-12 23:42:40 -07:00
Enrico Ros b035b85b15 LFS: begin ERC sync 2024-08-12 22:42:43 -07:00
Enrico Ros 908712045c isMobile: consistency 2024-08-12 22:31:29 -07:00
Enrico Ros 5a4715e608 Uniformly use isMobile: boolean 2024-08-12 22:24:28 -07:00
Enrico Ros 433354e938 LFS: rename 2024-08-12 22:02:28 -07:00
Enrico Ros 3d1efea655 Dynamic LiveFile support (tied to FS API) 2024-08-12 21:54:18 -07:00
Enrico Ros 5b6cb644ae EnhancedRenderCodeMenu: option to disable livefile 2024-08-12 21:37:16 -07:00
Enrico Ros b1abff01ea Rename Livefile hooks 2024-08-12 21:29:37 -07:00
Enrico Ros 4c221f89cc Make the code icon reflect the expand/collapse 2024-08-12 21:20:45 -07:00
Enrico Ros 9ffbd45961 Correct the gap of InReferenceTo (list) 2024-08-12 21:09:51 -07:00
Enrico Ros 8b88d4afe7 OpenPipe: fix (openpipe.name:aix.id) mapping. #615 2024-08-12 17:20:04 -07:00
Enrico Ros 0061fb4c30 OpenPipe: deployed is the default state 2024-08-12 17:03:37 -07:00
Enrico Ros 2f3977ca8d OpenPipe: small adjustment 2024-08-12 16:41:01 -07:00
Enrico Ros 915c876cd4 OpenPipe: add discovery and qualification of fine-tune models. #615 2024-08-12 16:30:23 -07:00
Enrico Ros 42d9d70bdc OpenPipe: fix validity 2024-08-12 15:26:47 -07:00
Enrico Ros 336819a2dd Also #617 2024-08-12 15:21:50 -07:00
Enrico Ros 0ec261f7ca Add error details for #617 2024-08-12 15:20:45 -07:00
Enrico Ros dfe6d3cf72 Anthropic: fix #618 2024-08-12 15:03:33 -07:00
Enrico Ros 8ab35a5fab Prod: fix search... menu on Mobile 2024-08-12 13:22:43 -07:00
Enrico Ros f6c71d98f5 Prod: fix tooltip items v-alignment 2024-08-12 12:29:00 -07:00
Enrico Ros 973e15363f Prod: switch to min cost on mobile 2024-08-12 12:25:56 -07:00
Enrico Ros 0a7a1b7a5f EnhancedRenderCode: on mobile, use the single-tap-collapse/expand 2024-08-12 12:18:34 -07:00
Enrico Ros beb415213a EnhancedRenderCode: expand/collapse done 2024-08-12 12:15:06 -07:00
Enrico Ros 7087d45b62 EnhancedRenderCode: improve expand/collapse 2024-08-12 11:56:56 -07:00
Enrico Ros 395d977e97 EnhancedRenderCode: expand/collapse all 2024-08-12 11:42:39 -07:00
Enrico Ros 6db608e2c8 EnhancedRenderCode: collapse from header 2024-08-12 11:16:16 -07:00
Enrico Ros 2ca025818a EnhancedRenderCode: enhance 2024-08-12 02:02:26 -07:00
Enrico Ros 5dab98bef9 EnhancedRenderCode: extract Menu 2024-08-12 01:29:22 -07:00
Enrico Ros ce29954c6e EnhancedRenderCode: improvements 2024-08-12 01:17:51 -07:00
Enrico Ros cd62e101c1 EnhancedRenderCode: option to turn it off 2024-08-11 23:10:57 -07:00
Enrico Ros 187d85db1f Continue the EnhancedRenderCode 2024-08-11 22:55:44 -07:00
Enrico Ros ad85f743b1 Enhance RenderCodePanelFrame 2024-08-11 22:38:37 -07:00
Enrico Ros 30300a2134 Extract RenderCodePanelFrame 2024-08-11 21:45:34 -07:00
Enrico Ros c9bf43e444 ChatMessage: update Editors 2024-08-11 20:37:13 -07:00
Enrico Ros 8a8e42c01d Confirm bar removal 2024-08-11 19:00:47 -07:00
Enrico Ros 78db1091ac GoodTooltip: outlined 2024-08-11 18:43:27 -07:00
Enrico Ros b4fdf4c7c4 AutoBlocks: introduce EnhancedRenderCode 2024-08-11 01:01:15 -07:00
Enrico Ros 227e51a97d AutoBlocks: improve variants 2024-08-11 00:44:20 -07:00
Enrico Ros b0ca462998 AutoBlocks: pass the semiStableId 2024-08-10 23:48:20 -07:00
Enrico Ros 7187e55afa Message > ContentFragments > ContentPartText_AutoBlocks 2024-08-10 23:41:07 -07:00
Enrico Ros 419c53322d Shortcuts: show when editing 2024-08-10 23:38:19 -07:00
Enrico Ros c86bd3088a AutoBlocks: remove useRef 2024-08-10 22:57:04 -07:00
Enrico Ros b943352569 Workspace: more usages 2024-08-10 22:34:09 -07:00
Enrico Ros 962619de47 Workspace: use an ID provider to remove prop-drilling 2024-08-10 22:24:45 -07:00
Enrico Ros 0fb408af8c Reduce noise. 2024-08-10 21:51:35 -07:00
Enrico Ros f9262e0f1f SuperJSON: This hack is actually still needed. 2024-08-10 21:50:48 -07:00
Enrico Ros 2c3f237ccc SuperJSON: The NextJS-immutability hack doesn't seem to be needed anymore.
With this hack, deserialization of `json` arrays (rather than objects) was also broken,
and would break the downstream tRPC streaming functionality.
2024-08-10 17:16:59 -07:00
Enrico Ros 1680ba4223 Aix Client debugging in Dev 2024-08-10 17:10:43 -07:00
Enrico Ros 14c0e23b75 Test this. 2024-08-10 17:10:18 -07:00
Enrico Ros bc6d9d5de1 Ignore this. 2024-08-10 16:37:55 -07:00
Enrico Ros 973ba8669f Roll deps - not cloudflare/puppeteer, which keeps getting broken 2024-08-10 15:19:59 -07:00
Enrico Ros 37a38c3c89 AutoBlocks: mega dirty prop drill 2024-08-09 05:23:05 -07:00
Enrico Ros 816d97e7d1 AutoBlocks: Code: extract extra buttons hooks 2024-08-09 04:54:55 -07:00
Enrico Ros 89965d09cf AutoBlocks: rename Code renderers 2024-08-09 04:46:40 -07:00
Enrico Ros da10e3214a bits 2024-08-09 04:41:34 -07:00
Enrico Ros 5a29b17b27 LFS: Really ugly prop drill. 2024-08-09 04:41:20 -07:00
Enrico Ros 2f00921698 AutoBlocks: give (and stabilize) and Id 2024-08-09 04:15:54 -07:00
Enrico Ros b2cd19a7e0 AutoBlocks: give (and stabilize) and Id 2024-08-09 04:15:46 -07:00
Enrico Ros d69bd91aca Mermaid: more resilient. 2024-08-09 04:14:52 -07:00
Enrico Ros 2ac84a0b2f Messages: fix layout 2024-08-09 02:01:53 -07:00
Enrico Ros e7c38c3785 RenderBlocks: extract hooks 2024-08-09 01:25:46 -07:00
Enrico Ros c903c7f7ed RenderBlocks: improve 2024-08-09 00:53:28 -07:00
Enrico Ros 9d1c87b3f2 Stabilize some 2024-08-08 23:20:29 -07:00
Enrico Ros 929f419760 Shortcuts: cleanups 2024-08-08 22:54:56 -07:00
Enrico Ros c31662e528 Ephemerals: port as Conversation Handler Overlay Store Slice 2024-08-08 22:46:31 -07:00
Enrico Ros 79151c0528 Workspace: prop-drill to ChatMessage 2024-08-08 21:31:17 -07:00
Enrico Ros d125b97d97 More Style Memos 2024-08-08 21:30:42 -07:00
Enrico Ros 65d9fc1dc7 Styles 2024-08-08 21:01:55 -07:00
Enrico Ros ef30a45388 AppChat: prop-drill Workspace Contents 2024-08-08 20:42:04 -07:00
Enrico Ros c3565d99fa Ephemerals: cleanups 2024-08-08 20:15:19 -07:00
Enrico Ros 1a6fbea8c7 MessageSelectionHeader: sticky 2024-08-08 20:06:43 -07:00
Enrico Ros ab386079b1 Workspace: store 2024-08-08 19:17:34 -07:00
Enrico Ros 448169563c LiveFile: workspace associations 2024-08-08 16:28:01 -07:00
Enrico Ros 1647a528a3 LiveFile: update 2024-08-08 15:41:57 -07:00
Enrico Ros eb78713cc3 LiveFile: cleanups 2024-08-08 15:21:19 -07:00
Enrico Ros ee71013f93 AudioGenerator: TR909 2024-08-08 14:53:25 -07:00
Enrico Ros d2ffec2d4e Adding ViewTransitionUtils: not well supported by React (we have too many state updates and async flows to use this).
Note: this worked in the InReferenceToBubble, migrating it from the composer to the last user message.
2024-08-08 02:31:06 -07:00
Enrico Ros 0132df0bf2 Roll prisma 2024-08-08 01:03:02 -07:00
Enrico Ros bf269ecbac LFS: actions in the Attachment TitleBar 2024-08-07 16:03:29 -07:00
Enrico Ros 8af6ac853b LFS: update expander menu 2024-08-07 15:35:13 -07:00
Enrico Ros aff50499a2 LFS: confirmation before overwrite 2024-08-07 15:25:17 -07:00
Enrico Ros c30fa2aafb LFS: improvements 2024-08-07 15:03:16 -07:00
Enrico Ros 02d6f5c10e LFS: perfect button in the toolbar 2024-08-07 14:43:42 -07:00
Enrico Ros b99869544f LFS: full DND pairing 2024-08-07 13:55:54 -07:00
Enrico Ros e07b5aa988 LFS: pairing 1 2024-08-07 13:42:10 -07:00
Enrico Ros bd873b84c9 Attachment: extract getDataTransferFilesOrPromises 2024-08-07 13:39:45 -07:00
Enrico Ros f28b7ebeb9 DragDrop: extraction done 2024-08-07 13:14:46 -07:00
Enrico Ros cfcffa9a65 LFS: extract LFSB 2024-08-07 13:04:46 -07:00
Enrico Ros 226e4b0f8b useDragDropDataTransfer: improve 2024-08-07 12:55:58 -07:00
Enrico Ros 8b9a103fd3 Extract useDragDropDataTransfer 2024-08-07 12:32:41 -07:00
Enrico Ros 6a0a76df92 LFS: button 2024-08-07 12:03:45 -07:00
Enrico Ros 3d81f2a814 Merge branch 'refs/heads/main' into big-agi-2 2024-08-07 02:53:36 -07:00
Enrico Ros 1aab4a6e51 Merge branch 'refs/heads/main-stable' 2024-08-07 02:52:28 -07:00
Enrico Ros 22b32d571d 1.16.7 Release 2024-08-07 02:50:10 -07:00
Enrico Ros a416cafc4e Mapping doc, for the future. 2024-08-07 02:46:33 -07:00
Enrico Ros 5f5efe6133 OpenAI: update models 2024-08-07 02:39:41 -07:00
Enrico Ros d066aba00e Style cleanups. 2024-08-07 01:45:09 -07:00
Enrico Ros 83e9965254 useAgiAttachmentPrompts: just. perfect. 2024-08-07 00:39:58 -07:00
Enrico Ros ce4e447032 useAgiAttachmentPrompts: good button, finally 2024-08-07 00:34:02 -07:00
Enrico Ros 568b16d2cf bits 2024-08-07 00:33:13 -07:00
Enrico Ros be2d857f82 useAgiAttachmentPrompts: deaggro 2024-08-07 00:06:07 -07:00
Enrico Ros c4c2fb9d39 useAgiAttachmentPrompts: improved hook 2024-08-06 22:37:09 -07:00
Enrico Ros 79f5d24e2f useAgiAttachmentPrompts: hook 2024-08-06 21:57:03 -07:00
Enrico Ros a69944c019 LiveFile: fix window refocus sync 2024-08-06 21:55:41 -07:00
Enrico Ros e4bb546442 LiveFile: update on window refocus (smart) 2024-08-06 20:36:14 -07:00
Enrico Ros 04ff184c23 Overlays: reject existing in case we are creating a new one. Should not happen, but enables great shortcut behaviors (x d d d x d..) 2024-08-06 19:57:36 -07:00
Enrico Ros 4718e26f96 Overlays: port more 2024-08-06 19:46:21 -07:00
Enrico Ros bd808594cb Overlays: overlay framework 2024-08-06 18:36:41 -07:00
Enrico Ros 00c2186106 Snackbar: clean 2024-08-06 13:57:41 -07:00
Enrico Ros a788b7a41b agiAttachmentPrompts: lower requirement to 1 2024-08-06 13:45:15 -07:00
Enrico Ros 024489939e agiAttachmentPrompts: update microcode2 2024-08-06 02:12:37 -07:00
Enrico Ros 33a0bd2d72 agiAttachmentPrompts: update microcode 2024-08-06 02:05:51 -07:00
Enrico Ros 029bcc7980 Attachments: fix controlled checkboxes 2024-08-06 01:47:13 -07:00
Enrico Ros acb2f6a1aa Attachments: youtube thumbnails 2024-08-06 01:30:12 -07:00
Enrico Ros 67184536a6 Attachments: youtube links as transcripts 2024-08-06 00:37:31 -07:00
Enrico Ros 85aed347cf YT: extract video id extraction 2024-08-05 23:43:13 -07:00
Enrico Ros 910f8c5a2f YT Persona: small cleanup 2024-08-05 23:36:48 -07:00
Enrico Ros bf47d40fdf Settings: improve padding 2024-08-05 20:27:22 -07:00
Enrico Ros c36440d576 DisableMarkdown: flipped the semantic meaning and removed some usages. On is the default 2024-08-05 20:20:04 -07:00
Enrico Ros 2e14c5a3d4 DoubleClickToEdit: default to false 2024-08-05 20:07:24 -07:00
Enrico Ros 7640e027d3 Merge branch 'refs/heads/main' into big-agi-2 2024-08-05 20:02:47 -07:00
Enrico Ros dccb493cf7 ReAct: bits 2024-08-05 20:02:37 -07:00
Enrico Ros 31a7ee0f4d ReAct: update doc 2024-08-05 19:51:42 -07:00
Enrico Ros 3ac1102274 ReAct: update doc 2024-08-05 19:50:20 -07:00
Enrico Ros a1c6cce61d ReAct: update doc 2024-08-05 19:49:05 -07:00
Enrico Ros 433f9a8162 Ephemerals: pinning to keep them on 2024-08-05 19:45:17 -07:00
Enrico Ros d0880da782 Improve Bubble and multi-refer-to 2024-08-05 19:08:04 -07:00
Enrico Ros e331393987 Roll packages 2024-08-05 19:07:52 -07:00
Enrico Ros 7047e98e91 Merge branch 'refs/heads/main' into big-agi-2 2024-08-05 18:05:14 -07:00
Enrico Ros 6c8a8bce88 Documentation: update ReAct 2024-08-05 18:05:03 -07:00
Enrico Ros a78f739935 Documentation: update ReAct 2024-08-05 17:56:38 -07:00
Enrico Ros 40c9b5a668 Documentation: document ReAct 2024-08-05 17:37:49 -07:00
Enrico Ros 46bb02f946 Documentation: document ReAct 2024-08-05 17:37:41 -07:00
Enrico Ros e57d4c724f bits 2024-08-05 16:10:00 -07:00
Enrico Ros d3c940bebc OpenPipe: add recording support, including tags. #615 2024-08-05 16:09:50 -07:00
Enrico Ros d71f94110f AttachmentAutoPrompts: support images 2024-08-04 06:07:55 -07:00
Enrico Ros 50e97e7523 remove logs 2024-08-04 06:07:36 -07:00
Enrico Ros 30ffd1a7ee InReferenceTo: multi-sentence, multi-role 2024-08-04 05:20:50 -07:00
Enrico Ros 030db4f769 Really Fix shortcuts matching 2024-08-04 02:08:40 -07:00
Enrico Ros 454f8620f7 Anthropic: start with the user message, if missing
This copies over the first line of the system prompt.
2024-08-04 02:03:30 -07:00
Enrico Ros f007f57b93 Fix shortcuts matching 2024-08-04 01:45:02 -07:00
Enrico Ros 573658ec7e Attachments: fix mime 2024-08-04 01:03:27 -07:00
Enrico Ros 1fc61f7c78 AutoPrompts: cleanup 2024-08-03 23:35:46 -07:00
Enrico Ros f0240018d6 useAsyncCall: improvements 2024-08-03 23:27:33 -07:00
Enrico Ros 4a40cca39e useAsyncCall: improvements 2024-08-03 23:22:15 -07:00
Enrico Ros 3add2b7a94 useAsyncCall: simplifies some state tracking 2024-08-03 23:09:08 -07:00
Enrico Ros 4fbcda03a5 AutoPrompts: extract 2024-08-03 21:25:24 -07:00
Enrico Ros 0020a49cd0 Gemini: updated default caps 2024-08-03 21:17:01 -07:00
Enrico Ros 7f7e484d4c Gemini: updated the capabilities (interfaces) of Pro/Experimental 2024-08-03 21:13:47 -07:00
Enrico Ros e9a162e952 Client-side error msg change 2024-08-03 21:01:28 -07:00
Enrico Ros 0a0270992d AIX: smallie 2024-08-03 20:59:04 -07:00
Enrico Ros 2d40e1b7ef Gemini: parse all finish reasons, and relax the parser 2024-08-03 20:58:11 -07:00
Enrico Ros 323e69d2eb Aix: client-side human errors 2024-08-03 20:46:18 -07:00
Enrico Ros f125b323b4 client-side add error utils 2024-08-03 20:40:16 -07:00
Enrico Ros b47b171e30 AIX: Client perfect exception handling 2024-08-03 20:24:21 -07:00
Enrico Ros f93a769c85 ChatMessage: 8 lines attachment preview 2024-08-03 19:16:36 -07:00
Enrico Ros fe2103b8cf ChatMessage: fix Content Fragments blank edit state 2024-08-03 19:13:47 -07:00
Enrico Ros 94278068c2 Blocks: tune edit 2024-08-03 19:00:55 -07:00
Enrico Ros b18a3f0fd9 Blocks: disaggro 2024-08-03 18:52:11 -07:00
Enrico Ros 1e5bb5aa7e Roll packages 2024-08-03 18:43:49 -07:00
Enrico Ros 3dd672a526 Blocks: Extract the Toggle button 2024-08-03 18:39:38 -07:00
Enrico Ros 92f3eb3184 Fix 2024-08-03 18:39:38 -07:00
Enrico Ros a8d1eb71c3 Blocks: Show Edit Shortcuts 2024-08-03 18:39:37 -07:00
Enrico Ros 4fb64d2117 Rename2 2024-08-03 16:04:20 -07:00
Enrico Ros e8beaa90ad Rename 2024-08-03 16:04:14 -07:00
Enrico Ros 5c3ecb86e1 Remove showTopWarning 2024-08-03 15:53:17 -07:00
Enrico Ros 13456da524 AutoBlocks: extract styles 2024-08-03 15:47:55 -07:00
Enrico Ros da15ab07e8 Rename 2024-08-03 15:41:08 -07:00
Enrico Ros 350c84fbda Move hooks 2024-08-03 15:32:39 -07:00
Enrico Ros 3efbe65ca6 Disaggro 2024-08-03 15:32:02 -07:00
Enrico Ros 7dffd797a4 Disaggro 2024-08-03 15:30:21 -07:00
Enrico Ros a6318e93a9 Document View: icon 2024-08-03 06:52:47 -07:00
Enrico Ros 7a7ab9b1ec Document View Mimetype: auto-detection of doc view type, and switch for manual override 2024-08-03 06:33:19 -07:00
Enrico Ros 6d8bb46985 Document View Mimetype: attachment pipeline adaptation 2024-08-03 06:03:59 -07:00
Enrico Ros 0b18e6d18a Document View Mimetype: good set of mimetypes 2024-08-03 05:37:03 -07:00
Enrico Ros 02dfda80a2 Document View Mimetype: dev conversion to vdt 2024-08-03 05:36:31 -07:00
Enrico Ros cb1e6f61f5 Document View Mimetype: doc renderer changes 2024-08-03 05:35:29 -07:00
Enrico Ros 2a359dfc4e Fix type 2024-08-03 04:28:32 -07:00
Enrico Ros 9f494288a9 Attachment: add Mime DB 2024-08-03 03:44:49 -07:00
Enrico Ros d90f2181b8 createVanillaStore 2024-08-03 01:56:40 -07:00
Enrico Ros 8be4582b5d Chat-overlay 2024-08-03 01:54:50 -07:00
Enrico Ros 8c817fba7c Roll pdfjs 2024-08-03 01:48:56 -07:00
Enrico Ros 543d32543c t2i: fix? 2024-08-03 00:26:29 -07:00
Enrico Ros f3dfb3383f Blocks: cleanup overlay button tooltip 2024-08-03 00:26:20 -07:00
Enrico Ros 8b733ed1f3 Blocks: external opening 2024-08-02 22:20:06 -07:00
Enrico Ros ffeb35a20b Blocks: over and out 2024-08-02 20:13:45 -07:00
Enrico Ros 2a1fccc43c Blocks: optimize 2024-08-02 19:54:54 -07:00
Enrico Ros a1097d2bb5 Blocks: improve IFrame processing 2024-08-02 19:53:59 -07:00
Enrico Ros b58465a769 Blocks: don't syntax highlight if not rendered 2024-08-02 19:38:51 -07:00
Enrico Ros 0f6af47eee Blocks: deaggro 2024-08-02 19:12:54 -07:00
Enrico Ros 1573d61a7e Blocks: rationalize overlays 2024-08-02 18:49:45 -07:00
Enrico Ros eb575a2320 Blocks: fix mouseover 2024-08-02 18:43:48 -07:00
Enrico Ros bbe4e36bd5 Blocks: extract overlay button 2024-08-02 18:39:48 -07:00
Enrico Ros b7de3669c3 Blocks: extract renderers 2024-08-02 18:27:07 -07:00
Enrico Ros 4011e55823 Blocks: support for extra 2024-08-02 18:23:29 -07:00
Enrico Ros 808992ecea Fix build 2024-08-02 17:55:24 -07:00
Enrico Ros 42596c6054 ContentPartTextEditor: reset min-rows 2024-08-02 17:55:20 -07:00
Enrico Ros 2cb3c82bd5 Blocks: improve button overlays 2024-08-02 17:51:45 -07:00
Enrico Ros 573143c57d Extract PlantUML renderer 2024-08-02 17:15:39 -07:00
Enrico Ros dfd77a3832 Fix showing errors 2024-08-02 17:13:12 -07:00
Enrico Ros c3d54defb7 RenderCode HTML: rename 2024-08-02 16:48:20 -07:00
Enrico Ros ae842984f2 Render User Text Content Fragments as text, not markdown. 2024-08-02 16:44:23 -07:00
Enrico Ros 421c586adb Perfect Composer Mic shortcuts, focus, logic. 2024-08-02 16:36:59 -07:00
Enrico Ros d06f9e17e1 Fix V3 load. 2024-08-02 07:31:07 -07:00
Enrico Ros b26954f326 Measure latency across providers. 2024-08-02 07:30:48 -07:00
Enrico Ros a7ee987e04 Data in-mem: rationalize upgrades 2024-08-02 06:47:13 -07:00
Enrico Ros cbdf48814b Data at Rest & Import/Export: rationalize 2024-08-02 06:15:51 -07:00
Enrico Ros df0854b897 Prepare to define Generator(s) 2024-08-02 04:19:52 -07:00
Enrico Ros 2ea79cf466 Cleanup 2024-08-02 04:19:29 -07:00
Enrico Ros 8e2db899c6 Restore OpenAI importer. 2024-08-02 04:18:43 -07:00
Enrico Ros c24876ba45 Remove cleanups - this may be risky, but let's dogfood it. 2024-08-02 03:54:15 -07:00
Enrico Ros 71bd05bbd1 Gif only in Extra mode. 2024-08-02 03:41:52 -07:00
Enrico Ros 7551848a29 Zen mode: dynamic theming. 2024-08-02 02:36:36 -07:00
Enrico Ros 05c304a053 Cleanup utility functions 2024-08-02 01:48:44 -07:00
Enrico Ros 4caa61da36 UI Complexity settings 2024-08-02 01:24:02 -07:00
Enrico Ros 080655b769 Open Drawers for 100ms at least. 2024-08-02 00:25:37 -07:00
Enrico Ros de4ab78664 Rename duplicate QueryClientProvider 2024-08-01 23:10:30 -07:00
Enrico Ros e72db54027 Open Drawers on press (both mobile and desktop) 2024-08-01 22:34:06 -07:00
Enrico Ros 8984c3d59c Proper separation. 2024-08-01 21:54:16 -07:00
Enrico Ros ce048c0521 Anticrash. 2024-08-01 20:10:04 -07:00
Enrico Ros 6c54220050 AIX: continuation as warning. 2024-08-01 05:43:07 -07:00
Enrico Ros 179ad9bbed AIX: basic continuation (user message). #613 2024-08-01 05:34:27 -07:00
Enrico Ros b6336a1fb0 AIX: cleanup debug 2024-08-01 05:31:24 -07:00
Enrico Ros f2676599c4 Remove react dep 2024-08-01 03:42:47 -07:00
Enrico Ros ba6cac9c2d AIX: handle max-tokens on 10 providers, streaming and non-streaming. #613 2024-08-01 01:44:04 -07:00
Enrico Ros 95633e0a88 AIX: OpenAI: relax finish_reason parsers, as OpenRouter makes a mess 2024-08-01 01:42:00 -07:00
Enrico Ros 515241edca OpenRouter: transmit upstream errors. 2024-08-01 01:01:58 -07:00
Enrico Ros 928231ce06 Together: add tool_calls=null exception.
https://github.com/togethercomputer/together-python/issues/160
2024-08-01 00:28:47 -07:00
Enrico Ros a46c6becbc Azure: improve model naming 2024-08-01 00:27:07 -07:00
Enrico Ros 273889eda0 tRPC fetchers: reduce log 2024-08-01 00:00:02 -07:00
Enrico Ros d0ce4359df OpenRouter: quick add/hide all. Fixes #605 2024-07-31 23:51:16 -07:00
Enrico Ros f1a0a22c2d Optima: optimize 2024-07-31 06:01:55 -07:00
Enrico Ros 64af43de4e Optima: full context removal 2024-07-31 05:00:12 -07:00
Enrico Ros 8c4f896e8a Stabilize the desktop nav (3rd group) 2024-07-31 04:20:41 -07:00
Enrico Ros ce33166c5c Stabilize the markdown renderer 2024-07-31 03:57:12 -07:00
Enrico Ros 10696fd5e7 zustand-5: disable devtools 2024-07-31 03:29:19 -07:00
Enrico Ros d53336baab zustand-5: fix some errors in conversion 2024-07-31 03:17:23 -07:00
Enrico Ros af96060e69 misc: disablePortal won't work for the top bar 2024-07-31 01:37:07 -07:00
Enrico Ros faccc1735f zustand: final removal of 'shallow' 2024-07-31 01:36:55 -07:00
Enrico Ros ab033807c4 roll packages 2024-07-31 00:50:07 -07:00
Enrico Ros 62c6353ca0 Optima: partial renames 2024-07-31 00:49:49 -07:00
Enrico Ros 79c1786bf3 Optima: migrated modals state - great stability 2024-07-30 23:58:53 -07:00
Enrico Ros 4b6759f2ad OptimaLayout: move AppMenu to zustand 2024-07-30 19:19:08 -07:00
Enrico Ros e166fd6703 MP: fix build 2024-07-30 04:41:43 -07:00
Enrico Ros 91f5f07a7f MP: Improve fx. 2024-07-30 04:39:16 -07:00
Enrico Ros 9678b6943d MP: Show empty messages. 2024-07-30 04:39:16 -07:00
Enrico Ros b439308023 Bring back the build. 2024-07-30 02:56:25 -07:00
Enrico Ros 8e1167d848 Remove debug hook. 2024-07-30 02:52:42 -07:00
Enrico Ros 575efb07f4 NextJS page router layout function - faster, lower flicker. 2024-07-30 02:40:33 -07:00
Enrico Ros ce93ab8234 withLayout: optimize 2024-07-30 01:56:28 -07:00
Enrico Ros 73ecc91188 Optima: react to presence/absence of Portal-in content 2024-07-30 00:39:18 -07:00
Enrico Ros f0a0dfc72a Optima: rationalize Portal names 2024-07-30 00:15:09 -07:00
Enrico Ros 95788f5dcd Optima: convert topbar to portals 2024-07-29 23:27:30 -07:00
Enrico Ros af18dc6683 Optima: convert drawers to portals 2024-07-29 23:18:00 -07:00
Enrico Ros 8d6540289d Optima: portals 2024-07-29 22:45:52 -07:00
Enrico Ros 7a5a24f210 Auto-Attachment-Prompt: under Flag 2024-07-29 17:13:24 -07:00
Enrico Ros 1f2f4b61b0 Fix pasting Screenshots 2024-07-29 16:41:28 -07:00
Enrico Ros 71d6bec954 Roll packages 2024-07-29 01:48:12 -07:00
Enrico Ros 4da95a389a Fix the 'shallow' warning once and for all. 2024-07-29 01:45:17 -07:00
Enrico Ros a28936199c Model search box when more than 50. 2024-07-29 01:12:10 -07:00
Enrico Ros da5cb20c3b DebouncedInput: support aggressive focus retention 2024-07-29 01:06:19 -07:00
Enrico Ros f01dc76b7f PageBarDropDown: add optional prepender 2024-07-29 00:41:44 -07:00
Enrico Ros ae7bcb84ab ContentFragments: let broken images be deleted 2024-07-28 22:08:39 -07:00
Enrico Ros 971686af2c FF: Composer: text area actions - intelligent function with attachments 2024-07-26 02:47:40 -07:00
Enrico Ros 4608d5fc2d AIX: streaming as a param, return the fragments. 2024-07-26 02:46:39 -07:00
Enrico Ros cb6ffc294c LLMAttachments: rename collection 2024-07-26 00:09:24 -07:00
Enrico Ros 52b1df0b4d Improve shallow object|array[] stabilizer 2024-07-26 00:06:51 -07:00
Enrico Ros 4b7cb28d3b AIX: Client function call tool definition helpers 2024-07-25 23:33:27 -07:00
Enrico Ros b9ab6d87c7 AIX: emit the debug request right away, and ready for a potential start message 2024-07-25 22:59:08 -07:00
Enrico Ros a5055ab67b Install zod-to-json-schema and roll packages 2024-07-25 22:55:50 -07:00
Enrico Ros f72f9f32cf OpenAI: fix chatGenerate adapter for Doc fragments 2024-07-25 01:29:34 -07:00
Enrico Ros 1eee2b8710 Mistral: FC warnings 2024-07-25 01:29:12 -07:00
Enrico Ros d3aaa8ae75 Lints 2024-07-24 23:31:51 -07:00
Enrico Ros 69e80fd415 Roll packages 2024-07-24 21:39:56 -07:00
Enrico Ros 836760accf Merge branch 'refs/heads/main' into big-agi-2 2024-07-24 21:33:23 -07:00
Enrico Ros cd504285b4 Merge branch 'refs/heads/main-stable' 2024-07-24 21:32:50 -07:00
Enrico Ros 977bcbb741 AIX: support Tool Invocation 2024-07-24 21:21:00 -07:00
Enrico Ros 3d11b85842 AIX: ReAssembler 2024-07-24 21:19:34 -07:00
Enrico Ros b8d0a5064b Tool Use/Response terrible rendering 2024-07-24 21:19:34 -07:00
Enrico Ros b50b796f15 AIX: fuller view of the last AIX transaction 2024-07-24 21:19:34 -07:00
Enrico Ros 04111e8a06 Labs: DEV: disable streaming UX option 2024-07-24 21:19:34 -07:00
Enrico Ros 432369abec Fragments: improve Data & constructors 2024-07-24 21:15:50 -07:00
Enrico Ros 8743c91275 AIX: Particles: update types 2024-07-24 21:15:20 -07:00
Enrico Ros b79dd3dbe0 AIX: Particle Transmitter: ok - new transmission logic 2024-07-24 21:13:21 -07:00
Enrico Ros d9df5d02be Anthropic: fix {} in the first tool call 2024-07-24 21:11:00 -07:00
Enrico Ros 2413a4d081 Groq: update output tokens (max 8,000 for 3.1) 2024-07-24 21:10:08 -07:00
Enrico Ros 4646394fe3 Server side nanoId: add prefix to distinguish us 2024-07-24 21:02:25 -07:00
Enrico Ros 288006ac1e Groq: update Models 2024-07-24 20:54:42 -07:00
Enrico Ros af65723a2c Groq: add failed_generation reporting 2024-07-24 20:49:14 -07:00
Enrico Ros ac5834f54d FF: snap reassembly 2024-07-24 06:25:44 -07:00
Enrico Ros bdc5143260 FF: snap reassembly 2024-07-24 06:08:11 -07:00
Enrico Ros 067d600fd3 FF: snap reassembly 2024-07-24 06:08:04 -07:00
Enrico Ros ee57c5f78f FF: snap tools 2024-07-24 05:44:45 -07:00
Enrico Ros 45722bbf56 FF: remove function 2024-07-24 05:06:05 -07:00
Enrico Ros 8fee5e0fd3 FF: fix namespacing 2024-07-24 04:51:39 -07:00
Enrico Ros 728c98f26d FF: fix Facton 2024-07-24 04:46:48 -07:00
Enrico Ros daab5ea0bc FF: fix crashes on undefined tokens 2024-07-24 04:15:26 -07:00
Enrico Ros 04e2d6e8eb FF: fix tRPC/superjson crash on 'undefined' values 2024-07-24 04:00:15 -07:00
Enrico Ros 58038a72d3 FF: fix gemini recitation fault 2024-07-24 03:59:07 -07:00
Enrico Ros 38ac0f1287 Aix: move Ollama out 2024-07-24 03:38:41 -07:00
Enrico Ros c870047f44 Aix: complete the (non-throttled) ChatGenerateTransmitter 2024-07-24 03:36:05 -07:00
Enrico Ros c65d472b97 FF: flush 2024-07-24 01:42:36 -07:00
Enrico Ros 239e332a28 FF: fix resource usage parsing 2024-07-24 01:42:10 -07:00
Enrico Ros c42c43165c FF: fix Router double-emission of the 'end' message on 'done-dialect' (Anthropic) 2024-07-24 01:25:40 -07:00
Enrico Ros b1810a2dbe FF: fix Gemini 2024-07-24 01:05:22 -07:00
Enrico Ros bab25bf763 Fix nth-of-type. 2024-07-24 00:41:13 -07:00
Enrico Ros 037ed5cbf6 Reply to on the user part too. Future: add role to the part. 2024-07-24 00:36:58 -07:00
Enrico Ros 1d0de6172f Roll Typescript 2024-07-23 04:33:45 -07:00
Enrico Ros 8a9dfa6143 Bits 2024-07-23 04:33:34 -07:00
Enrico Ros be2de6f90d MP: More details on the AttachmentFragmentEditor 2024-07-23 04:23:25 -07:00
Enrico Ros 604797b3f0 Attachments: more correct file size 2024-07-23 03:49:10 -07:00
Enrico Ros 7c4e08cad3 ScrollToBottom: skip autoscroll 2024-07-23 03:49:10 -07:00
Enrico Ros 075cd45c4c LiveFile: Subsystem complete. 2024-07-23 03:10:27 -07:00
Enrico Ros 096e2784d2 AttachmentButton: massive performance boost 2024-07-23 03:10:27 -07:00
Enrico Ros 0bba84d42d AttachmentButton: fix react issues 2024-07-23 02:31:09 -07:00
Enrico Ros 4a9feef7d1 LiveFile: Central approach 2024-07-22 20:50:35 -07:00
Enrico Ros 818595aeb5 LiveFile: react dep 2024-07-22 16:54:16 -07:00
Enrico Ros c2cd098003 LiveFile: message 2024-07-22 16:19:26 -07:00
Enrico Ros 7639eaa942 LiveFile: useLiveFile 2024-07-22 07:57:24 -07:00
Enrico Ros 96e9f9f780 Roll packages 2024-07-22 04:11:31 -07:00
Enrico Ros d7177dd4b7 LiveFile: style sync 2024-07-22 03:50:24 -07:00
Enrico Ros cd04ae461d LiveFile: small renames 2024-07-22 02:37:43 -07:00
Enrico Ros 5049ff24fa Fix #601 2024-07-22 02:26:15 -07:00
Enrico Ros 1bc22b15e3 LiveFile: Reload: 👍 2024-07-22 02:24:53 -07:00
Enrico Ros d9e46378ba LiveFile: Ready to Load 2024-07-22 02:05:02 -07:00
Enrico Ros 2c30790d4f Conversation: rename _abortController (and don't export/import it) 2024-07-22 02:02:47 -07:00
Enrico Ros f5ccd060a7 Attachments: Auto-select fix 2024-07-21 23:57:37 -07:00
Enrico Ros be40150515 LiveFile: AttachmentFragments 2024-07-21 23:57:15 -07:00
Enrico Ros b6c6317c62 LiveFiles: naming 2024-07-21 20:46:12 -07:00
Enrico Ros 5b00ddc43f LiveFiles: restructure, and store Handle to Attachment fragments 2024-07-21 20:43:52 -07:00
Enrico Ros 75be822b1b Cleanup 2024-07-21 20:11:46 -07:00
Enrico Ros feae7687e8 LiveFiles: relative name conversion on folder drops 2024-07-21 19:52:35 -07:00
Enrico Ros e1ceb02af1 LiveFiles: improve debugging 2024-07-21 19:35:27 -07:00
Enrico Ros 160f440588 LiveFiles: support folders drag/drop 2024-07-21 19:23:13 -07:00
Enrico Ros 3e439e1bef LiveFiles: improve drop 2024-07-21 17:28:08 -07:00
Enrico Ros 073b81cfb9 LiveFiles: async 2024-07-21 17:06:22 -07:00
Enrico Ros 85a832007a AIX: GCTransmitter high-level logic, and remove IntakeHandler 2024-07-20 20:28:45 -07:00
Enrico Ros 2760b7d431 AIX: Update Protocol parsing documentation 2024-07-20 16:17:15 -07:00
Enrico Ros 2bc429851d AIX: sync Readme. 2024-07-20 15:36:48 -07:00
Enrico Ros dbdb94ebcb AIX: PartTransmitter update 2024-07-20 15:36:42 -07:00
Enrico Ros 975672a551 Backup 2024-07-20 15:10:40 -07:00
Enrico Ros 9e095022f4 Roll packages 2024-07-20 15:05:12 -07:00
Enrico Ros 7fcedf452b AIX: OpenAI: split 'assistant' non-streaming wiretypes 2024-07-20 14:59:42 -07:00
Enrico Ros 8618664578 AIX: Remove Oobabooga 2024-07-20 14:59:42 -07:00
Enrico Ros 7405e45db2 AIX: connection options 2024-07-20 14:42:32 -07:00
Enrico Ros 8241386e7f AIX: PartTransmitter 2024-07-20 05:38:56 -07:00
Enrico Ros cf36c4eb8f AIX: update Readme with NS support 2024-07-20 05:37:27 -07:00
Enrico Ros a311531621 AIX: OpenAI: update wiretypes to allow for Mistral/NS 2024-07-20 05:37:14 -07:00
Enrico Ros 2876958ca6 AIX: update README 2024-07-20 04:44:28 -07:00
Enrico Ros 2ad60cddfc Gemini: cleanup Wiretypes 2024-07-20 01:24:46 -07:00
Enrico Ros 12fd0275ee Gemini: document parsing 2024-07-20 01:24:35 -07:00
Enrico Ros 3f66dcb0f6 Gemini: fix FC? 2024-07-20 00:57:50 -07:00
Enrico Ros 6d01c8f41d Gemini: update Wiretypes 2024-07-20 00:44:28 -07:00
Enrico Ros 652b902ece AIX: Update README 2024-07-19 19:13:04 -07:00
Enrico Ros 1225d4da15 AIX: Bits 2024-07-19 18:08:08 -07:00
Enrico Ros f313481727 AIX: Remove Ollama 2024-07-19 17:59:17 -07:00
Enrico Ros 9c84697094 AIX: Api: move away from Intake 2024-07-19 17:33:56 -07:00
Enrico Ros bcd3e3fdb6 AIX: improve architecture diagram 2024-07-19 17:07:24 -07:00
Enrico Ros 05bfbd8028 AIX: sync docs 2024-07-19 15:12:06 -07:00
Enrico Ros 9c07cada05 Effects placeholders 2024-07-19 15:06:03 -07:00
Enrico Ros 3e15ccee59 Empty out filters 2024-07-19 14:58:19 -07:00
Enrico Ros b169b2132c Future SVG filters support 2024-07-19 14:29:51 -07:00
Enrico Ros 6ed461788e Composer Tokens: highlight costs 2024-07-19 14:29:51 -07:00
Enrico Ros c3fea28592 Composer Tokens: extract and cleanup 2024-07-19 13:59:58 -07:00
Enrico Ros fcae1c9902 React: update dependency 2024-07-19 13:39:44 -07:00
Enrico Ros b177ddf3bb AIX: update AixWire namespaces 2024-07-19 13:37:50 -07:00
Enrico Ros 2c64e8e4ec Comment 2024-07-19 03:18:49 -07:00
Enrico Ros bba51ca5f3 MP: use l1Title where available 2024-07-19 03:05:18 -07:00
Enrico Ros a727350f37 MP: Doc: add l1_title 2024-07-19 02:52:46 -07:00
Enrico Ros bde369df29 MP: cleanup types 2024-07-19 02:44:10 -07:00
Enrico Ros 1ba227e449 Roll packages 2024-07-18 16:25:25 -07:00
Enrico Ros 9ad772e39e Merge branch 'refs/heads/main' into feature-multipart
# Conflicts:
#	src/apps/chat/components/message/ChatMessage.tsx
2024-07-18 16:18:36 -07:00
Enrico Ros 68b682ecb9 Merge branch 'refs/heads/main-stable' 2024-07-18 16:17:04 -07:00
Enrico Ros e24fc94af1 Small layout fixes 2024-07-18 15:44:28 -07:00
Enrico Ros a04f91ae64 Improve composer separator 2024-07-17 21:54:25 -07:00
Enrico Ros 4120f7e923 Shortcuts: Active. 2024-07-17 12:21:37 -07:00
Enrico Ros ad28e86d4c Shortcuts: Finalize - looks great 2024-07-17 12:07:58 -07:00
Enrico Ros 9978c45548 Shortcuts: Professional Status Bar 2024-07-17 11:52:48 -07:00
Enrico Ros a874032fba Shortcuts: global rationalization 2024-07-17 09:59:47 -07:00
Enrico Ros b9ba0ad7c9 DEV MODE. Visible/usable only on localhost:3xxx 2024-07-16 17:52:51 -07:00
Enrico Ros 1602664130 AIX: move parser types 2024-07-16 17:24:38 -07:00
Enrico Ros da82810334 Speech Recognition: auto-send on keypress sound 2024-07-16 17:23:50 -07:00
Enrico Ros 73e9357364 Speech Recognition: improve states 2024-07-16 17:23:33 -07:00
Enrico Ros f00a87fc06 Attachments: pure-image website attachments 2024-07-16 03:47:23 -07:00
Enrico Ros 730ed42931 Attachments: show website preview (even if not attached) 2024-07-16 03:32:54 -07:00
Enrico Ros b2787f8bf9 RenderImageURL (and RefDblob) support a plain button render 2024-07-16 03:24:54 -07:00
Enrico Ros d254775f24 Diff: recycle the Add Files button 2024-07-16 02:50:47 -07:00
Enrico Ros 3a6a95704c DesktopDrawer: more visible line compared to 'divider' 2024-07-16 01:56:36 -07:00
Enrico Ros 6bb753d0ae ReplyToBubble: improve inline 2024-07-16 01:56:18 -07:00
Enrico Ros 3aea2b02b7 AIX: Reply-To ordered correctly 2024-07-16 00:53:40 -07:00
Enrico Ros fb9c50f6b3 Text Diff Tool - extends #194 2024-07-16 00:53:11 -07:00
Enrico Ros 332440a6d3 Improve Desktop Nav 2024-07-15 23:42:31 -07:00
Enrico Ros 3b5a6fabee AppTokens: improve 2024-07-15 23:15:05 -07:00
Enrico Ros 426764fcce AIX: Move readme 2024-07-15 21:53:41 -07:00
Enrico Ros 02ca84a467 AIX: Massive updates 2024-07-15 21:49:39 -07:00
Enrico Ros 6fd393949c AIX: Supreme Wire Types 2024-07-15 18:31:07 -07:00
Enrico Ros c8d16c7261 Chat: update Fragments 2024-07-15 18:20:22 -07:00
Enrico Ros 2332372bca AIX: Intake: perfect wire types 2024-07-15 18:18:58 -07:00
Enrico Ros 5bd45e2c2a AIX: Intake: new wire 2024-07-15 15:26:15 -07:00
Enrico Ros 5a7b50ed2f roll packages 2024-07-15 14:27:29 -07:00
Enrico Ros ee469c7759 Merge branch 'refs/heads/main' into feature-multipart 2024-07-15 14:15:16 -07:00
Enrico Ros e075803907 Merge branch 'refs/heads/main-stable' 2024-07-15 14:14:57 -07:00
Enrico Ros 3d57f10a2f Disable play/pause handlers for now
This is meant to have a single key shortcut (e.g. play/pause) to interact with the app.
2024-07-15 13:56:46 -07:00
Enrico Ros 2ece0698cf play/pause handlers 2024-07-15 13:47:42 -07:00
Enrico Ros 43d424f1f8 Improve delete message 2024-07-15 12:57:57 -07:00
Enrico Ros 8428d2af7f AIX: OpenAI basic FC algo
Verified on: Azure, Groq, LMStudio, LocalAI, Mistral, OpenAI, TogetherAI
FC not supported on: Deepseek, Perplexity
FC poorly supported on: OpenRouter (basically only in OpenAI it works)
2024-07-15 03:45:52 -07:00
Enrico Ros ebcb827400 AIX: extract parsers 2024-07-15 02:18:00 -07:00
Enrico Ros e7773f6227 a 2024-07-15 02:10:16 -07:00
Enrico Ros c06250ecb1 AIX: Gemini: improve function calling 2024-07-15 02:05:49 -07:00
Enrico Ros 97786eb396 AIX: Gemini: first code execution 2024-07-15 01:55:40 -07:00
Enrico Ros b1a16517bf AIX: router: Improve dispatch 2024-07-15 01:36:10 -07:00
Enrico Ros 0bfc9545d3 AIX: Gemini: fix wires and parsing 2024-07-15 01:02:23 -07:00
Enrico Ros 9caf7763a5 Bits 2024-07-15 00:09:14 -07:00
Enrico Ros 0db62d0af1 AIX: Gemini: generateContent 2024-07-14 21:41:38 -07:00
Enrico Ros 0bbaf9bf95 AIX: update replyTo 2024-07-14 21:32:52 -07:00
Enrico Ros 80406f855a AIX: misc 2024-07-14 21:31:46 -07:00
Enrico Ros 300b5cafe2 UI: reduce default text size 2024-07-14 21:27:01 -07:00
Enrico Ros cb36cba9ab AIX: dispatch: move adapters 2024-07-14 19:45:39 -07:00
Enrico Ros 7c2026ac37 AIX: Gemini: begin wiring 2024-07-14 19:42:25 -07:00
Enrico Ros 5703c52fd7 AIX: Gemini: optimal wiretypes 2024-07-14 19:34:17 -07:00
Enrico Ros b3eba5c841 AIX: Anthropic: optimal wiretypes 2024-07-14 16:45:35 -07:00
Enrico Ros 4a6d272017 AIX: move dispatch wiretypes 2024-07-14 16:22:09 -07:00
Enrico Ros 26f5f35754 AIX: OpenAI: wiretypes delight 2024-07-14 16:16:22 -07:00
Enrico Ros 8c36502aeb AIX: OpenAI: reduce wiretypes visibility (until necessary) 2024-07-14 16:12:11 -07:00
Enrico Ros 0918d6be07 AIX: OpenAI: perfect wiretypes 2024-07-14 16:04:21 -07:00
Enrico Ros b48b102b35 AIX: intake: lower schema 2024-07-14 15:42:04 -07:00
Enrico Ros 46f98d643f AIX: improve wire types 2024-07-14 15:41:52 -07:00
Enrico Ros a9eccf2819 AIX: dispatch: improve chatGenerate structure 2024-07-14 15:17:55 -07:00
Enrico Ros 98ff38f8e1 Fix code leading spaces removal 2024-07-14 14:37:29 -07:00
Enrico Ros d969f55730 AIX: structure (folders) 2024-07-14 14:28:25 -07:00
Enrico Ros 082236e7d8 AIX: Rationalize hotfixes 2024-07-14 05:05:59 -07:00
Enrico Ros d43c81401e AIX: OpenRouter fixes 2024-07-14 04:44:26 -07:00
Enrico Ros c9824f1486 AIX: Perplexity hotfixes too 2024-07-14 04:32:34 -07:00
Enrico Ros 1e8f49d3a3 AIX: F'n call - F****** Mess 2024-07-14 04:06:32 -07:00
Enrico Ros 42696b82d5 AIX: Azure, Deepseek, Mistral, OpenRouter, Perplexity, Together fixes 2024-07-14 04:06:11 -07:00
Enrico Ros 004596a9c2 Ctrl + Shift + Z to regenerate the last message (very frequent op, frequent shortcut) 2024-07-14 03:50:15 -07:00
Enrico Ros c994f52a79 Bits 2024-07-14 03:49:41 -07:00
Enrico Ros ccff695f3a Fixed tRPC-domain fetchers' errors 2024-07-14 03:08:02 -07:00
Enrico Ros d1c318ed7e Attachments: progress 2024-07-13 22:56:29 -07:00
Enrico Ros 059dbe684c Attachments: vast betterment 2024-07-13 21:55:24 -07:00
Enrico Ros ec3c35095b Attachments: better menu looks 2024-07-13 21:55:24 -07:00
Enrico Ros ad8f5fec5b Attachments: support multiple converters 2024-07-13 18:18:34 -07:00
Enrico Ros 376f1ac5e0 roll packages 2024-07-13 12:45:14 -07:00
Enrico Ros 3978c50afc Browsing: enable page screenshot 2024-07-12 16:53:28 -07:00
Enrico Ros 0d25226c30 Rationalize open blobs in new tab 2024-07-12 16:40:46 -07:00
Enrico Ros f99cc74466 AIX: Reply-To 2024-07-12 15:22:08 -07:00
Enrico Ros 160d09f1d8 Remove obsolete 2024-07-12 14:12:20 -07:00
Enrico Ros f591b1711d Roll tRPC - incredible framework 2024-07-12 14:10:54 -07:00
Enrico Ros b4ce247c71 Replaced old doc 2024-07-12 13:51:20 -07:00
Enrico Ros adc7cd82fa Merge branch 'refs/heads/main' into feature-multipart 2024-07-12 13:49:28 -07:00
Enrico Ros 9327be14b7 LocalAI: new proto fix 2024-07-12 05:19:23 -07:00
Enrico Ros 8fa4fe85c4 Bits 2024-07-12 05:19:13 -07:00
Enrico Ros 2eb61f4777 AIX: Router debug parsing 2024-07-12 04:31:32 -07:00
Enrico Ros 0bdd3addc8 Cleanups 2024-07-12 04:29:31 -07:00
Enrico Ros 756738b540 Fix image tokens estimation 2024-07-12 04:29:20 -07:00
Enrico Ros 6b55bba634 AIX: OpenAI: adapter done 2024-07-12 04:12:35 -07:00
Enrico Ros 3f679ffb6a AIX: Anthropic: improve typing in the intake message conversion 2024-07-12 02:25:27 -07:00
Enrico Ros e87fe870bb AIX: OpenAI: improve FC schema 2024-07-12 01:48:40 -07:00
Enrico Ros 6fc6b23f38 AIX: Intake: improve schemas 2024-07-12 01:48:23 -07:00
Enrico Ros 03d633715a AIX: Anthropic: bits 2024-07-12 01:16:17 -07:00
Enrico Ros 99087ccdf0 FetchFromTRPC: cleanup 2024-07-12 01:15:49 -07:00
Enrico Ros b832025e88 Create 2024-AI-APIs-Comparison.md 2024-07-11 23:06:44 -07:00
Enrico Ros 1e5e3a225c Fix warning on ChatDrawer search 2024-07-11 03:20:11 -07:00
Enrico Ros c6f79b35de Improve Autospeak 2024-07-11 03:11:27 -07:00
Enrico Ros fa97bcc9f5 AIX: Anthropic streaming tool initial support 2024-07-11 02:54:55 -07:00
Enrico Ros a1ef070d49 AIX: client-side controlled debug 2024-07-11 02:54:42 -07:00
Enrico Ros 1db71d9ba7 AIX: dynamic streaming support 2024-07-11 02:31:44 -07:00
Enrico Ros de139cada0 AIX: Dispatch: !streaming 2024-07-11 01:12:02 -07:00
Enrico Ros b994ec8bbc AIX: Anthropic: timeInner 2024-07-11 00:59:15 -07:00
Enrico Ros 90b326da53 Screencap: 200ms delay, to remove the capture window from self 2024-07-11 00:53:28 -07:00
Enrico Ros fa70e6ac9d AIX: Messages API: rescale assistant messages 2024-07-11 00:44:09 -07:00
Enrico Ros a2b5a78454 AIX: from DMessages[] 2024-07-11 00:23:45 -07:00
Enrico Ros 167c944b64 AIX: .chat -> .chatSequence 2024-07-10 23:47:56 -07:00
Enrico Ros 77c7836a93 AIX: Anthropic: cleaner conversion 2024-07-10 23:47:11 -07:00
Enrico Ros 388194e8bc AIX: Anthropic: return token count and rate 2024-07-10 23:46:48 -07:00
Enrico Ros 1f5558a757 AIX: Gemini: wall emoji 2024-07-10 22:53:52 -07:00
Enrico Ros 04c1bd8a1f AIX: Anthropic: hotfix 1 2024-07-10 22:53:23 -07:00
Enrico Ros f431ccf307 AIX: vast improvements to function declarations, function calls, function results, Anthropic requests, image uploads, system prompt extraction 2024-07-10 19:01:11 -07:00
Enrico Ros d06ad58826 Drag/drop bits 2024-07-10 15:16:30 -07:00
Enrico Ros 4d10698cfd Composer: extract the drag/drop component 2024-07-10 15:15:01 -07:00
Enrico Ros a253a5a07a Composer Drop - expand and prioritize vs. Mic 2024-07-10 14:34:26 -07:00
Enrico Ros 3ee3c312ef AIX: First image. 2024-07-10 03:53:33 -07:00
Enrico Ros 83b1e0ffba AIX: Client API first port 2024-07-10 03:30:18 -07:00
Enrico Ros cc7242dfd3 AIX: Aix Client: lightweight types 2024-07-10 02:44:18 -07:00
Enrico Ros 45f6cf29de AIX: Dispatch: port former 2024-07-10 02:43:55 -07:00
Enrico Ros 26dc01e079 AIX: Intake cleanup 2024-07-10 02:43:43 -07:00
Enrico Ros f2659c52e9 AIX: Intake: much better types 2024-07-10 01:40:43 -07:00
Enrico Ros 12d690e264 AIX: Client - Improve types 2024-07-10 00:44:48 -07:00
Enrico Ros 0e0a945686 AIX: Client - Types 2024-07-10 00:12:01 -07:00
Enrico Ros 53cdca277c Cleanups 2024-07-09 23:43:03 -07:00
Enrico Ros 0d7ca3a67e AIX: document the 3 upstream APIs at a features set level 2024-07-09 19:32:21 -07:00
Enrico Ros cab726a327 AIX: fix Gemini with JSON outputs 2024-07-09 19:31:52 -07:00
Enrico Ros 0fbdc465a7 AIX: test streaming 2024-07-09 17:57:18 -07:00
Enrico Ros fcf95457c2 AIX: OpenAI usage parsing 2024-07-09 17:54:11 -07:00
Enrico Ros 415c4e2ec3 OpenAI Wire: full migration 2024-07-09 17:45:20 -07:00
Enrico Ros 7afe4ab477 OpenAI Wire: improve function definition 2024-07-09 17:25:33 -07:00
Enrico Ros 69a58c435b OpenAI Wire: port image generation and moderations 2024-07-09 17:10:42 -07:00
Enrico Ros eecf220bfe Bits 2024-07-09 16:36:45 -07:00
Enrico Ros 10aefa2da3 AIX: undocumented OpenAI types 2024-07-09 16:36:07 -07:00
Enrico Ros ecd0734a6b AIX: new OpenAI types 2024-07-09 16:15:54 -07:00
Enrico Ros 0f6673d6fd Attachments: clean html 2024-07-09 14:15:11 -07:00
Enrico Ros 65feb3f032 Attachments: cleaner html 2024-07-09 13:51:47 -07:00
Enrico Ros 17731931e5 AIX: Ollama: try move 2024-07-09 13:32:57 -07:00
Enrico Ros 06df834435 AIX: Anthropic: try move 2024-07-09 13:25:26 -07:00
Enrico Ros c18806394b AIX: Gemini: try move 2024-07-09 13:00:21 -07:00
Enrico Ros 21ec7219c3 Gemini: update dispatch responses 2024-07-09 12:55:10 -07:00
Enrico Ros b58e0f85f9 Gemini: update dispatch request 2024-07-09 12:39:48 -07:00
Enrico Ros 110ca34e1d Chat Drawer: fix key 2024-07-09 11:23:38 -07:00
Enrico Ros 1d543169e2 AIX: further remove upstream 2024-07-09 11:21:54 -07:00
Enrico Ros 45d464cb93 Style 2024-07-09 11:13:33 -07:00
Enrico Ros f60158f0fe Chat Drawer Filtering: improved 2024-07-09 11:07:10 -07:00
Enrico Ros cf903ab6ce AIX: Restructure 2024-07-09 10:57:11 -07:00
Enrico Ros 6b11291284 AIX: Rename router 2024-07-09 10:07:44 -07:00
Enrico Ros dd3993ec4f AIX: Remove Testing code 2024-07-09 10:07:34 -07:00
Enrico Ros faaf31e426 Filter for Attachments 2024-07-09 09:29:22 -07:00
Enrico Ros 30ad8f107d MP: improve sentinels 2024-07-09 09:27:54 -07:00
Enrico Ros 2922b4c1dc Style 2024-07-09 08:58:46 -07:00
Enrico Ros 958ac6b3b9 Doc Fragments Editor: title 2024-07-09 08:42:39 -07:00
Enrico Ros 548f7e47c5 Fix mime resolution from extension 2024-07-09 08:25:00 -07:00
Enrico Ros 1ebb04bae6 Support Docx. #588 2024-07-09 07:35:47 -07:00
Enrico Ros cb37f05728 Merge branch 'refs/heads/main' into feature-multipart 2024-07-09 06:50:10 -07:00
Enrico Ros 0b3b4a6417 Reverse proxy instructions. Fixes #587 2024-07-09 06:49:48 -07:00
Enrico Ros 7cf30e3a3a Merge branch 'refs/heads/main' into feature-multipart
# Conflicts:
#	src/apps/chat/AppChat.tsx
2024-07-08 17:55:30 -07:00
Enrico Ros 0bf2700687 Close #581 2024-07-08 17:39:23 -07:00
Enrico Ros c773359c0b Update env. 2024-07-08 17:19:33 -07:00
Enrico Ros b80d801acb K8S: link to docs 2024-07-08 17:15:01 -07:00
Enrico Ros 1bdd1dbcc4 Merge branch 'pichuang-k8s' 2024-07-08 17:10:21 -07:00
Enrico Ros 66637feb73 K8S: cleanup 2024-07-08 17:08:54 -07:00
Enrico Ros 22fb33b8a5 Merge branch 'k8s' of https://github.com/pichuang/big-agi into pichuang-k8s 2024-07-08 16:42:44 -07:00
Enrico Ros 8ea3eb7493 Zen mode improvements. Fixes #586 2024-07-08 16:32:36 -07:00
Enrico Ros 3addc4e2ac AIX: fix build 2024-07-07 05:02:37 -07:00
Enrico Ros 7ff7e489ab Merge branch 'refs/heads/main' into feature-multipart
# Conflicts:
#	src/apps/chat/AppChat.tsx
#	src/apps/chat/components/ChatMessageList.tsx
#	src/apps/personas/creator/Creator.tsx
2024-07-07 04:43:21 -07:00
Enrico Ros 95aa0da014 Merge branch 'fork/mapringg/mac-shortcuts' 2024-07-07 04:21:24 -07:00
Enrico Ros b12637267b Small cleanups with shortcut fixes 2024-07-07 04:20:23 -07:00
Enrico Ros 3a44f70db9 AI Persona Creator: Update the react state after 575 2024-07-07 03:55:55 -07:00
Enrico Ros 92206d9740 Merge pull request #575
[BUG] Fixes text on AI Personas Creator panel
2024-07-07 03:52:30 -07:00
Enrico Ros bddd91df2a Merge branch 'fork/mapringg/feature/deepseek-vendor' 2024-07-07 03:36:51 -07:00
Enrico Ros 144ead8cfe Deepseek: cleanups
Mostly reordered the properties in alphabetical order
and made sure that models are listed dynamically (for future changes)
2024-07-07 03:34:45 -07:00
Enrico Ros 185f8e7f44 roll tRPC w/ #5851 2024-07-07 02:52:39 -07:00
Enrico Ros 1538cd83af roll packages 2024-07-07 02:49:06 -07:00
Sorawit Kongnurat 027f7deb3a feat: implement deepseek vendor 2024-07-07 16:02:08 +07:00
Enrico Ros 4043a6098b Aix: handle abort signals on both server and client 2024-07-06 06:24:01 -07:00
Enrico Ros 92b913be98 Aix: use backend fetchers 2024-07-06 05:52:11 -07:00
Enrico Ros 8505ba6b84 Backend Fetchers: improve 2024-07-06 05:38:26 -07:00
Enrico Ros c6973f6b4e OpenRouter: remove non-free 2024-07-06 05:21:10 -07:00
Enrico Ros 94eddaff3f Backend fetchers: allow signals 2024-07-06 04:35:58 -07:00
Sorawit Kongnurat f38be4aff3 feat: replace useGlobalShortcut with useGlobalShortcuts
Ignore alt key for mac users.
2024-07-06 15:41:45 +07:00
Sorawit Kongnurat 3ea78fcf9f Merge branch 'main' into mac-shortcuts 2024-07-06 14:31:58 +07:00
Enrico Ros 78cfcc6206 AIX: improve Gemini and issue reporting 2024-07-05 18:45:23 -07:00
Enrico Ros 9c5d4a18ce Audio: Wire Chime (disabled) 2024-07-05 18:31:05 -07:00
Enrico Ros aa48b4d596 Audio: Add Generator 2024-07-05 17:11:10 -07:00
Enrico Ros 265acd9345 Audio: Add Generator 2024-07-05 16:38:41 -07:00
Enrico Ros 34ec1d5671 Audio: Port Player 2024-07-05 16:33:19 -07:00
Enrico Ros 4a1f4f0a01 Bits 2024-07-05 13:42:47 -07:00
Enrico Ros 850528820f AIX: define new low-level APIs 2024-07-05 02:55:34 -07:00
Enrico Ros 4dc8197c51 paste over 2024-07-04 16:28:04 -07:00
Enrico Ros 42e97eed4c Persona: port Throttle 2024-07-04 03:18:07 -07:00
Enrico Ros 065f30ac38 Persona: port AutoSpeak 2024-07-04 02:55:10 -07:00
Enrico Ros 9e705a12b1 Bits 2024-07-04 02:09:43 -07:00
Enrico Ros b8144f0748 AIX: flow cleanup 1 2024-07-04 01:29:56 -07:00
Enrico Ros e5b5faad3e Style2 2024-07-03 22:36:11 -07:00
Enrico Ros f840c1d424 Style 2024-07-03 20:30:36 -07:00
Enrico Ros eabd268874 AIX: client-side wire 2024-07-03 20:19:52 -07:00
Enrico Ros 06aadc543a AIX: redo all uplink parsers 2024-07-03 19:58:11 -07:00
Enrico Ros 2a410f52b5 AIX: improved all uplinks 2024-07-03 19:57:09 -07:00
Enrico Ros eb7a32ed16 AIX: redo the Upstream engine 2024-07-03 15:55:19 -07:00
Enrico Ros 14118d3056 Tokens: rationalize 2024-07-03 11:42:46 -07:00
Enrico Ros c8b3d8ad9b AIX: exception trap 2024-07-03 01:52:15 -07:00
Enrico Ros a097b32d5c AIX: types migration 2024-07-03 01:31:13 -07:00
Enrico Ros 0a88a9cee6 Cleanup Execute Mode labels 2024-07-03 00:17:36 -07:00
Enrico Ros bef1c0c5fc Extract ChatExecuteMode 2024-07-02 23:51:24 -07:00
Enrico Ros 52e6ef436f change ChatModeIds 2024-07-02 22:48:17 -07:00
Enrico Ros ad0617de90 roll PDFjs 2024-07-02 21:40:09 -07:00
Enrico Ros 1753c1a40a AutoSuggestions: controllable LLM 2024-07-02 21:37:49 -07:00
Enrico Ros 13b7004959 roll packages 2024-07-02 21:33:25 -07:00
Enrico Ros 3b9a21bbf7 AIX: remove tRPC router: not ready - will hand-roll it 2024-07-02 21:32:02 -07:00
Enrico Ros 5f0beb9d00 AIX: move stream debug 2024-07-02 00:38:03 -07:00
Enrico Ros 8411a73589 AIX: test router and client 2024-07-01 23:29:24 -07:00
Enrico Ros 009a3751c0 AIX: update fc schema 2024-07-01 23:28:52 -07:00
Enrico Ros adef88e358 roll packages 2024-07-01 22:44:14 -07:00
Enrico Ros f8b9df7bf0 AIX: function calling types 2024-07-01 21:58:18 -07:00
Enrico Ros c6fa3e1d24 Export: update backup file name 2024-07-01 21:26:31 -07:00
Enrico Ros ae24dd1e28 Bits 2024-07-01 21:26:31 -07:00
Enrico Ros 1efca7dd48 Ollama: update models 2024-06-28 02:32:35 -07:00
Jason Baker 3178f4e7e9 Fixes text on AI Personas Creator panel 2024-06-28 00:12:20 -07:00
Enrico Ros e00f61dcd0 MP: bits 2024-06-25 12:18:02 -07:00
Enrico Ros 6a5774aae7 MP: bifurcate persona generation 2024-06-25 03:27:38 -07:00
Enrico Ros 5119061861 MP: improve history editing 2024-06-25 03:11:52 -07:00
Enrico Ros fdfbae334a MP: re-enable reply to... 2024-06-25 03:03:59 -07:00
Enrico Ros e3fce43e62 Merge pull request #572 from JeremiLorenti/patch-1
Update DallESettings.tsx
2024-06-25 02:15:25 -07:00
Enrico Ros 9251f8ff0e MP: re-enable auto-draw... 2024-06-25 01:49:16 -07:00
Enrico Ros 18ef40f6f4 MP: bifurcate generate-text 2024-06-25 01:42:32 -07:00
Enrico Ros 46887d1d9f MP: reuse more fragment functions 2024-06-25 01:28:57 -07:00
Enrico Ros 632d10e9e3 MP: fix the execution pipeline 2024-06-25 01:08:56 -07:00
Enrico Ros 9fa33eea73 MP: fix editing 2024-06-24 22:29:21 -07:00
Enrico Ros 2c4c13bc2c MP: fix 'ph' reducing and token counting 2024-06-24 22:16:03 -07:00
Enrico Ros 33f8a4eb3a Message pricing: show min, and max on hover 2024-06-24 22:15:29 -07:00
Jeremi Lorenti aa7959a970 Update DallESettings.tsx
Changed the label for the "Hyper-Real" setting from "Relistic" to "Realistic" to correct the spelling mistake and improve clarity in the UI.
2024-06-25 01:12:42 -04:00
Enrico Ros 7471bc0bb2 roll packages 2024-06-24 21:41:22 -07:00
Enrico Ros b257f75e53 Screen Capture: enable for everyone 2024-06-24 20:25:13 -07:00
Enrico Ros 455e279216 MP: enter Docs 2024-06-24 20:19:43 -07:00
Enrico Ros 7fd359852a Browse: get page title too 2024-06-24 18:44:34 -07:00
Enrico Ros 82ecfdbd37 DMessage: remove Sender 2024-06-24 17:41:50 -07:00
Enrico Ros 478452983f MP: port to Embeds 2024-06-24 17:19:13 -07:00
Enrico Ros 5c1a7d485f Merge pull request #570 from blakkd/patch-1
Correct LocalAI URL
2024-06-24 04:39:56 -07:00
Enrico Ros 39c4ce9240 bits 2024-06-24 03:16:58 -07:00
Enrico Ros da49585df5 MP: improve Ego-Fragments 2024-06-24 01:34:54 -07:00
Enrico Ros 0b9bee02fe MP: begin converting Attachments 2024-06-23 21:33:40 -07:00
Enrico Ros 00e5d1ae27 MP: move towards typed parts 2024-06-23 21:16:03 -07:00
blakkd b290d63926 Correct LocalAI URL 2024-06-24 06:10:30 +02:00
Enrico Ros 1b5438cc6c MP: renames 2024-06-23 20:44:48 -07:00
Enrico Ros 17323facce Blocks: cleanups 2024-06-23 20:24:27 -07:00
Enrico Ros bc9dedeea4 MP: cleanup Content fragments 2024-06-23 20:22:05 -07:00
Enrico Ros 1b3a383b53 Blocks: rename to AutoBlocksRenderer 2024-06-23 20:09:27 -07:00
Enrico Ros 4e0a535402 Blocks: cleanups 2024-06-23 19:56:55 -07:00
Enrico Ros 0005db1b33 Blocks: extract iframe rendering 2024-06-23 19:18:28 -07:00
Enrico Ros 5cd74031be Blocks: rename 2024-06-23 19:07:24 -07:00
Enrico Ros facb85b5da Rename to an Anthropic-compatible naming (part 1) 2024-06-23 18:46:41 -07:00
Enrico Ros 5f97d17837 anthropic model naming 2024-06-23 01:10:53 -07:00
Enrico Ros af722e09f8 bits 2024-06-23 00:55:57 -07:00
Enrico Ros 959edf6010 MP: cleanups/enablers 2024-06-22 23:58:15 -07:00
Enrico Ros d08f183394 roll trpc 2024-06-22 23:25:20 -07:00
Enrico Ros da541ae182 MP: Extract Fragments to own file 2024-06-22 23:12:12 -07:00
Enrico Ros 4582c4c03d MP: Typesystem Sentinels 2024-06-22 21:52:30 -07:00
Enrico Ros 8c7d70d434 Debug 2024-06-22 18:01:59 -07:00
Enrico Ros fcf9f9e562 MP: disable images editing 2024-06-22 17:31:21 -07:00
Enrico Ros 7bb0fb294a MP: full document editing 2024-06-22 17:01:50 -07:00
Enrico Ros 2e7b5ba5f0 Fix enter is newline on editing 2024-06-22 16:41:08 -07:00
Enrico Ros 6b017f3678 style 2024-06-22 16:34:41 -07:00
Enrico Ros a303d00900 style 2024-06-22 16:34:26 -07:00
Enrico Ros aaa351dca4 Revert "code block detection: assume the ``` has a newline before the end of block"
Because the Diagrams stopped working in the modal.

This reverts commit ee5fb5361c.
2024-06-22 16:25:17 -07:00
Enrico Ros ee5fb5361c code block detection: assume the ``` has a newline before the end of block 2024-06-22 16:18:37 -07:00
Enrico Ros aaffcdbfeb Style 2024-06-22 16:13:09 -07:00
Enrico Ros a8fefb5a90 Document Editor: inline editing 2024-06-22 16:05:54 -07:00
Enrico Ros 8e3b07fa49 Document Fragment Button: variable height 2024-06-22 15:57:35 -07:00
Enrico Ros 36ac618e88 bits 2024-06-22 15:56:24 -07:00
Enrico Ros ab0eeae1e3 BlocksRenderer: plain code rendering mode 2024-06-22 15:55:32 -07:00
Enrico Ros f74adffa12 MP: Fix overall layout 2024-06-22 15:08:52 -07:00
Enrico Ros 8f23f41e2f bits 2024-06-22 13:20:05 -07:00
Enrico Ros 7d04844c6a DocumentFragment: improve 2024-06-21 03:47:53 -07:00
Enrico Ros c301dcc226 TextAttachmentFragment: works 2024-06-21 03:13:30 -07:00
Enrico Ros 8dd4ece730 PartImageRefDBlob: extract 2024-06-21 02:49:27 -07:00
Enrico Ros 75bd68f9fe PartImageRef: improve bifurcation 2024-06-21 02:18:58 -07:00
Enrico Ros 96af022afa BlocksRenderer: remove isBottom 2024-06-21 02:18:58 -07:00
Enrico Ros c570c68f1b TextAttachments: begin 2024-06-21 02:18:58 -07:00
Enrico Ros 21a226a486 Restore the Bubble menu 2024-06-21 00:06:01 -07:00
Enrico Ros 2695cb8e46 MP: align items correctly 2024-06-21 00:06:01 -07:00
Enrico Ros 2207405ebc MP: improve text part addition 2024-06-20 23:34:42 -07:00
Enrico Ros 3802123147 Double-click to edit: on again (differentiator) 2024-06-20 20:24:05 -07:00
Enrico Ros c6c630f5c6 Auto-UI: add one more message 2024-06-20 20:22:11 -07:00
Enrico Ros 7c76a17c08 RenderCode: borderless 2024-06-20 20:08:43 -07:00
Enrico Ros 5ba7723fa0 shift to delete without confirmation 2024-06-20 19:12:35 -07:00
Enrico Ros 87ff07c850 Debug: print DMessage 2024-06-20 19:05:34 -07:00
Enrico Ros 71e1a2eeec MP: render Image Attachments 2024-06-20 18:48:32 -07:00
Enrico Ros 88fba0f53a MP: cluster fragments 2024-06-20 17:40:54 -07:00
Enrico Ros 07260a8e06 ChatMessage: pass mobile 2024-06-20 17:37:26 -07:00
Enrico Ros c1d155b569 ImageRender(DataRef): Change buttons order 2024-06-20 17:36:10 -07:00
Enrico Ros 7e7cfe1db1 ContentPartImage: introduce a lighter variant 2024-06-20 17:35:27 -07:00
Enrico Ros d27a44ab7f TS 5.5.2 fixes 2024-06-20 14:55:02 -07:00
Enrico Ros 2adcca1cda roll packages 2024-06-20 14:43:43 -07:00
Enrico Ros cf854b7262 Merge branch 'refs/heads/main' into feature-multipart 2024-06-20 12:43:06 -07:00
Enrico Ros ecb0e07312 Merge branch 'refs/heads/main-stable' 2024-06-20 12:42:51 -07:00
Enrico Ros 8b2b88c7cb Merge branch 'refs/heads/main' into feature-multipart 2024-06-20 12:28:53 -07:00
Enrico Ros 9af1a6a16b Merge branch 'refs/heads/main-stable' 2024-06-20 12:28:36 -07:00
Enrico Ros d1ac9adc7e executor: bits 2024-06-20 11:41:31 -07:00
Enrico Ros 513edf90f7 executor: begin cleanups 2024-06-19 19:48:48 -07:00
Enrico Ros 60d47510ab Auto-UI: further improve 2024-06-19 19:33:31 -07:00
Enrico Ros 5b7b9837f0 Chats: group by conversation size 2024-06-19 19:27:29 -07:00
Enrico Ros 333c3327c4 Text areas: deprecate enterIsNewline on text edits that have buttons 2024-06-19 18:59:55 -07:00
Enrico Ros 9723c98940 Auto-suggestions: cleanups 2024-06-19 18:47:38 -07:00
Enrico Ros 97604f3c5b Auto-UI: update 2024-06-19 18:40:30 -07:00
Enrico Ros 044f18da46 bits 2024-06-19 18:08:44 -07:00
Enrico Ros 53946b9523 Llms: begin cleaning up 2024-06-19 18:07:16 -07:00
Enrico Ros fd8f88c5e4 Chat: reorg 2024-06-19 13:29:01 -07:00
Enrico Ros e7d15ce2b0 bits 2024-06-19 12:55:02 -07:00
Enrico Ros ff1d98a87e MP: Improve ownership, restore GC 2024-06-19 11:58:09 -07:00
Enrico Ros accc68cd28 Attachments: cleanup of ownership 2024-06-19 11:57:45 -07:00
Enrico Ros b2c7bc980f DBlobs: type Context and Scope 2024-06-19 11:51:49 -07:00
Enrico Ros 75fbe8d5d8 PDFUtils: skip load in dev 2024-06-19 11:34:18 -07:00
Enrico Ros 13ebf3b3aa Composer: cleanups 2024-06-19 11:13:44 -07:00
Enrico Ros 916d3812db MP: Update follow-up prompts 2024-06-19 09:44:04 -07:00
Enrico Ros 90610c819b MP: AppChat: send logic 2024-06-19 09:22:23 -07:00
Enrico Ros a5f6f62559 Hide the block title when rendering html. 2024-06-19 08:49:16 -07:00
Enrico Ros bfb3501dec MP: Composer: go out in multipart 2024-06-18 16:30:26 -07:00
Enrico Ros c0513c50b1 MP: Attach: cleanups 2024-06-18 15:54:16 -07:00
Enrico Ros bcf4baf004 MP: Attach: rationalize 2024-06-18 15:35:20 -07:00
Enrico Ros 53bf948a04 ChatMessage: extract avatars 2024-06-18 14:47:13 -07:00
Enrico Ros 2186d91f89 MP: ChatMessage: Attachments begin 2024-06-18 14:47:13 -07:00
Enrico Ros aaf856a503 MP: ChatMessage: extract Fragments list 2024-06-18 14:19:57 -07:00
Enrico Ros 8af625b7dc Code: fix render lines suppression 2024-06-18 14:03:30 -07:00
Enrico Ros 4690891757 Code: render lines 2024-06-18 12:57:24 -07:00
Enrico Ros bb3e17c0fa Cleanups 2024-06-18 11:31:49 -07:00
Enrico Ros 7965df5ff2 Text Parts Editor: buttons to edit 2024-06-18 03:55:34 -07:00
Enrico Ros 5b5f0a5a8d Text Parts Editor: style 2024-06-18 02:56:32 -07:00
Enrico Ros fdb087a39b Text Parts Editor: works! 2024-06-18 02:43:34 -07:00
Enrico Ros 97749378d6 Text Parts Editor: begin 2024-06-18 02:43:26 -07:00
Enrico Ros 63dc2301ff Bits 2024-06-18 01:13:00 -07:00
Enrico Ros 5659c0bc70 Auto-UI: Remove bloat 2024-06-18 00:11:32 -07:00
Enrico Ros 1e288ab0fd Auto-UI: Update prompts 2024-06-17 21:37:04 -07:00
Enrico Ros 4f058a0174 RenderHTML: use a simple CSS reset and coalesce timers 2024-06-17 21:06:52 -07:00
Enrico Ros 7284114565 Code render: improve fallback while loading 2024-06-17 20:13:07 -07:00
Enrico Ros 0b2592dbd7 tRPC: un-batch for now 2024-06-17 19:53:38 -07:00
Enrico Ros edfaf6f002 Cleaner errors 2024-06-17 19:49:20 -07:00
Enrico Ros da3990b614 Save toolbar space 2024-06-17 19:49:16 -07:00
Enrico Ros 25740ae13c MP: Image parts support deletion 2024-06-17 19:48:37 -07:00
Enrico Ros fb4c05f698 Bits 2024-06-17 18:48:22 -07:00
Enrico Ros a0c4e37c94 MP: Remove duplicate Placeholdering 2024-06-17 18:23:17 -07:00
Enrico Ros 278caf6f0c MP: Rename PH 2024-06-17 16:33:43 -07:00
Enrico Ros 2ce0c61f83 MP: Add Placeholder and Error parts 2024-06-17 16:23:10 -07:00
Enrico Ros afb25324a7 DMessage: logic to index by fragmentIds 2024-06-17 11:23:47 -07:00
Enrico Ros ba1b761c08 DMessage: add fragment Id (not unique) and a type sentinel 2024-06-17 09:04:56 -07:00
Enrico Ros 0e2d4af617 tRPC-11: workaround a transformation bug in SuperJSON/tRPC/NextJS
May be related to:
- https://github.com/blitz-js/superjson/issues/242
- https://github.com/blitz-js/superjson/issues/283
2024-06-17 00:36:08 -07:00
Enrico Ros 1b0b54a072 tRPC-11: Loading states with React-Query 2024-06-17 00:12:47 -07:00
Enrico Ros 9c629d3c5c tRPC-11: Server 2024-06-17 00:12:47 -07:00
Enrico Ros 173af4e459 Bits 2024-06-17 00:12:47 -07:00
Enrico Ros c0f12c0a5d tRPC-11: Client 2024-06-17 00:12:47 -07:00
Enrico Ros 390605fe66 Roll packages 2024-06-16 17:42:26 -07:00
Enrico Ros e4bd5f865c Migrate to scoped nanoid() 2024-06-16 17:33:46 -07:00
Enrico Ros b31c891772 Fix compile 2024-06-16 17:26:32 -07:00
Enrico Ros 08e4016972 Auto-ui: include prompt auto-mix-in 2024-06-15 17:38:37 -07:00
Enrico Ros aea7eb6ba3 Auto-ui: improve rendering and integration 2024-06-15 17:24:10 -07:00
Enrico Ros 5496750085 Auto-ui: better execution security 2024-06-15 17:23:54 -07:00
Enrico Ros 4b9709898c Auto-ui: improve settings 2024-06-15 16:49:35 -07:00
Enrico Ros 705daac737 RenderHTML: do not scroll the parent frame when keys are pressed within 2024-06-15 02:51:09 -07:00
Enrico Ros a802b32f47 Auto-HTML UI: auto-render
Added DANGER disclaimers in the code and UI. Just a testing mode for fun.
2024-06-15 01:09:32 -07:00
Enrico Ros 8b8db5e447 Auto-HTML UI test 2024-06-15 00:15:58 -07:00
Enrico Ros 3ee44599c7 MP: Auto-diagrams (chat) fix. 2024-06-14 23:52:20 -07:00
Enrico Ros 2955a41ed5 Attachments: lower the image quality a tad (very large files) 2024-06-14 22:46:23 -07:00
Enrico Ros a52802c882 Attachments: when resizing (openai-*), force format conversion 2024-06-14 22:46:10 -07:00
Enrico Ros b46c70512a Beam: fix #552 2024-06-14 18:29:12 -07:00
Enrico Ros 18f91e2eeb Beam: flatter design 2024-06-14 17:53:52 -07:00
Enrico Ros 9296984569 Layout: preserve state on resizes 2024-06-14 15:24:14 -07:00
Enrico Ros 7b835d9855 Draw: use the queue 2024-06-14 08:52:40 -07:00
Enrico Ros ce23b9169b Misc 2024-06-14 01:16:45 -07:00
Enrico Ros 47a535d309 Chat: show has drawings icon 2024-06-13 23:17:53 -07:00
Enrico Ros 6342801aa0 Bits 2024-06-13 22:55:46 -07:00
Enrico Ros 50c00f5516 Bootup to the right drawer opening state 2024-06-13 22:53:15 -07:00
Enrico Ros 4a49678fb6 T2I: rename providerId 2024-06-13 22:34:54 -07:00
Enrico Ros 0f10b8f677 MP: filter chats for images 2024-06-13 22:21:45 -07:00
Enrico Ros d8433b79cc MP: regenerate in place 2024-06-13 21:40:49 -07:00
Enrico Ros f94f640212 MP: share common draw/store logic 2024-06-13 18:19:02 -07:00
Enrico Ros 5cf779757f MP: improve fetch logic? 2024-06-13 17:40:19 -07:00
Enrico Ros d49acf379e DBlobs: show usage if storage persistence fails 2024-06-13 16:36:06 -07:00
Enrico Ros b9bff4abc0 DBlobs: try to persist with the browser 2024-06-13 16:24:06 -07:00
Enrico Ros 6fc4dbe9d1 CSS fix 2024-06-13 16:09:31 -07:00
Enrico Ros cca8132a2c DBlobs: rationalize image usage and GC 2024-06-13 16:02:21 -07:00
Enrico Ros 91654ca219 Chat: option to regenerate images in-place 2024-06-13 03:57:48 -07:00
Enrico Ros 547d7eca59 Draw: gallery empty state 2024-06-13 03:13:41 -07:00
Enrico Ros b86bf31baa DBlob: fixup post-rename 2024-06-13 02:54:43 -07:00
Enrico Ros 5b5b4efe42 Chat symbol: render support 2024-06-13 02:47:21 -07:00
Enrico Ros e9fb65edba DBlobs: refactor DBlobAssetId 2024-06-13 02:42:43 -07:00
Enrico Ros cc1cba9aa8 DBlobs: refactor 2024-06-13 02:06:10 -07:00
Enrico Ros a765c566c8 DBlobs: simplify 2024-06-13 01:19:13 -07:00
Enrico Ros 63e9022b84 add Nanoid 2024-06-13 00:29:16 -07:00
Enrico Ros 368a995e7f DBlobs: rename the table 2024-06-13 00:29:16 -07:00
Enrico Ros c844c66b5a DBlobs: survive hot reloads 2024-06-12 23:27:24 -07:00
Enrico Ros 73b18313e9 Draw: layout 2024-06-12 23:09:48 -07:00
Enrico Ros bdd68dc6c9 DBlobs: sanity fix 2024-06-12 23:08:08 -07:00
Enrico Ros 3901b94382 Draw: add rounded 2024-06-12 22:11:06 -07:00
Enrico Ros 82ac276338 Draw: fix layout 2024-06-12 22:07:16 -07:00
Enrico Ros 02c9f3ebdb Draw: bare bones enhancer 2024-06-12 15:52:10 -07:00
Enrico Ros 364ad63877 Draw: Merge T2I back into DrawCreate 2024-06-12 02:43:44 -07:00
Enrico Ros 5fc4196d01 Draw: fix fallbacks 2024-06-12 02:24:56 -07:00
Enrico Ros 3a1e10bd21 Fix wrapping of radios 2024-06-12 02:10:59 -07:00
Enrico Ros 73519ec562 Draw: configure provider opens up top 2024-06-12 01:15:33 -07:00
Enrico Ros bf9c9916b1 Draw: improve prompt composer 2024-06-12 01:15:04 -07:00
Enrico Ros 01d017c6cd Draw: dynamic header 2024-06-12 00:37:44 -07:00
Enrico Ros ca98ab02d8 Draw: improve numbers 2024-06-12 00:37:36 -07:00
Enrico Ros 347804a02e Draw: fix dom 2024-06-11 23:43:47 -07:00
Enrico Ros 4c80f8dbf4 Draw: improve 2024-06-11 23:41:16 -07:00
Enrico Ros 73ee96040f Draw: heading 2024-06-11 22:09:04 -07:00
Enrico Ros 6180da1333 MP: cleanups 2024-06-11 19:53:44 -07:00
Enrico Ros 2756ff6ad0 MP: fix 2024-06-11 19:50:03 -07:00
Enrico Ros e57491b812 MP: DBlob GC on message/chat deletion 2024-06-11 19:50:00 -07:00
Enrico Ros 9d8ae538d9 Draw: thumbnail in gallery 2024-06-11 19:41:12 -07:00
Enrico Ros dd7defd2c7 DBlobs: auto-gen image thumbnail 2024-06-11 19:41:04 -07:00
Enrico Ros e79ec45b5b Draw: bare bones gallery 2024-06-11 19:13:48 -07:00
Enrico Ros 1a138bbc16 DesktopDrawer: do not get in the way when closed 2024-06-11 19:11:09 -07:00
Enrico Ros b067165471 Draw: cleans 2024-06-11 18:31:37 -07:00
Enrico Ros 6fbcbb9399 Draw: renames 2024-06-11 15:11:22 -07:00
Enrico Ros aaf77b4e20 Draw: renames 2024-06-11 15:06:18 -07:00
Enrico Ros f5cc2e952b Draw: sections 2024-06-11 14:50:02 -07:00
Enrico Ros eeab362567 cleanups 2024-06-11 14:45:49 -07:00
Enrico Ros 834205c426 DBlobs: renames 2024-06-11 14:13:17 -07:00
Enrico Ros fbad8ca62e DBlobs: gc on chat images 2024-06-11 13:48:21 -07:00
Enrico Ros 1e4c6f13c5 MP: show images 2024-06-11 12:56:12 -07:00
Enrico Ros b7c2b3d4cb RenderImageURL: improve greatly 2024-06-11 12:53:55 -07:00
Enrico Ros 0d5b7d36f1 Message Fragments: update v-layout 2024-06-11 12:10:47 -07:00
Enrico Ros 059886fede Mobile menu: shrink a bit 2024-06-11 12:08:22 -07:00
Enrico Ros db7dd0ca43 DBlobs: 'ot' for the origin type 2024-06-11 12:07:53 -07:00
Enrico Ros f4c611b47d DBlobs: reactive live hooks 2024-06-11 01:51:08 -07:00
Enrico Ros 39c32646c5 Merge branch 'refs/heads/main' into feature-multipart 2024-06-10 23:57:05 -07:00
Enrico Ros 1720fffbdc Merge remote-tracking branch 'refs/remotes/opensource/main-stable' 2024-06-10 23:56:43 -07:00
Enrico Ros 6c51cd0d1d Fix Tooltip on errors 2024-06-10 23:54:59 -07:00
Enrico Ros cb9cdc508a MP: rename Content Parts 2024-06-10 23:35:53 -07:00
Enrico Ros 7d037a206f MP: enable multipart edits 2024-06-10 22:41:46 -07:00
Enrico Ros ace10ab4be MP: begin Fragment extraction and simplify BlockRenderer 2024-06-10 21:46:45 -07:00
Enrico Ros bc0a7b6ac3 Rename RenderImageURL 2024-06-10 21:45:40 -07:00
Enrico Ros e77e2045e3 MP: Message porting skel 2024-06-10 19:29:01 -07:00
Enrico Ros abbd55c740 Message: renames 2024-06-09 19:16:46 -07:00
Enrico Ros bf5e80a462 MP: adapt ego attachment, messageSingleTextOrThrow-- 2024-06-09 19:00:01 -07:00
Enrico Ros 121deaae5f bits 2024-06-09 18:01:49 -07:00
Enrico Ros 80317232ba MP: improve fragment typings 2024-06-09 17:44:25 -07:00
Enrico Ros 22f815dcd1 do not load 'pdfjs-dist' during development, to make '--turbo' work 2024-06-09 17:07:36 -07:00
Enrico Ros fb96c3ab47 Merge branch 'refs/heads/main' into feature-multipart
# Conflicts:
#	src/modules/aifn/autosuggestions/autoSuggestions.ts
#	src/modules/aifn/autotitle/autoTitle.ts
2024-06-07 14:24:03 -07:00
Enrico Ros 3b15ad51a1 Merge branch 'refs/heads/main-stable' 2024-06-07 14:23:21 -07:00
Enrico Ros 5066336c75 Merge branch 'refs/heads/main-stable' 2024-06-07 12:16:49 -07:00
Enrico Ros 0807744577 Option to see model interfaces 2024-06-07 12:09:38 -07:00
Enrico Ros 59f871d3ec Merge branch 'refs/heads/main' into feature-multipart
# Conflicts:
#	src/apps/chat/editors/chat-stream.ts
#	src/modules/beam/gather/instructions/ChatGenerateInstruction.tsx
#	src/modules/beam/scatter/beam.scatter.ts
2024-06-06 22:15:17 -07:00
Enrico Ros fed351a2fc Merge branch 'refs/heads/main-stable'
# Conflicts:
#	package-lock.json
#	package.json
#	src/common/util/token-counter.ts
2024-06-06 22:11:43 -07:00
Enrico Ros aeb129e422 roll: minor packages 2024-06-06 11:21:23 -07:00
Enrico Ros 3050b546ac Gemini: update 2024-06-06 10:13:37 -07:00
Enrico Ros 1429726ba6 Gemini: update 2024-06-06 10:10:06 -07:00
Enrico Ros 4075581acd Add Codestral - Fixes #558 2024-06-06 09:59:31 -07:00
Enrico Ros 56774fd974 roll: mermaid 10.9.1 from CDN 2024-06-06 09:36:08 -07:00
Enrico Ros 5e674d2299 Dynamic won't be required from Next 15 2024-06-04 20:49:05 -07:00
Enrico Ros 06f5b6d6ff Silence warnings by declaring asyncFunction available on the browsers side 2024-06-04 20:44:01 -07:00
Enrico Ros b25b4e6c8f roll: next 14.2 2024-06-04 20:05:06 -07:00
Enrico Ros 645e07dba8 roll: pdfjs-dist 2024-06-04 20:04:51 -07:00
Enrico Ros 46181fcaa2 roll: misc 2024-06-04 19:32:08 -07:00
Enrico Ros 8d7ae425f9 roll: cloudflare/puppeteer 2024-06-04 18:34:56 -07:00
Enrico Ros 7d572334a1 roll: misc 2024-06-04 18:19:38 -07:00
Enrico Ros 5dab6f68e6 roll: mui 2024-06-04 18:18:04 -07:00
Enrico Ros d1c595d8db Text 2024-06-04 07:09:56 -07:00
Enrico Ros eaa2635b51 T2I: port TextToImage (partial) 2024-06-03 13:55:11 -07:00
Enrico Ros dc2d226ddb T2I: port image-generate 2024-06-03 13:41:57 -07:00
Enrico Ros 336a4e1f35 T2I: separate data/mime 2024-06-03 13:40:45 -07:00
Enrico Ros 4d3b6b4f43 MP: cleaner contentFragments additions 2024-06-03 12:57:59 -07:00
Enrico Ros a12601b49c Merge remote-tracking branch 'feature-t2i-b64' into feature-multipart
# Conflicts:
#	src/apps/chat/editors/image-generate.ts
2024-06-03 12:05:48 -07:00
Enrico Ros 15a895064e ChatMessage: bits 2024-06-03 12:02:35 -07:00
Enrico Ros 8bd1507ace ChatMessage: Fix Avatar on Mobile 2024-06-03 11:42:46 -07:00
Enrico Ros 89d7ec5d0b ChatMessage: disable diffing 2024-06-03 10:16:55 -07:00
Enrico Ros 670e57735a MP: relax singleTextOrThrow 2024-06-03 10:10:54 -07:00
Enrico Ros fa703c25e8 Attachments: disable GC drafts for now 2024-06-03 09:34:57 -07:00
Enrico Ros f58161b1d1 Attachments: GC drafts 2024-06-03 09:33:53 -07:00
Enrico Ros 8db2a37a59 Attachments: remove DBlobs when setting outputFragments, until GC comes 2024-06-03 09:21:58 -07:00
Enrico Ros bfdb9c2624 Attachments: remove race condition on conversion 2024-06-03 09:15:11 -07:00
Enrico Ros 240e984737 DBlob: types 2024-06-03 09:05:46 -07:00
Enrico Ros fe128c18b1 MP: improve dmessage part/reference functions and cloning 2024-06-03 08:48:42 -07:00
Enrico Ros b208d8c40d MP: fix streaming text 2024-05-26 02:55:55 -07:00
Enrico Ros 556641e1f4 MP: fix V3 chats porting 2024-05-26 02:47:11 -07:00
Enrico Ros 464eb671db MP: upgrade V3 to V4 (store, links, jsons) 2024-05-25 21:13:45 -07:00
Enrico Ros 12b8f1e3ef MP: refine DMessage/DMessageFragment
Once again, large change.
2024-05-25 20:17:43 -07:00
Enrico Ros ab199afe0d Beam: reminder the save/restore on a per-message basis, #483 2024-05-25 15:53:56 -07:00
Enrico Ros fe1a498da0 Beam: also enable method selection on AutoStart 2024-05-25 15:51:37 -07:00
Enrico Ros 4f9d55eb42 Attachments: +Plain Mime 2024-05-25 03:49:21 -07:00
Enrico Ros 70f450f547 Attachments: restored take and copy 2024-05-25 02:56:17 -07:00
Enrico Ros 28fc7deefc MP: rename to contentRef 2024-05-25 00:40:39 -07:00
Enrico Ros 428babf856 Tokens: estimate images tokens 2024-05-25 00:28:15 -07:00
Enrico Ros b824ddf2e3 Attachments: uniform remove 2024-05-24 22:33:33 -07:00
Enrico Ros 2396966740 Tokens: rename the text methods 2024-05-24 22:25:14 -07:00
Enrico Ros 23ca49128a Attachments: consolidation 2024-05-24 19:35:26 -07:00
Enrico Ros ec6bdede20 Attachments: improvements 2024-05-24 18:06:45 -07:00
Enrico Ros 4ada2013d2 Attachments: correct rescaling 2024-05-24 17:31:36 -07:00
Enrico Ros 79afef6bc1 Attachments: more rescaling pains 2024-05-24 16:52:49 -07:00
Enrico Ros e7000df89f Attachments: no upsizing of small images 2024-05-24 16:30:10 -07:00
Enrico Ros 59f77a64ea Attachments: open images from the menu in new tabs 2024-05-24 16:13:29 -07:00
Enrico Ros 8be152666e Attachments: improve conversions/quality 2024-05-24 15:14:50 -07:00
Enrico Ros 10488854ce Attachments: low/high detail modes 2024-05-24 03:44:59 -07:00
Enrico Ros 6586aafed8 Attachments: resize modes for OpenAI, Google, Anthropic 2024-05-24 03:32:25 -07:00
Enrico Ros 4568a60be3 Attachments: image resize 2024-05-24 03:18:12 -07:00
Enrico Ros 193bc8bb8e Attachments: fix multi-image pdf 2024-05-24 02:20:53 -07:00
Enrico Ros ce381b7690 Attachments: rename main to AttachmentDraft, convert to (overlayed) Store Slice 2024-05-24 01:52:25 -07:00
Enrico Ros b238428816 Chat search: sort by date by default 2024-05-24 00:27:31 -07:00
Enrico Ros 0ac37f50cf Attachments: remove old code 2024-05-23 22:29:44 -07:00
Enrico Ros 54b9389b77 MP: Attachments full port, incl. Storage 2024-05-22 02:56:23 -07:00
Enrico Ros a183c26e51 PDFUtils: improve PDF to image 2024-05-22 02:56:23 -07:00
Enrico Ros 01a03d164c ImageUtils: add dimension guessers and converters 2024-05-22 02:56:23 -07:00
Enrico Ros cdff1fde2d TextUtils: update to new uuid 2024-05-22 02:56:23 -07:00
Enrico Ros c38b9998a6 TextUtils: add uuidv4 base64 2024-05-22 02:56:23 -07:00
Enrico Ros 77c1a335ad MP: data at rest cleanup 2024-05-22 02:56:23 -07:00
Enrico Ros 07a0fe6249 MP: text separation 2024-05-22 02:56:23 -07:00
Enrico Ros 204bc46976 MP: append parts to messages 2024-05-22 02:56:23 -07:00
Enrico Ros b910506519 MP: cleanup MP Beam 2024-05-22 02:56:23 -07:00
Enrico Ros 3cef39da17 MP: fix Beam, Rays and Fusions 2024-05-22 02:56:23 -07:00
Enrico Ros 3aea29bcb5 MP: remove typing, support placeholder, improve streaming of updates 2024-05-22 02:56:23 -07:00
Enrico Ros dd0d19168b MP: cleanup conversions 2024-05-22 02:56:22 -07:00
Enrico Ros 6727fcd111 MP: cleanup conversions 2024-05-22 02:56:22 -07:00
Enrico Ros 9d347f4a5a Multi-Part refactor
Partial still. Does not build.
2024-05-22 02:56:22 -07:00
Enrico Ros 084e48ddc2 Desktop Nav: improve menu 2024-05-22 02:55:04 -07:00
Enrico Ros 31e89ce9a1 App: Tokenizer 2024-05-22 02:54:56 -07:00
Enrico Ros baad3ae1c3 Fix Domino issue (crash) by upgrading Turndown to 7.2.0
See:
https://github.com/mixmark-io/turndown/issues/439
https://github.com/fgnass/domino/issues/146
2024-05-21 23:50:32 -07:00
Enrico Ros 7c099cab94 Fix TimeoutError issue 2024-05-18 03:07:04 -07:00
Enrico Ros 811875dd2e idb-keyval: bits 2024-05-16 18:04:27 -07:00
Enrico Ros 127443d550 idb-keyval: crud console fn 2024-05-16 18:03:20 -07:00
Enrico Ros d2064605bf Bits 2024-05-16 04:14:41 -07:00
Enrico Ros 4c6fb61ca8 Draw: enable nav 2024-05-16 04:11:04 -07:00
Enrico Ros 608ba8bcb4 T2I: Adapt callers (fixme) 2024-05-16 04:11:04 -07:00
Enrico Ros b53c054dee T2I: Enrich Generated Output 2024-05-16 04:11:04 -07:00
Enrico Ros 05aa4b547f Mistral: update pricing 2024-05-16 04:02:04 -07:00
Enrico Ros 6afb61d25d Mistral: update
#518
2024-05-16 04:02:03 -07:00
Enrico Ros a7ce5c1ca6 Already Set 2024-05-16 03:25:25 -07:00
Enrico Ros 952bd2bd93 Start opened 2024-05-16 03:03:57 -07:00
Enrico Ros f9d33d4888 Page download: improve 2024-05-16 02:57:50 -07:00
Enrico Ros 81d99f19d4 Beam: bits 2024-05-16 01:41:44 -07:00
Enrico Ros 454a4257da Beam: recall importing rays 2024-05-16 01:35:04 -07:00
Enrico Ros e513b42786 Beam: fix reactive bug 2024-05-16 01:30:37 -07:00
Enrico Ros b607e3c034 Beam: if auto-start, give the chance to change merge model 2024-05-16 01:00:21 -07:00
Enrico Ros d5c3f5012b Tiktoken: in the future, show tokens 2024-05-16 00:55:58 -07:00
Enrico Ros 21d045be59 Update TikToken for perfect token computation on 'o' models. 2024-05-16 00:53:08 -07:00
Enrico Ros a9c1c34dc9 DBlobs: subsystem for storing blobs
Uses Dexie.js fro IndexedDB access.
2024-05-15 23:44:33 -07:00
Enrico Ros 44ab0483b6 DChat: remove IDB migration 2024-05-15 23:43:31 -07:00
Enrico Ros 9eb0cc0b62 Gemini: improve support (incl. interfaces, cost, visibility) 2024-05-14 15:15:53 -07:00
Enrico Ros 2db74867f5 (bits) 2024-05-13 16:24:50 -07:00
Enrico Ros fd30baafb8 Default to the full context window 2024-05-13 16:24:30 -07:00
Enrico Ros 3623eef47f Browse: improve markdown transform 2024-05-13 15:59:46 -07:00
Enrico Ros 7b07bb7884 Browse: full support for markdown transform 2024-05-13 15:38:08 -07:00
Enrico Ros 7946cd6614 Browse: markdown transform as default 2024-05-13 14:49:29 -07:00
Enrico Ros 51b6e30986 Browse: support transform (skel) 2024-05-13 14:34:25 -07:00
Enrico Ros 002df7b0f9 Hold Shift to delete without confirmation: fixes #537 2024-05-13 14:00:43 -07:00
Sorawit Kongnurat 2ac1789312 Use ctrl and remove alt usage with certain hotkeys for mac shortcuts 2024-05-06 16:34:06 +07:00
Phil Huang a705b16493 Add support Kubernetes deployment
- Provide k8s/big-agi-deployment.yaml and env-secrert.yaml
- Add deploy-k8s.md to explain the installation process
2023-10-05 02:36:36 +08:00
696 changed files with 54771 additions and 21762 deletions
@@ -51,7 +51,7 @@ To familiarize yourself with the application, the following are the Website and
```
- paste the URL: https://big-agi.com
- drag & drop: [README.md](https://raw.githubusercontent.com/enricoros/big-AGI/main/README.md)
- drag & drop: [README.md](https://raw.githubusercontent.com/enricoros/big-AGI/v2-dev/README.md)
```markdown
I am announcing a new version, 1.2.3.
+25 -9
View File
@@ -12,8 +12,9 @@ name: Create and publish Docker images
on:
push:
branches:
- main
#- main-stable # Disabled as the v* tag is used for stable releases
- v2-dev
#- v1-dev # Disabled because this is not needed anymore
#- v1-stable # Disabled as the v* tag is used for stable releases
tags:
- 'v*' # Trigger on version tags (e.g., v1.7.0)
@@ -27,10 +28,13 @@ jobs:
permissions:
contents: read
packages: write
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -39,7 +43,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@@ -47,18 +51,23 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=development,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/main-stable' }}
type=raw,value=development,enable=${{ github.ref == 'refs/heads/v2-dev' }} # For v2-dev branch
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/v1-stable' }}
type=ref,event=tag # Use the tag name as a tag for tag builds
type=semver,pattern={{version}} # Generate semantic versioning tags for tag builds
type=sha # Just in case none of the above applies
type=sha,format=short,prefix=sha- # Just in case none of the above applies
labels: |
org.opencontainers.image.title=Big-AGI
org.opencontainers.image.description=Generative AI suite powered by state-of-the-art models
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.documentation=https://big-agi.com
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
@@ -66,4 +75,11 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: NEXT_PUBLIC_GA4_MEASUREMENT_ID=${{ secrets.GA4_MEASUREMENT_ID }}
build-args: |
NEXT_PUBLIC_GA4_MEASUREMENT_ID=${{ secrets.GA4_MEASUREMENT_ID }}
# Enable build cache (future)
#cache-from: type=gha
#cache-to: type=gha,mode=max
# Enable provenance and SBOM (future)
#provenance: true
#sbom: true
+12 -1
View File
@@ -3,6 +3,10 @@
# Frontend Build: ignore API files disabled for this build
/app/**/*.backup
# Supabase - ignored for now
/supabase/
/*.sql
# dependencies
/node_modules
/.pnp
@@ -41,4 +45,11 @@ yarn-error.log*
next-env.d.ts
# other
.idea/
.idea/
# Ingore k8s/env-secret.yaml
./k8s/env-secret.yaml
/certificates
.env*.local
/.run/dev (ENV).run.xml
/src/modules/3rdparty/aider/scratch*
+5 -3
View File
@@ -1,8 +1,7 @@
# Base
FROM node:18-alpine AS base
FROM node:22-alpine AS base
ENV NEXT_TELEMETRY_DISABLED 1
# Dependencies
FROM base AS deps
WORKDIR /app
@@ -11,6 +10,9 @@ WORKDIR /app
COPY package*.json ./
COPY src/server/prisma ./src/server/prisma
# link ssl3 for latest Alpine
RUN sh -c '[ ! -e /lib/libssl.so.3 ] && ln -s /usr/lib/libssl.so.3 /lib/libssl.so.3 || echo "Link already exists"'
# Install dependencies, including dev (release builds should use npm ci)
ENV NODE_ENV development
RUN npm ci
@@ -61,4 +63,4 @@ USER nextjs
EXPOSE 3000
# Start the application
CMD ["next", "start"]
CMD ["next", "start"]
+27 -7
View File
@@ -11,24 +11,37 @@ Stay ahead of the curve with big-AGI. 🚀 Pros & Devs love big-AGI. 🤖
[![Official Website](https://img.shields.io/badge/BIG--AGI.com-%23096bde?style=for-the-badge&logo=vercel&label=launch)](https://big-agi.com)
> 🚀 Big-AGI 2 is launching Q4 2024. Be the first to experience it before the public release.
>
> 👉 [Apply for Early Access](https://y2rjg0zillz.typeform.com/to/ZSADpr5u?utm_source=gh-2&utm_medium=readme&utm_campaign=ea2)
Or fork & run on Vercel
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fenricoros%2Fbig-AGI&env=OPENAI_API_KEY&envDescription=Backend%20API%20keys%2C%20optional%20and%20may%20be%20overridden%20by%20the%20UI.&envLink=https%3A%2F%2Fgithub.com%2Fenricoros%2Fbig-AGI%2Fblob%2Fmain%2Fdocs%2Fenvironment-variables.md&project-name=big-AGI)
## 👉 [roadmap](https://github.com/users/enricoros/projects/4/views/2) 👉 [installation](docs/installation.md) 👉 [documentation](docs/README.md)
### New Version
> Note: bigger better features (incl. Beam-2) are being cooked outside of `main`.
This repository contains two main versions:
[//]: # (big-AGI is an open book; see the **[ready-to-ship and future ideas]&#40;https://github.com/users/enricoros/projects/4/views/2&#41;** in our open roadmap)
- Big-AGI 2: next-generation, bringing the most advanced AI experience
- `v2-dev`: V2 development branch, the exciting one, future default
- Big-AGI Stable: as deployed on big-agi.com
- `v1-dev`: V1 development branch (this branch)
- `v1-stable`: Current stable version
### What's New in 1.16.1...1.16.7 · Aug 7, 2024 (patch releases)
Note: After the V2 release in Q4, `v2-dev` will become the default branch and `v1-dev` will reach EOL.
### Quick links: 👉 [roadmap](https://github.com/users/enricoros/projects/4/views/2) 👉 [installation](docs/installation.md) 👉 [documentation](docs/README.md)
### What's New in 1.16.1...1.16.8 · Sep 13, 2024 (patch releases)
- 1.16.8: OpenAI ChatGPT-4o Latest (o1-preview and o1-mini are supported in Big-AGI 2)
- 1.16.7: OpenAI support for GPT-4o 2024-08-06
- 1.16.6: Groq support for Llama 3.1 models
- 1.16.5: GPT-4o Mini support
- 1.16.4: 8192 tokens support for Claude 3.5 Sonnet
- 1.16.3: Anthropic Claude 3.5 Sonnet model support
- 1.16.2: Improve web downloads, as text, markdwon, or HTML
- 1.16.2: Improve web downloads, as text, markdown, or HTML
- 1.16.2: Proper support for Gemini models
- 1.16.2: Added the latest Mistral model
- 1.16.2: Tokenizer support for gpt-4o
@@ -147,7 +160,7 @@ You can easily configure 100s of AI models in big-AGI:
| **AI models** | _supported vendors_ |
|:--------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Opensource Servers | [LocalAI](https://localai.com) (multimodal) · [Ollama](https://ollama.com/) · [Oobabooga](https://github.com/oobabooga/text-generation-webui) |
| Opensource Servers | [LocalAI](https://localai.io/) (multimodal) · [Ollama](https://ollama.com/) |
| Local Servers | [LM Studio](https://lmstudio.ai/) |
| Multimodal services | [Azure](https://azure.microsoft.com/en-us/products/ai-services/openai-service) · [Google Gemini](https://ai.google.dev/) · [OpenAI](https://platform.openai.com/docs/overview) |
| Language services | [Anthropic](https://anthropic.com) · [Groq](https://wow.groq.com/) · [Mistral](https://mistral.ai/) · [OpenRouter](https://openrouter.ai/) · [Perplexity](https://www.perplexity.ai/) · [Together AI](https://www.together.ai/) |
@@ -219,6 +232,13 @@ Or bring your API keys and jump straight into our free instance on [big-AGI.com]
[//]: # ([![License]&#40;https://img.shields.io/github/license/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/LICENSE&#41;)
## 📜 Licensing
Big-AGI incorporates third-party software components that are subject
to separate license terms. For detailed information about these
components and their respective licenses, please refer to
the [Third-Party Notices](src/modules/3rdparty/THIRD_PARTY_NOTICES.md).
---
2023-2024 · Enrico Ros x [big-AGI](https://big-agi.com) · License: [MIT](LICENSE) · Made with 💙
2023-2024 · Enrico Ros x [Big-AGI](https://big-agi.com) · Like this project? Leave a star! 💫⭐
+24
View File
@@ -0,0 +1,24 @@
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
import { appRouterCloud } from '~/server/trpc/trpc.router-cloud';
import { createTRPCFetchContext } from '~/server/trpc/trpc.server';
const handlerNodeRoutes = (req: Request) => fetchRequestHandler({
endpoint: '/api/cloud',
router: appRouterCloud,
req,
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-cloud failed on ${path ?? 'unk-path'}: ${error.message}`)
: undefined,
});
// NOTE: the following statement breaks the build on non-pro deployments, and conditionals don't work either
// so we resorted to raising the timeout from 10s to 25s in the vercel.json file instead
// export const maxDuration = 25;
export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';
export { handlerNodeRoutes as GET, handlerNodeRoutes as POST };
+18
View File
@@ -0,0 +1,18 @@
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
import { appRouterEdge } from '~/server/trpc/trpc.router-edge';
import { createTRPCFetchContext } from '~/server/trpc/trpc.server';
const handlerEdgeRoutes = (req: Request) => fetchRequestHandler({
endpoint: '/api/edge',
router: appRouterEdge,
req,
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-edge failed on ${path ?? 'unk-path'}: ${error.message}`)
: undefined,
});
export const runtime = 'edge';
export { handlerEdgeRoutes as GET, handlerEdgeRoutes as POST };
-2
View File
@@ -1,2 +0,0 @@
export const runtime = 'edge';
export { elevenLabsHandler as POST } from '~/modules/elevenlabs/elevenlabs.server';
-2
View File
@@ -1,2 +0,0 @@
export const runtime = 'edge';
export { llmStreamingRelayHandler as POST } from '~/modules/llms/server/llm.server.streaming';
-19
View File
@@ -1,19 +0,0 @@
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
import { appRouterEdge } from '~/server/api/trpc.router-edge';
import { createTRPCFetchContext } from '~/server/api/trpc.server';
const handlerEdgeRoutes = (req: Request) =>
fetchRequestHandler({
router: appRouterEdge,
endpoint: '/api/trpc-edge',
req,
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-edge failed on ${path ?? "<no-path>"}: ${error.message}`)
: undefined,
});
export const runtime = 'edge';
export { handlerEdgeRoutes as GET, handlerEdgeRoutes as POST };
-23
View File
@@ -1,23 +0,0 @@
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
import { appRouterNode } from '~/server/api/trpc.router-node';
import { createTRPCFetchContext } from '~/server/api/trpc.server';
const handlerNodeRoutes = (req: Request) =>
fetchRequestHandler({
router: appRouterNode,
endpoint: '/api/trpc-node',
req,
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-node failed on ${path ?? '<no-path>'}: ${error.message}`)
: undefined,
});
export const runtime = 'nodejs';
// NOTE: the following statement breaks the build on non-pro deployments, and conditionals don't work either
// so we resorted to raising the timeout from 10s to 25s in the vercel.json file instead
// export const maxDuration = 25;
export const dynamic = 'force-dynamic';
export { handlerNodeRoutes as GET, handlerNodeRoutes as POST };
+70
View File
@@ -0,0 +1,70 @@
# AIX dispatch server - API features comparison
This is updated as of 2024-07-09, and includes the latest features and capabilities of the three major AI APIs: Anthropic, Gemini, and OpenAI.
The comparison covers a wide range of features, including function calling, vision, system instructions, etc.
| Feature Category | Specific Feature | Anthropic | Gemini | OpenAI |
|------------------------------------------|-------------------------------|--------------------------------------------------------------------|------------------------------------------------------------------|---------------------------------------------------------------------|
| **Message Structure** |
| | Role types | user, assistant | user, model | user, assistant, system, tool |
| | Named participants | No | No | Yes |
| | Content array | Yes | Yes | Yes |
| **Content Types and Multimodal Support** |
| | Text generation | Yes | Yes | Yes |
| | Image understanding | Yes | Yes | Yes |
| | Audio processing | No | **Yes** | No |
| | Video processing | No | **Yes** | No |
| **Image Handling** |
| | Supported formats | JPEG, PNG, GIF, WebP | JPEG, PNG, WebP, HEIC, HEIF | PNG, JPEG, WebP, non-animated GIF |
| | Max image size | 5MB per image | (20MB per prompt) | 20MB per image |
| | Image detail level | N/A | N/A | **Low, high, auto** |
| | Image resolution | max: 1568x1568 | min: 768x768, max: 3072x3072 | min: 512x512, max: 2048 x 2048 |
| | Token calculation for images | (width * height)/750; max 1,600 | 258 tokens | 85 + 170 * {patches} |
| | Image retention | Deleted after processing | Not specified | Deleted after processing |
| **Audio and Video Handling** |
| | Audio formats | N/A | WAV, MP3, AIFF, AAC, OGG, FLAC | N/A |
| | Video formats | N/A | MP4, MPEG, MOV, AVI, MPG, WebM, WMV, 3GPP | N/A |
| **System Instructions and Tool Use** |
| | System instructions | Yes (array of text blocks) | Yes (parts array) | Yes (as system message) |
| **Function/Tool Handling** |
| | Parallel tool calls | No | No | **Yes** |
| | Tool Declaration | Defined in `tools` array | Defined in `tools` array | Defined in `tools` array |
| | FC name restrictions | Yes | Yes (max 63 chars) | Yes (max 64 chars) |
| | FC declaration | name, description, input_schema | name, description, parameters | name, description, parameters |
| | FC options structure | JSON Schema for input | Object with properties | JSON Schema for parameters |
| | FC Force invocation | Via `tool_choice` parameter | Via `toolConfig` parameter | Via `tool_choice` parameter |
| | FC Model invocation | Model generates a `tool_use` block with predicted parameters | Generates a `functionCall` part with predicted parameters | Generates a message.`tool_calls` item with predicted arguments |
| | FC Execution | Client-side | Client-side | Client-side |
| | FC Result injection | Client appends a `user` message with a `tool_result` content block | Client appends a `function` message with `functionResponse` part | Client sends a new `tool` message with `tool_call_id` and `content` |
| | Built-in Code execution | No | **Yes** | No |
| | Tool use with vision | Yes | Yes | Yes |
| **Generation Configuration** |
| | temperature | Yes | Yes | Yes |
| | max_tokens | Yes | Yes | Yes |
| | stop_sequences | Yes | Yes | Yes |
| | top_k | Yes | Yes | **No** |
| | top_p | Yes | Yes | Yes |
| | seed | No | No | **Yes** |
| | Multiple candidates | No | No | Yes (with 'n' parameter, breaks streaming?) |
| **Streaming and Response Structure** |
| | Streaming support | Yes | Yes | Yes |
| | Streaming initiation | stream=true | streamGenerateContent path | stream=true |
| | Streaming event types | **Multiple specific types** | Not specified | Single delta type |
| | Response container | content (array) | candidates (array) | choices (array) |
| **Usage Metrics and Error Handling** |
| | Token counts | Yes | Yes | Yes |
| | Detailed token breakdown | input, output | prompt, cached, candidates, total | prompt, completion, total |
| | Usage in stream | No | No | **Optional** |
| | Error handling in response | Not specified | Not specified | **Yes (undocumented)** |
| | Error handling in stream | Not specified | Not specified | **Yes (undocumented)** |
| **Advanced Features** |
| | JSON mode | **Partial (via structured prompts)** | **Yes (responseMimeType)** | **Yes** |
| | Output consistency techniques | **Yes (multiple methods)** | Not specified | Not specified |
| | Logprobs | No | No | **Yes (disabled in schema)** |
| | System fingerprint | No | No | **Yes** |
| | Semantic caching | No | **Yes** | No |
| | Assistant prefill | **Yes** | No | No |
| | Preferred formatting | **XML tags, JSON** | Not specified | Markdown |
| **Safety and Compliance** |
| | Safety settings in request | **Stop sequences** | **Detailed category-based** | **Moderation API** |
| | Safety feedback in response | Yes | Yes | Not specified |
+32 -29
View File
@@ -1,59 +1,62 @@
# big-AGI Documentation
# Big-AGI Documentation
Find all the information you need to get started, configure, and effectively use big-AGI.
Information you need to get started, configure, and use big-AGI productively.
[//]: # (## Quick Start)
## Getting Started
[//]: # (- **[Introduction]&#40;big-agi.md&#41;**: Overview of big-AGI's features.)
Guides for basic big-AGI features:
## Configuration Guides
- **[Enabling Microphone for Speech Recognition](help-feature-microphone.md)**: Instructions to
allow speech recognition in browsers and apps.
Detailed guides to configure your big-AGI interface and models.
## AI Model Configuration
👉 The following applies to the users of big-AGI.com, as the public instance is empty and to be configured by the user.
Detailed guides to configure AI models and advanced features in big-AGI.
- **Cloud Model Services**:
> 👉 The following applies to users of big-AGI.com, as the public instance is empty and requires user configuration.
- **Cloud AI Services**:
- **[Azure OpenAI](config-azure-openai.md)**
- **[OpenRouter](config-openrouter.md)**
- easy API key: **Anthropic**, **Google AI**, **Groq**, **Mistral**, **OpenAI**, **Perplexity**, **TogetherAI**
- Easy API key setup: **Anthropic**, **Deepseek**, **Google AI**, **Groq**, **Mistral**, **OpenAI**, **OpenPipe**, **Perplexity**, **TogetherAI**, **xAI**
- **Local Model Servers**:
- **Local AI Integrations**:
- **[LocalAI](config-local-localai.md)**
- **[LM Studio](config-local-lmstudio.md)**
- **[Ollama](config-local-ollama.md)**
- **[Oobabooga](config-local-oobabooga.md)**
- **Advanced Feature Configuration**:
- **[Browse](config-feature-browse.md)**: Enable web page download through third-party services or your own cloud (advanced)
- **ElevenLabs API**: Voice and cutom voice generation, only requires their API key
- **Google Search API**: guide not yet available, see the Google options in '[Environment Variables](environment-variables.md)'
- **Prodia API**: Stable Diffusion XL image generation, only requires their API key, alternative to DALL·E
- **Enhanced AI Features**:
- **[Web Browsing](config-feature-browse.md)**: Enable web page download through third-party services or your own cloud (advanced)
- **Web Search**: Google Search API (see '[Environment Variables](environment-variables.md)')
- **Image Generation**: DALL·E 3 and 2, or Prodia API for Stable Diffusion XL
- **Voice Synthesis**: ElevenLabs API for voice generation
## Deployment
## Deployment & Customization
System integrators, administrators, whitelabelers: instead of using the public big-AGI instance on get.big-agi.com, you can deploy your own instance.
> 👉 The following applies to developers and experts who deploy their own big-AGI instance.
Step-by-step deployment and system configuration instructions.
For deploying a custom big-AGI instance:
- **[Installation](installation.md)**: Set up your own instance of big-AGI and related products
- build from source or use pre-built
- locally, in the public cloud, or on your own servers
- **[Installation Guide](installation.md)**: Set up your own big-AGI instance
- Source build or pre-built options
- Local, cloud, or on-premises deployment
- **Advanced Customizations**:
- **[Source code alterations guide](customizations.md)**: source code primer and alterations guidelines
- **[Basic Authentication](deploy-authentication.md)**: Optional, adds a username and password wall
- **Advanced Setup**:
- **[Source Code Customization Guide](customizations.md)**: Modify the source code
- **[Access Control](deploy-authentication.md)**: Optional, add basic user authentication
- **[Database Setup](deploy-database.md)**: Optional, enables "Chat Link Sharing"
- **[Environment Variables](environment-variables.md)**: 📌 Pre-configures models and services
- **[Reverse Proxy](deploy-reverse-proxy.md)**: Optional, enables custom domains and SSL
- **[Environment Variables](environment-variables.md)**: Pre-configures models and services
## Support and Community
## Community & Support
Join our community or get support:
Connect with the growing big-AGI community:
- Visit our [GitHub repository](https://github.com/enricoros/big-AGI) for source code and issue tracking
- Check the latest updates and features on [Changelog](changelog.md) or the in-app [News](https://get.big-agi.com/news)
- Connect with us and other users on [Discord](https://discord.gg/MkH4qj2Jp9) for discussions, help, and sharing your experiences with big-AGI
Thank you for choosing big-AGI. We're excited to see what you'll build.
Thank you for choosing big-AGI. We're excited to give you the best tools to amplify yourself.
+5 -5
View File
@@ -10,14 +10,15 @@ by release.
- milestone: [1.17.0](https://github.com/enricoros/big-agi/milestone/17)
- work in progress: [big-AGI open roadmap](https://github.com/users/enricoros/projects/4/views/2), [help here](https://github.com/users/enricoros/projects/4/views/4)
### What's New in 1.16.1...1.16.7 · Aug 7, 2024 (patch releases)
### What's New in 1.16.1...1.16.8 · Sep 13, 2024 (patch releases)
- 1.16.8: OpenAI ChatGPT-4o Latest (o1-preview and o1-mini are supported in Big-AGI 2)
- 1.16.7: OpenAI support for GPT-4o 2024-08-06
- 1.16.6: Groq support for Llama 3.1 models
- 1.16.5: GPT-4o Mini support
- 1.16.4: 8192 tokens support for Claude 3.5 Sonnet
- 1.16.3: Anthropic Claude 3.5 Sonnet model support
- 1.16.2: Improve web downloads, as text, markdwon, or HTML
- 1.16.2: Improve web downloads, as text, markdown, or HTML
- 1.16.2: Proper support for Gemini models
- 1.16.2: Added the latest Mistral model
- 1.16.2: Tokenizer support for gpt-4o
@@ -137,7 +138,7 @@ https://github.com/enricoros/big-AGI/assets/1590910/a6b8e172-0726-4b03-a5e5-10cf
- **Overheat LLMs**: Push the creativity with higher LLM temperatures. [#256](https://github.com/enricoros/big-agi/issues/256)
- **Model Options Shortcut**: Quick adjust with `Ctrl+Shift+O`
- Optimized Voice Input and Performance
- Latest Ollama and Oobabooga models
- Latest Ollama models
- For developers: **Password Protection**: HTTP Basic Auth. [Learn How](https://github.com/enricoros/big-agi/blob/main/docs/deploy-authentication.md)
### What's New in 1.6.0 - Nov 28, 2023 · Surf's Up
@@ -169,7 +170,7 @@ For Developers:
first request to get the configuration. See
https://github.com/enricoros/big-agi/blob/main/src/modules/backend/backend.router.ts.
- CloudFlare developers: please change the deployment command to
`rm app/api/trpc-node/[trpc]/route.ts && npx @cloudflare/next-on-pages@1`,
`rm app/api/cloud/[trpc]/route.ts && npx @cloudflare/next-on-pages@1`,
as we transitioned to the App router in NextJS 14. The documentation in
[docs/deploy-cloudflare.md](../docs/deploy-cloudflare.md) is updated
@@ -186,7 +187,6 @@ For Developers:
- **Camera OCR** - real-world AI - take a picture of a text, and chat with it
- **Anthropic models** support, e.g. Claude
- **Backup/Restore** - save chats, and restore them later
- **[Local model support with Oobabooga server](../docs/config-local-oobabooga)** - run your own LLMs!
- **Flatten conversations** - conversations summarizer with 4 modes
- **Fork conversations** - create a new chat, to try with different endings
- New commands: /s to add a System message, and /a for an Assistant message
+1 -1
View File
@@ -54,7 +54,7 @@ If the running LocalAI instance is configured with a [Model Gallery](https://loc
At the time of writing, LocalAI does not publish the model `context window size`.
Every model is assumed to be capable of chatting, and with a context window of 4096 tokens.
Please update the [src/modules/llms/transports/server/openai/models.data.ts](../src/modules/llms/server/openai/models.data.ts)
Please update the [src/modules/llms/transports/server/openai/models/models.data.ts](../src/modules/llms/server/openai/models/models.data.ts)
file with the mapping information between LocalAI model IDs and names/descriptions/tokens, etc.
# 🤝 Support
+2 -1
View File
@@ -81,7 +81,8 @@ Then, edit the nginx configuration file `/etc/nginx/sites-enabled/default` and a
proxy_buffering off;
proxy_cache off;
# Longer timeouts
# Longer timeouts (1hr)
keepalive_timeout 3600;
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
-61
View File
@@ -1,61 +0,0 @@
# Local LLM Integration with `text-web-ui` :llama:
Integrate local Large Language Models (LLMs) with
[oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui),
a specialized interface that includes a custom variant of the OpenAI API for a smooth integration process.
_Last updated on Dec 7, 2023_
### Components
The implementation of local LLMs involves the following components:
* **text-generation-webui**: A Python application with a Gradio web UI for operating Large Language Models.
* **Local Large Language Models "LLMs"**: Use large language models on your personal computer with consumer-grade GPUs or CPUs.
* **big-AGI**: An LLM UI that offers features such as Personas, OCR, Voice Support, Code Execution, AGI functions, and more.
## Instructions
This guide assumes that **big-AGI** is already installed on your system. Note that the text-generation-webui IP address must be accessible from the server running **big-AGI**.
### Text-web-ui Installation & Configuration:
1. Install [text-generation-webui](https://github.com/oobabooga/text-generation-webui#Installation):
- Follow the instructions in the official page (basicall clone the repo and run a script) [~10 minutes]
- Stop the Web UI as we need to modify the startup flags to enable the OpenAI API
2. Enable the **openai extension**
- Edit `CMD_FLAGS.txt`
- Make sure that `--listen --api` is present and uncommented
3. Restart text-generation-webui
- Double-click on "start"
- You should see something like:
```
2023-12-07 21:51:21 INFO:Loading the extension "openai"...
2023-12-07 21:51:21 INFO:OpenAI-compatible API URL:
http://0.0.0.0:5000
...
INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
Running on local URL: http://0.0.0.0:7860
```
- This shows that:
- The Web UI is running on port 7860: http://127.0.0.1:7860
- **The OpenAI API is running on port 5000: http://127.0.0.1:5000**
4. Load your first model
- Open the text-generation-webui at [127.0.0.1:7860](http://127.0.0.1:7860/)
- Switch to the **Model** tab
- Download, for instance, `TheBloke/Llama-2-7B-Chat-GPTQ`
- Select the model once it's loaded
### Integrating text-web-ui with big-AGI:
1. Integrating Text-Generation-WebUI with big-AGI:
- Go to Models > Add a model source of type: **Oobabooga**
- Enter the address: `http://127.0.0.1:5000`
- If running remotely, replace 127.0.0.1 with the IP of the machine. Make sure to use the **IP:Port** format
- Load the models
- The active model must be selected and LOADED on the text-generation-webui as it doesn't support model switching or parallel requests.
- Select model & Chat
![config-oobabooga-0.png](pixels/config-oobabooga-0.png)
Enjoy the privacy and flexibility of local LLMs with `big-AGI` and `text-generation-webui`!
+1
View File
@@ -61,6 +61,7 @@ Test your application thoroughly using local development (refer to README.md for
- [deploy-cloudflare.md](deploy-cloudflare.md): for Cloudflare Workers deployment
- [deploy-docker.md](deploy-docker.md): for Docker deployment instructions and examples
- [deploy-k8s.md](deploy-k8s.md): for Kubernetes deployment instructions and examples
## Debugging
+1 -1
View File
@@ -19,7 +19,7 @@ To enable it in `big-AGI`, you **must manually build the application**:
- Build `big-AGI` with HTTP authentication enabled:
- Clone the repository
- Rename `middleware_BASIC_AUTH.ts` to `middleware.ts`
- Build: usual simple build procedure (e.g. [Deploy manually](../README.md#-deploy-manually) or [Deploying with Docker](deploy-docker.md))
- Build: usual simple build procedure (e.g. [Deploy manually](installation.md#Local-Production-build) or [Deploying with Docker](deploy-docker.md))
- Configure the following [environment variables](environment-variables.md) before launching `big-AGI`:
```dotenv
+1 -1
View File
@@ -34,7 +34,7 @@ Fork the repository to your personal GitHub account.
2. On this page, set your **Project name**, **Production branch** (e.g., main), and your Build settings
3. Choose `Next.js` from the **Framework preset** dropdown menu
4. Set a custom **Build Command**:
- `rm app/api/trpc-node/[trpc]/route.ts && npx @cloudflare/next-on-pages@1`
- `rm app/api/cloud/[trpc]/route.ts && npx @cloudflare/next-on-pages@1`
- see the tradeoffs for this deletion on the notice at the top
5. Keep the **Build output directory** as default
6. Click the **Save and Deploy** button
+11
View File
@@ -59,6 +59,17 @@ To make local services running on your host machine accessible to a Docker conta
<br/>
### Reverse Proxy Configuration
A reverse proxy is a server that sits in front of big-AGI's container and can forwards web
requests to it. Often used to run multiple web applications, expose them to the internet,
increase security.
If you're deploying big-AGI behind a reverse proxy, you may want to see
our [Reverse Proxy Deployment Guide](deploy-reverse-proxy.md) for more information.
<br/>
### More Information
The [`Dockerfile`](../Dockerfile) describes how to create a Docker image. It establishes a Node.js environment,
+85
View File
@@ -0,0 +1,85 @@
# Deploy `big-AGI` with Kubernetes ☸️
In this tutorial, we will guide you through the process of deploying big-AGI
in a Kubernetes environment using the kubectl command-line tool.
## First Deployment
### Step 1: Clone the big-AGI repository
```bash
$ git clone https://github.com/enricoros/big-agi
$ cd ./big-agi/docs/k8s
```
### Step 2: Create the namespace
```bash
$ kubectl create namespace ns-big-agi
```
### Step 3: Fill in the key information into env-secret.yaml
All variables are optional. By default, Kubernetes Secret uses Base64 for
encode/decode, so please don't do a git commit after filling in the keys
to avoid leaking sensitive information.
We provide an empty `env-secret.yaml` file as a template.
You can fill in the necessary information using a text editor.
```bash
$ nano env-secret.yaml
```
### Step 4: Deploying Kubernetes Resources
```bash
$ kubectl apply -f big-agi-deployment.yaml -f env-secret.yaml
```
### Step 5: Verifying the Resource Statuses
```bash
$ kubectl -n ns-big-agi get svc,pod,deployment
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/svc-big-agi ClusterIP 10.0.198.118 <none> 3000/TCP 63m
NAME READY STATUS RESTARTS AGE
pod/deployment-big-agi-xxxxxxxx-yyyyy 1/1 Running 0 39m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/deployment-big-agi 1/1 1 1 63m
```
### Step 6: Testing the Service
You can test the service by port-forwarding the service to your local machine:
```bash
$ kubectl -n ns-big-agi port-forward service/svc-big-agi 3000
Forwarding from 127.0.0.1:3000 -> 3000
Forwarding from [::1]:3000 -> 3000
```
Now you can access the service at `http://localhost:3000`, and you should see the big-AGI homepage.
## Updating big-AGI
To update big-AGI to the latest version:
1. Pull the latest changes from the repository:
```bash
$ git pull origin main
```
2. Apply the updated deployment:
```bash
$ kubectl apply -f big-agi-deployment.yaml
```
This will trigger a rolling update of the deployment with the latest image.
**Note**: If you're deploying big-AGI behind a reverse proxy, you may need to configure
your proxy to support streaming. See our [Reverse Proxy Deployment Guide](deploy-reverse-proxy.md) for more information.
Note: For production use, consider setting up an Ingress Controller or Load Balancer instead of using port-forward.
+58
View File
@@ -0,0 +1,58 @@
# Advanced: Deploying big-AGI behind a Reverse Proxy
Note: if you don't have a reverse proxy set up, you can skip this guide.
If you're deploying big-AGI behind a reverse proxy, you may want to configure your proxy to support streaming output.
This guide provides instructions on how to configure your reverse proxy to support streaming output from big-AGI.
This is for advanced deployments, and you should have a basic understanding of how reverse proxies work.
## Nginx Configuration
If you're using Nginx as your reverse proxy, add the following configuration to your server block:
```nginx
server {
listen 80;
server_name your-domain.com;
location / {
# ...your specific proxy_pass configuration, example below...
proxy_pass http://localhost:3000; # Assuming big-AGI is running on port 3000
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# ...
# Important: Disable buffering for the streaming responses (SSE)
chunked_transfer_encoding on; # Turn on chunked transfer encoding
proxy_buffering off; # Turn off proxy buffering
proxy_cache off; # Turn off caching
tcp_nodelay on; # Turn on TCP NODELAY option, disable delay ACK algorithm
tcp_nopush on; # Turn on TCP NOPUSH option, disable Nagle algorithm
# Important: Longer timeouts (5 min)
keepalive_timeout 300;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
}
}
```
This configuration disables caching and buffering, enables chunked transfer encoding, and adjusts TCP settings to optimize for streaming content.
## Troubleshooting
If you're experiencing issues with streaming not working, especially when deploying behind a reverse proxy,
ensure that your proxy is configured to support streaming output as described above.
## Additional Resources
- For Docker deployments, see our [Docker Deployment Guide](deploy-docker.md)
- For Kubernetes deployments, see our [Kubernetes Deployment Guide](deploy-k8s.md)
- For general installation instructions, see our [Installation Guide](installation.md)
If you continue to experience issues, please reach out to our [community support channels](../README.md#-get-involved).
+35 -30
View File
@@ -27,38 +27,41 @@ AZURE_OPENAI_API_ENDPOINT=
AZURE_OPENAI_API_KEY=
ANTHROPIC_API_KEY=
ANTHROPIC_API_HOST=
DEEPSEEK_API_KEY=
GEMINI_API_KEY=
GROQ_API_KEY=
LOCALAI_API_HOST=
LOCALAI_API_KEY=
MISTRAL_API_KEY=
OLLAMA_API_HOST=
OPENPIPE_API_KEY=
OPENROUTER_API_KEY=
PERPLEXITY_API_KEY=
TOGETHERAI_API_KEY=
XAI_API_KEY=
# Model Observability: Helicone
HELICONE_API_KEY=
# Text-To-Speech
ELEVENLABS_API_KEY=
ELEVENLABS_API_HOST=
ELEVENLABS_VOICE_ID=
# Text-To-Image
PRODIA_API_KEY=
# Google Custom Search
GOOGLE_CLOUD_API_KEY=
GOOGLE_CSE_ID=
# Browse
PUPPETEER_WSS_ENDPOINT=
# Backend Analytics
BACKEND_ANALYTICS=
# Search
GOOGLE_CLOUD_API_KEY=
GOOGLE_CSE_ID=
# Text-To-Speech: ElevenLabs
ELEVENLABS_API_KEY=
ELEVENLABS_API_HOST=
ELEVENLABS_VOICE_ID=
# Text-To-Image: Prodia
PRODIA_API_KEY=
# Backend HTTP Basic Authentication (see `deploy-authentication.md` for turning on authentication)
HTTP_BASIC_AUTH_USERNAME=
HTTP_BASIC_AUTH_PASSWORD=
# Frontend variables
NEXT_PUBLIC_GA4_MEASUREMENT_ID=
NEXT_PUBLIC_PLANTUML_SERVER_URL=
@@ -80,24 +83,27 @@ For Database configuration see [deploy-database.md](deploy-database.md).
The following variables when set will enable the corresponding LLMs on the server-side, without
requiring the user to enter an API key
| Variable | Description | Required |
|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `OPENAI_API_KEY` | API key for OpenAI | Recommended |
| `OPENAI_API_HOST` | Changes the backend host for the OpenAI vendor, to enable platforms such as Helicone and CloudFlare AI Gateway | Optional |
| `OPENAI_API_ORG_ID` | Sets the "OpenAI-Organization" header field to support organization users | Optional |
| `AZURE_OPENAI_API_ENDPOINT` | Azure OpenAI endpoint - host only, without the path | Optional, but if set `AZURE_OPENAI_API_KEY` must also be set |
| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key, see [config-azure-openai.md](config-azure-openai.md) | Optional, but if set `AZURE_OPENAI_API_ENDPOINT` must also be set |
| `ANTHROPIC_API_KEY` | The API key for Anthropic | Optional |
| `ANTHROPIC_API_HOST` | Changes the backend host for the Anthropic vendor, to enable platforms such as [config-aws-bedrock.md](config-aws-bedrock.md) | Optional |
| `GEMINI_API_KEY` | The API key for Google AI's Gemini | Optional |
| `GROQ_API_KEY` | The API key for Groq Cloud | Optional |
| `LOCALAI_API_HOST` | Sets the URL of the LocalAI server, or defaults to http://127.0.0.1:8080 | Optional |
| `LOCALAI_API_KEY` | The (Optional) API key for LocalAI | Optional |
| `MISTRAL_API_KEY` | The API key for Mistral | Optional |
| `OLLAMA_API_HOST` | Changes the backend host for the Ollama vendor. See [config-local-ollama.md](config-local-ollama) | |
| `OPENROUTER_API_KEY` | The API key for OpenRouter | Optional |
| `PERPLEXITY_API_KEY` | The API key for Perplexity | Optional |
| `TOGETHERAI_API_KEY` | The API key for Together AI | Optional |
| Variable | Description | Required |
|-----------------------------|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `OPENAI_API_KEY` | API key for OpenAI | Recommended |
| `OPENAI_API_HOST` | Changes the backend host for the OpenAI vendor, to enable platforms such as Helicone and CloudFlare AI Gateway | Optional |
| `OPENAI_API_ORG_ID` | Sets the "OpenAI-Organization" header field to support organization users | Optional |
| `AZURE_OPENAI_API_ENDPOINT` | Azure OpenAI endpoint - host only, without the path | Optional, but if set `AZURE_OPENAI_API_KEY` must also be set |
| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key, see [config-azure-openai.md](config-azure-openai.md) | Optional, but if set `AZURE_OPENAI_API_ENDPOINT` must also be set |
| `ANTHROPIC_API_KEY` | The API key for Anthropic | Optional |
| `ANTHROPIC_API_HOST` | Changes the backend host for the Anthropic vendor, to enable platforms such as AWS Bedrock | Optional |
| `DEEPSEEK_API_KEY` | The API key for Deepseek AI | Optional |
| `GEMINI_API_KEY` | The API key for Google AI's Gemini | Optional |
| `GROQ_API_KEY` | The API key for Groq Cloud | Optional |
| `LOCALAI_API_HOST` | Sets the URL of the LocalAI server, or defaults to http://127.0.0.1:8080 | Optional |
| `LOCALAI_API_KEY` | The (Optional) API key for LocalAI | Optional |
| `MISTRAL_API_KEY` | The API key for Mistral | Optional |
| `OLLAMA_API_HOST` | Changes the backend host for the Ollama vendor. See [config-local-ollama.md](config-local-ollama.md) | |
| `OPENPIPE_API_KEY` | The API key for OpenPipe | Optional |
| `OPENROUTER_API_KEY` | The API key for OpenRouter | Optional |
| `PERPLEXITY_API_KEY` | The API key for Perplexity | Optional |
| `TOGETHERAI_API_KEY` | The API key for Together AI | Optional |
| `XAI_API_KEY` | The API key for xAI | Optional |
### LLM Observability: Helicone
@@ -129,7 +135,6 @@ Enable the app to Talk, Draw, and Google things up.
| **Browse** | |
| `PUPPETEER_WSS_ENDPOINT` | Puppeteer WebSocket endpoint - used for browsing (pade downloadeing), etc. |
| **Backend** | |
| `BACKEND_ANALYTICS` | Semicolon-separated list of analytics flags (see backend.analytics.ts). Flags: `domain` logs the responding domain. |
| `HTTP_BASIC_AUTH_USERNAME` | See the [Authentication](deploy-authentication.md) guide. Username for HTTP Basic Authentication. |
| `HTTP_BASIC_AUTH_PASSWORD` | Password for HTTP Basic Authentication. |
+42
View File
@@ -0,0 +1,42 @@
# Big-AGI Advanced Tips & Tricks
> 🚨 This file is not meant for publication, and it's just been created as a handbook with tips
> and tricks to make Big-AGI more efficient and productive. 🚨
Welcome to the advanced tips and tricks guide for Big-AGI. This document will help you make the most of the platform's existing features.
---
## Hidden Gems
- **Shift + Double-Click** on a chat message to **edit** it.
- **Shift + Trash Icon** to **delete** a chats and messages without confirmation.
- also applies elsewhere: delete Attachments, etc.
- **Shift + Click** on **New Chat** to create an incognito chat.
- Drag a big-AGI saved chat into Big-AGI to load (or attach) it.
## Not-so-obvious Shortcuts
- When sending a message:
- Enter is for newlines
- **Shift + Enter** to send the message.
- **Ctrl + Enter** to **Beam** the message.
- **Alt/Option + Enter** to send the message without an answer.
- When editing a message:
- **Ctrl + Enter** to **Save** the changes.
- **Shift + Ctrl + Enter** to **Save & Regenerate**.
- Scroll between messages:
- **Ctrl + Up/Down** to scroll between **messages** and/or **Beams**.
## Worth the Effort:
- [LiveFile](help-feature-livefile.md) works on **Chrome**: Pair and synchronize your documents and code blocks with files on your local system: refresh, save, update them.
## Best User Hacks:
-
---
Note: this document is just at the beginning. It's here so we can capture
the best tips over time.
+167
View File
@@ -0,0 +1,167 @@
# LiveFile: Synchronize Your Documents with Local Files
## Introduction
**LiveFile** is a powerful feature in big-AGI that allows you to **pair and synchronize
your documents and code blocks** with files on your local system.
This feature enables a **two-way connection between big-AGI and your local files on disk**,
saving you time and effort.
With LiveFile, you can:
- **Pair** documents and code blocks with local files.
- **Monitor** changes in local files and update content in big-AGI.
- **Refresh** chat attachments with the latest content.
- **Save** edits made in big-AGI back to your local files.
- **Store** AI-generated code and content.
---
## Requirements
- **Supported Browsers:**
- **Google Chrome** (desktop)
- **Microsoft Edge** (desktop)
- **Operating Systems:**
- **Desktop platforms only**
- **Note:** Mobile devices (iOS and Android) are **not supported** due to browser limitations.
- **File Types:**
- Designed for **text-based files** (e.g., `.txt`, `.md`, `.js`, `.py`).
- **Performance:**
- Can handle **dozens of files efficiently**.
- **Limitations:**
- **File Size Limit**:
- Supports text files up to **10 MB**.
- **Pairing Persistence:**
- LiveFile connections **do not persist across sessions**.
- After reloading the page, you will need to re-pair your files.
- **Saving Overwrites:**
- Saving changes in big-AGI will **overwrite the entire file**.
- Use external tools for version control or incremental backups.
---
## Enabling LiveFile
LiveFile can be enabled automatically or manually in your Big-AGI workflow.
### Automatic Pairing
When you:
- **Attach**, **drop**, or **paste** a file into a chat message,
LiveFile is **automatically enabled** for that attachment. This means you can start
monitoring and reloading changes without any additional setup.
### Manual Pairing
For existing attachments or code blocks that:
- **Do not have LiveFile enabled** (e.g., created on other devices),
- **Are AI-generated code snippets without an associated file**,
You can manually pair them with a local file.
#### Pairing Attachments
1. **Select the Attachment:**
- Click on the attachment in the chat to view it in the previewer.
2. **Initiate Pairing:**
- Click on **"Pair File"** (🔗).
- If you have open LiveFiles, they will be listed for easy selection.
- Alternatively, you can select a new file from your local system.
3. **Grant Permissions**
- When prompted, allow big-AGI to access the file.
#### Pairing Code Blocks
1. **Access Code Block Options:**
- Click on the code block to reveal the header with options.
2. **Initiate Pairing:**
- Click the **"Pair File"** button (🔗).
- Select from your open LiveFiles or choose a new file.
3. **Confirm Pairing:**
- Grant permission when prompted.
---
## Using LiveFile
### Monitoring Changes
- **Automatic Monitoring:**
- LiveFile watches for changes in your paired local files.
- If the file is modified outside of big-AGI, you'll be shown the changes in the LiveFile bar.
- There is also a **"Replace with File"** option to manually load the latest content and see the changes.
- **Refreshing Content:**
- Click **"Replace with File"** (🔄) to load the latest content from the paired file into big-AGI.
### Saving Edits Back to Paired Files
- **Editing Attachments or Code Blocks:**
- Modify the content directly within big-AGI.
- Attachments: Click on the attachment to open the previewer and click on "Edit" to make changes.
- Code Blocks: Select "Edit" on the chat message to update code blocks.
- **Saving Changes:**
- Click **"Save to File"** (💾) to overwrite the local file with your changes.
- **Note:** This action overwrites the entire file. Ensure this is what you want before proceeding.
---
## Best Practices
- **Monitor External Changes:**
- Refresh content in big-AGI if the local file has been modified outside the application.
- **Use a Version Control System:**
- For critical files, consider using Git or other version control systems to track and monitor changes, authorship, and history.
---
## Troubleshooting
- **LiveFile Options Not Visible:**
- Ensure you are using a **supported desktop browser**.
- Check that you have the latest version of big-AGI.
- **Permission Issues:**
- Confirm that you granted big-AGI permission to access your files.
- Check your browser's settings to ensure file access is allowed.
---
## Technical Details
LiveFile uses the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API) to
interact with your local files securely. It leverages the [browser-fs-access](https://github.com/GoogleChromeLabs/browser-fs-access) library,
an open-source project by Google Chrome Labs, which provides an easy interface to the File System Access API with fallbacks for broader browser support.
- **Security:**
- Access to files requires explicit user permission.
- **Performance:**
- Designed to handle dozens of files efficiently (tested on hundreds).
- Works with the Big-AGI attachment system to recursively add directories.
- **Browser Support:**
- Fully supported on **Google Chrome** and **Microsoft Edge** desktop versions.
---
## Another Big-AGI First!
You can significantly boost your productivity and streamline your workflow within big-AGI
by understanding how to utilize LiveFile's features fully.
This Feature is in Beta as there are a few limitations and improvements to be made.
Join us in enjoying and enhancing this feature on [big-AGI.com](https://big-agi.com), or
[GitHub](https://github.com/enricoros/big-AGI) for support and [Discord](https://discord.gg/MkH4qj2Jp9)
to share the love.
+141
View File
@@ -0,0 +1,141 @@
# Enabling Microphone Access for Speech Recognition
This guide explains how to enable microphone access for speech recognition in various browsers and mobile devices.
Ensuring microphone access is essential for using voice features in applications like big-AGI.
## Desktop Browsers
### Google Chrome (All Platforms, recommended)
1. Open the website (e.g., big-AGI) in Chrome.
2. Click the **lock icon** in the address bar.
3. In the dropdown, find **"Microphone"**.
- Set it to **"Allow"**.
4. If "Microphone" isn't listed:
- Click on **"Site settings"**.
- Find **"Microphone"** in the permissions list.
- Change the setting to **"Allow"**.
5. **Refresh** the page.
### Safari (macOS)
**[Watch the video tutorial: How to enable Speech Recognition in Safari](https://vimeo.com/1010342201)**
If you're seeing a "Speech Recognition permission denied" error, follow these steps:
1. Open **System Settings**.
- Go to **Privacy & Security** > **Speech Recognition**.
- Enable Safari in the list of allowed applications.
- Quit & Open Safari.
2. Click **Safari** in the top menu bar.
- Select **Settings**.
- Go to the **Websites** tab.
- Select **Microphone** from the sidebar.
- Find big-AGI (or localhost for developers) in the list and set it to **Allow**.
- Close the Settings window.
3. **Refresh** the page.
This quick and simple fix should get essential voice input working in big-AGI on your Mac.
### Microsoft Edge (Windows)
1. Open the website in Edge.
2. Click the **lock icon** in the address bar.
3. Click **"Permissions for this site"**.
4. Find **"Microphone"**.
- Set it to **"Allow"**.
5. **Refresh** the page.
### Firefox (All Platforms)
> **Note:** The Speech Recognition API is **not supported** in Firefox. If you're using Firefox, please switch to a supported browser to use speech recognition
> features.
## Mobile Devices
### Android (Chrome)
1. Open the website in Chrome.
2. Tap the **lock icon** in the address bar.
3. Tap **"Permissions"**.
4. Find **"Microphone"**.
- Set it to **"Allow"**.
5. **Refresh** the page.
### iOS (Safari)
1. Open the **Settings** app on your device.
2. Scroll down and tap **"Safari"**.
3. Tap **"Microphone"**.
4. Ensure **"Ask"** or **"Allow"** is selected.
5. Return to Safari and open the website.
6. If prompted, allow microphone access.
7. **Refresh** the page.
### iOS (Chrome)
> **Note:** Chrome on iOS uses Safari's engine due to system limitations. Microphone permissions are managed through iOS settings.
1. Open the **Settings** app.
2. Scroll down and tap **"Chrome"**.
3. Ensure **"Microphone"** is toggled **on**.
4. Open Chrome and navigate to the website.
5. If prompted, allow microphone access.
6. **Refresh** the page.
## Troubleshooting
If you're still experiencing issues after enabling microphone access:
**Check System Permissions (macOS):**
- Open **System Settings**.
- Go to **"Privacy & Security"**.
- Select the **"Privacy"** tab.
- Click **"Microphone"** in the sidebar.
- Ensure your browser (e.g., Chrome, Safari) is checked.
- You may need to unlock the settings by clicking the lock icon at the bottom.
**Check Microphone Access (Windows):**
- Open **Settings**.
- Go to **"Privacy"** > **"Microphone"**.
- Ensure **"Allow apps to access your microphone"** is **on**.
- Scroll down and make sure your browser is allowed.
**Close Other Applications:**
- Close any applications that might be using the microphone.
**Restart the Browser:**
- Close all browser windows and reopen.
**Update Your Browser:**
- Ensure you're using the latest version.
**Check for Browser Extensions:**
- Disable extensions that might block access to the microphone.
For persistent issues, consult your browser's official support resources or contact big-AGI support.
## Technical Details
Big-AGI uses the [Web Speech API (SpeechRecognition)](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition)
to transcribe spoken words into text. This API provides real-time transcription with live previews and works on most
modern mobile and desktop browsers.
**Note on Browser Support:**
| Browser | Support Level | Notes |
|----------------|-----------------|------------------------------------------------------------------------|
| Google Chrome | ✅ Recommended | Fully supported on desktop and Android. Preferred for best experience. |
| Safari | ✅ Supported | Requires macOS/iOS 14 or later. |
| Microsoft Edge | ✅ Supported | Fully supported on desktop. |
| Firefox | ❌ Not Supported | SpeechRecognition API not available. |
**Recommendation:**
For the best experience with speech recognition features, we strongly recommend using Google Chrome.
Ensure your browser is up to date to benefit from the latest features and security updates.
+37
View File
@@ -99,6 +99,43 @@ or follow the steps below for a quick start.
```
Access your big-AGI instance at `http://localhost:3000`.
If you deploy big-AGI behind a reverse proxy, you may want to check out the [Reverse Proxy Configuration Guide](deploy-reverse-proxy.md).
### Kubernetes Deployment
Deploy big-AGI on a Kubernetes cluster for enhanced scalability and management. Follow these steps for a Kubernetes deployment:
1. Clone the big-AGI repository:
```bash
git clone https://github.com/enricoros/big-AGI.git
cd big-AGI
```
2. Configure the environment variables:
```bash
cp docs/k8s/env-secret.yaml env-secret.yaml
vim env-secret.yaml # Edit the file to set your environment variables
```
3. Apply the Kubernetes configurations:
```bash
kubectl create namespace ns-big-agi
kubectl apply -f docs/k8s/big-agi-deployment.yaml -f env-secret.yaml
```
4. Verify the deployment:
```bash
kubectl -n ns-big-agi get svc,pod,deployment
```
5. Access the big-AGI application:
```bash
kubectl -n ns-big-agi port-forward service/svc-big-agi 3000:3000
```
Your big-AGI instance is now accessible at `http://localhost:3000`.
For more detailed instructions on Kubernetes deployment, including updating and troubleshooting, refer to our [Kubernetes Deployment Guide](deploy-k8s.md).
### Midori AI Subsystem for Docker Deployment
Follow the instructions found on [Midori AI Subsystem Site](https://io.midori-ai.xyz/subsystem/manager/)
+52
View File
@@ -0,0 +1,52 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: ns-big-agi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: big-agi
name: deployment-big-agi
namespace: ns-big-agi
spec:
replicas: 1
selector:
matchLabels:
app: big-agi
strategy: {}
template:
metadata:
labels:
app: big-agi
spec:
containers:
- image: ghcr.io/enricoros/big-agi:latest
name: big-agi
ports:
- containerPort: 3000
args:
- next
- start
- -p
- "3000"
envFrom:
- secretRef:
name: env
---
apiVersion: v1
kind: Service
metadata:
labels:
app: big-agi
name: svc-big-agi
namespace: ns-big-agi
spec:
ports:
- name: "http"
port: 3000
targetPort: 3000
selector:
app: big-agi
+49
View File
@@ -0,0 +1,49 @@
---
apiVersion: v1
kind: Secret
metadata:
name: env
namespace: ns-big-agi
type: Opaque
stringData:
# IMPORTANT: This file contains sensitive information. Do not commit changes to version control.
# All variables are optional. Fill in only the ones you need.
#
# For the latest information on all the environment variables, see /docs/environment-variables.md
#
# LLMs
OPENAI_API_KEY: ""
OPENAI_API_HOST: ""
OPENAI_API_ORG_ID: ""
AZURE_OPENAI_API_ENDPOINT: ""
AZURE_OPENAI_API_KEY: ""
ANTHROPIC_API_KEY: ""
ANTHROPIC_API_HOST: ""
DEEPSEEK_API_KEY: ""
GEMINI_API_KEY: ""
GROQ_API_KEY: ""
LOCALAI_API_HOST: ""
LOCALAI_API_KEY: ""
MISTRAL_API_KEY: ""
OLLAMA_API_HOST: ""
OPENPIPE_API_KEY: ""
OPENROUTER_API_KEY: ""
PERPLEXITY_API_KEY: ""
TOGETHERAI_API_KEY: ""
XAI_API_KEY: ""
# Browse
PUPPETEER_WSS_ENDPOINT: ""
# Search
GOOGLE_CLOUD_API_KEY: ""
GOOGLE_CSE_ID: ""
# Text-To-Speech: Eleven Labs
ELEVENLABS_API_KEY: ""
ELEVENLABS_API_HOST: ""
ELEVENLABS_VOICE_ID: ""
# Text-To-Image: Prodia
PRODIA_API_KEY: ""
+43
View File
@@ -0,0 +1,43 @@
# ReAct: question answering with Reasoning and Actions
## What is ReAct?
[ReAct](https://arxiv.org/abs/2210.03629) (Reason+Act) is a classis AI question-answering feature,
that combines reasoning with actions to provide informed answers.
Within Big-AGI, users can invoke ReAct to ask complex questions that require multiple steps to answer.
| Mode | Activation | Information Sources | Reasoning Visibility | When to Use |
|-------|-----------------------------------|------------------------------------------------------|------------------------------------|--------------------------------------------------|
| Chat | Just type and send | **Pre-trained knowledge only** | Only shows final response | Quick answers, general knowledge queries |
| ReAct | Type "/react" before the question | **Web loads, Web searches, Wikipedia, calculations** | Shows step-by-step thought process | Complex, multi-step, or research-based questions |
Example of ReAct in action, taking a question about current events, googling results, opening a page, and summarizing the information:
https://github.com/user-attachments/assets/c3480428-9ab8-4257-a869-2541bf44a062
The following tools are implemented in Big-AGI:
- **browse**: loads web pages (URLs) and extracts information, using a correctly configured `Tools > Browsing` API
- **search**: searches the web to produce page URLs, using a correctly configured `Tools > Google Search` ([Google Programmable Search Engine](https://programmablesearchengine.google.com/about/)) API
- **wikipedia**: looks up information on Wikipedia pages
- **calculate**: performs mathematical calculations by executing typescript code
- warning: (!) unsafe and dangerous, do not use for untrusted code/LLMs
## How to Use ReAct in Big-AGI
1. **Invoking ReAct**: Type "/react" followed by your question in the chat.
2. **What to Expect**:
- An ephemeral space will show the AI's thought process and actions, showing all the steps taken.
- The final answer will appear in the main chat.
3. **Available Actions**: Web searches, Wikipedia lookups, calculations, and optionally web browsing.
## Good to know:
- **ReAct operates in isolation** from the main chat history.
- It **will take longer than standard responses** due to multiple steps.
- Web searches and browsing may have privacy implications, and require **tool configuration** in the UI.
- Errors or limitations in accessing external resources may affect results.
- ReAct does not use the [Tool or Function Calling](https://platform.openai.com/docs/guides/function-calling) feature of AI models, rather uses the old school approach of parsing and executing actions.
+21 -6
View File
@@ -1,10 +1,18 @@
import { readFile } from 'node:fs/promises';
// Build information
process.env.NEXT_PUBLIC_BUILD_HASH = 'big-agi-2-dev';
process.env.NEXT_PUBLIC_BUILD_PKGVER = JSON.parse('' + await readFile(new URL('./package.json', import.meta.url))).version;
process.env.NEXT_PUBLIC_BUILD_TIMESTAMP = new Date().toISOString();
console.log(` 🧠 \x1b[1mbig-AGI\x1b[0m v${process.env.NEXT_PUBLIC_BUILD_PKGVER} (@${process.env.NEXT_PUBLIC_BUILD_HASH})`);
// Non-default build types
const buildType =
process.env.BIG_AGI_BUILD === 'standalone' ? 'standalone'
: process.env.BIG_AGI_BUILD === 'static' ? 'export'
: undefined;
buildType && console.log(` 🧠 big-AGI: building for ${buildType}...\n`);
buildType && console.log(` 🧠 big-AGI: building for ${buildType}...\n`);
/** @type {import('next').NextConfig} */
let nextConfig = {
@@ -23,11 +31,10 @@ let nextConfig = {
},
// [puppeteer] https://github.com/puppeteer/puppeteer/issues/11052
experimental: {
serverComponentsExternalPackages: ['puppeteer-core'],
},
// NOTE: we may not be needing this anymore, as we use '@cloudflare/puppeteer'
serverExternalPackages: ['puppeteer-core'],
webpack: (config, _options) => {
webpack: (config, { isServer }) => {
// @mui/joy: anything material gets redirected to Joy
config.resolve.alias['@mui/material'] = '@mui/joy';
@@ -37,9 +44,17 @@ let nextConfig = {
layers: true,
};
// fix warnings for async functions in the browser (https://github.com/vercel/next.js/issues/64792)
if (!isServer) {
config.output.environment = { ...config.output.environment, asyncFunction: true };
}
// prevent too many small chunks (40kb min) on 'client' packs (not 'server' or 'edge-server')
if (typeof config.optimization.splitChunks === 'object' && config.optimization.splitChunks.minSize)
// noinspection JSUnresolvedReference
if (typeof config.optimization.splitChunks === 'object' && config.optimization.splitChunks.minSize) {
// noinspection JSUnresolvedReference
config.optimization.splitChunks.minSize = 40 * 1024;
}
return config;
},
+4405 -3222
View File
File diff suppressed because it is too large Load Diff
+67 -49
View File
@@ -1,15 +1,17 @@
{
"name": "big-agi",
"version": "1.16.0",
"version": "1.91.0",
"private": true,
"author": "Enrico Ros <enrico.ros@gmail.com>",
"repository": "https://github.com/enricoros/big-agi",
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"dev-debug": "cross-env NODE_OPTIONS='--inspect' next dev",
"dev-https": "next dev --experimental-https",
"build": "next build",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate",
"postinstall": "prisma generate --no-hints",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"vercel:env:pull": "npx vercel env pull .env.development.local"
@@ -18,76 +20,92 @@
"schema": "src/server/prisma/schema.prisma"
},
"dependencies": {
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/cache": "^11.14.0",
"@emotion/react": "^11.14.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.17",
"@mui/joy": "^5.0.0-beta.36",
"@mui/material": "^5.15.17",
"@next/bundle-analyzer": "^14.2.3",
"@next/third-parties": "^14.2.3",
"@prisma/client": "^5.13.0",
"@sanity/diff-match-patch": "^3.1.1",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/react-query": "~4.36.1",
"@trpc/client": "10.44.1",
"@trpc/next": "10.44.1",
"@trpc/react-query": "10.44.1",
"@trpc/server": "10.44.1",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.10",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^5.16.14",
"@mui/joy": "^5.0.0-beta.51",
"@mui/material": "^5.16.14",
"@next/bundle-analyzer": "^15.1.4",
"@next/third-parties": "^15.1.4",
"@prisma/client": "~5.22.0",
"@t3-oss/env-nextjs": "^0.11.1",
"@tanstack/react-query": "^5.63.0",
"@tanstack/react-virtual": "^3.11.2",
"@trpc/client": "11.0.0-rc.688",
"@trpc/next": "11.0.0-rc.688",
"@trpc/react-query": "11.0.0-rc.688",
"@trpc/server": "11.0.0-rc.688",
"@vercel/analytics": "^1.4.1",
"@vercel/speed-insights": "^1.1.0",
"browser-fs-access": "^0.35.0",
"cheerio": "^1.0.0-rc.12",
"eventsource-parser": "^1.1.2",
"cheerio": "^1.0.0",
"dexie": "^4.0.10",
"dexie-react-hooks": "^1.1.7",
"diff": "^7.0.0",
"eventsource-parser": "^3.0.0",
"idb-keyval": "^6.2.1",
"next": "~14.1.4",
"mammoth": "^1.9.0",
"nanoid": "^5.0.9",
"next": "^15.1.4",
"nprogress": "^0.2.0",
"pdfjs-dist": "4.2.67",
"pdfjs-dist": "4.10.38",
"plantuml-encoder": "^1.4.0",
"prismjs": "^1.29.0",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-csv": "^2.2.2",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.2",
"react-katex": "^3.0.1",
"react-markdown": "^9.0.1",
"react-markdown": "^9.0.3",
"react-player": "^2.16.0",
"react-resizable-panels": "^2.0.19",
"react-resizable-panels": "^2.1.7",
"react-timeago": "^7.2.0",
"rehype-katex": "^7.0.0",
"rehype-katex": "^7.0.1",
"remark-gfm": "^4.0.0",
"remark-mark-highlight": "^0.1.1",
"remark-math": "^6.0.0",
"sharp": "^0.33.3",
"superjson": "^2.2.1",
"tesseract.js": "^5.1.0",
"tiktoken": "^1.0.15",
"sharp": "^0.33.5",
"superjson": "^2.2.2",
"tesseract.js": "^6.0.0",
"tiktoken": "^1.0.18",
"turndown": "^7.2.0",
"uuid": "^9.0.1",
"zod": "^3.23.8",
"zustand": "^4.5.2"
"zod": "^3.24.1",
"zod-to-json-schema": "^3.24.1",
"zustand": "^5.0.3"
},
"devDependencies": {
"@cloudflare/puppeteer": "0.0.5",
"@types/node": "^20.12.11",
"@types/diff": "^7.0.0",
"@types/node": "^22.10.5",
"@types/nprogress": "^0.2.3",
"@types/plantuml-encoder": "^1.4.2",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.1",
"@types/prismjs": "^1.26.5",
"@types/react": "^18.3.18",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-csv": "^1.1.10",
"@types/react-dom": "^18.3.0",
"@types/react-dom": "^18.3.5",
"@types/react-katex": "^3.0.4",
"@types/react-timeago": "^4.1.7",
"@types/turndown": "^5.0.4",
"@types/uuid": "^9.0.8",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"prettier": "^3.2.5",
"prisma": "^5.13.0",
"typescript": "^5.4.5"
"@types/turndown": "^5.0.5",
"cross-env": "^7.0.3",
"eslint": "^9.17.0",
"eslint-config-next": "^15.1.4",
"prettier": "^3.4.2",
"prisma": "~5.22.0",
"puppeteer-core": "^23.11.1",
"typescript": "^5.7.3"
},
"engines": {
"node": "^20.0.0 || ^18.0.0"
"node": "^22.0.0 || ^20.0.0"
},
"overrides": {
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"uri-js": "npm:uri-js-replace"
}
}
+25 -19
View File
@@ -11,20 +11,27 @@ import 'katex/dist/katex.min.css';
import '~/common/styles/CodePrism.css';
import '~/common/styles/GithubMarkdown.css';
import '~/common/styles/NProgress.css';
import '~/common/styles/agi.effects.css';
import '~/common/styles/app.styles.css';
import { Is } from '~/common/util/pwaUtils';
import { OverlaysInsert } from '~/common/layout/overlays/OverlaysInsert';
import { ProviderBackendCapabilities } from '~/common/providers/ProviderBackendCapabilities';
import { ProviderBootstrapLogic } from '~/common/providers/ProviderBootstrapLogic';
import { ProviderSingleTab } from '~/common/providers/ProviderSingleTab';
import { ProviderSnacks } from '~/common/providers/ProviderSnacks';
import { ProviderTRPCQuerySettings } from '~/common/providers/ProviderTRPCQuerySettings';
import { ProviderTheming } from '~/common/providers/ProviderTheming';
import { SnackbarInsert } from '~/common/components/snackbar/SnackbarInsert';
import { hasGoogleAnalytics, OptionalGoogleAnalytics } from '~/common/components/GoogleAnalytics';
import { isVercelFromFrontend } from '~/common/util/pwaUtils';
const MyApp = ({ Component, emotionCache, pageProps }: MyAppProps) =>
<>
const Big_AGI_App = ({ Component, emotionCache, pageProps }: MyAppProps) => {
// We are using a nextjs per-page layout pattern to bring the (Optima) layout creation to a shared place
// This reduces the flicker and the time switching between apps, and seems to not have impact on
// the build. This is a good trade-off for now.
const getLayout = Component.getLayout ?? ((page: any) => page);
return <>
<Head>
<title>{Brand.Title.Common}</title>
@@ -33,24 +40,23 @@ const MyApp = ({ Component, emotionCache, pageProps }: MyAppProps) =>
<ProviderTheming emotionCache={emotionCache}>
<ProviderSingleTab>
<ProviderTRPCQuerySettings>
<ProviderBackendCapabilities>
{/* ^ SSR boundary */}
<ProviderBootstrapLogic>
<ProviderSnacks>
<Component {...pageProps} />
</ProviderSnacks>
</ProviderBootstrapLogic>
</ProviderBackendCapabilities>
</ProviderTRPCQuerySettings>
<ProviderBackendCapabilities>
{/* ^ Backend capabilities & SSR boundary */}
<ProviderBootstrapLogic>
<SnackbarInsert />
{getLayout(<Component {...pageProps} />)}
<OverlaysInsert />
</ProviderBootstrapLogic>
</ProviderBackendCapabilities>
</ProviderSingleTab>
</ProviderTheming>
{isVercelFromFrontend && <VercelAnalytics debug={false} />}
{isVercelFromFrontend && <VercelSpeedInsights debug={false} sampleRate={1 / 2} />}
{Is.Deployment.VercelFromFrontend && <VercelAnalytics debug={false} />}
{Is.Deployment.VercelFromFrontend && <VercelSpeedInsights debug={false} sampleRate={1 / 2} />}
{hasGoogleAnalytics && <OptionalGoogleAnalytics />}
</>;
};
// enables the React Query API invocation
export default apiQuery.withTRPC(MyApp);
// Initializes React Query and tRPC, and enables the tRPC React Query hooks (apiQuery).
export default apiQuery.withTRPC(Big_AGI_App);
+2 -2
View File
@@ -2,7 +2,7 @@ import * as React from 'react';
import { AppType, MyAppProps } from 'next/app';
import { default as Document, DocumentContext, DocumentProps, Head, Html, Main, NextScript } from 'next/document';
import createEmotionServer from '@emotion/server/create-instance';
import { getInitColorSchemeScript } from '@mui/joy/styles';
import InitColorSchemeScript from '@mui/joy/InitColorSchemeScript';
import { Brand } from '~/common/app.config';
import { createEmotionCache } from '~/common/app.theme';
@@ -51,7 +51,7 @@ export default function MyDocument({ emotionStyleTags }: MyDocumentProps) {
{emotionStyleTags}
</Head>
<body>
{getInitColorSchemeScript()}
<InitColorSchemeScript />
<Main />
<NextScript />
</body>
+2 -4
View File
@@ -2,9 +2,7 @@ import * as React from 'react';
import { AppCall } from '../src/apps/call/AppCall';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function CallPage() {
return withLayout({ type: 'optima' }, <AppCall />);
}
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppCall />);
+2 -4
View File
@@ -2,9 +2,7 @@ import * as React from 'react';
import { AppBeam } from '../../src/apps/beam/AppBeam';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function BeamPage() {
return withLayout({ type: 'optima' }, <AppBeam />);
}
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppBeam />);
+8
View File
@@ -0,0 +1,8 @@
import * as React from 'react';
import { AppDiff } from '../src/apps/diff/AppDiff';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppDiff />);
+2 -4
View File
@@ -2,9 +2,7 @@ import * as React from 'react';
import { AppDraw } from '../src/apps/draw/AppDraw';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function DrawPage() {
return withLayout({ type: 'optima' }, <AppDraw />);
}
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppDraw />);
+4 -4
View File
@@ -2,13 +2,13 @@ import * as React from 'react';
import { AppChat } from '../src/apps/chat/AppChat';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function IndexPage() {
export default withNextJSPerPageLayout({ type: 'optima' }, () => {
// TODO: This Index page will point to the Dashboard (or a landing page)
// For now it offers the chat experience, but this will change. #299
return withLayout({ type: 'optima' }, <AppChat />);
}
return <AppChat />;
});
+21 -24
View File
@@ -7,30 +7,28 @@ import DownloadIcon from '@mui/icons-material/Download';
import { AppPlaceholder } from '../../src/apps/AppPlaceholder';
import { getBackendCapabilities } from '~/modules/backend/store-backend-capabilities';
import { getPlantUmlServerUrl } from '~/modules/blocks/code/RenderCode';
import { getPlantUmlServerUrl } from '~/modules/blocks/code/code-renderers/RenderCodePlantUML';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
// app config
// basics
import { Brand } from '~/common/app.config';
import { ROUTE_APP_CHAT, ROUTE_INDEX } from '~/common/app.routes';
// apps access
import { incrementalNewsVersion, useAppNewsStateStore } from '../../src/apps/news/news.version';
import { Release } from '~/common/app.release';
// capabilities access
import { useCapabilityBrowserSpeechRecognition, useCapabilityElevenLabs, useCapabilityTextToImage } from '~/common/components/useCapabilities';
// stores access
import { getLLMsDebugInfo } from '~/modules/llms/store-llms';
import { useAppStateStore } from '~/common/state/store-appstate';
import { useChatStore } from '~/common/state/store-chats';
import { useFolderStore } from '~/common/state/store-folders';
import { getLLMsDebugInfo } from '~/common/stores/llms/store-llms';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { useFolderStore } from '~/common/stores/folders/store-chat-folders';
import { useLogicSherpaStore } from '~/common/logic/store-logic-sherpa';
import { useUXLabsStore } from '~/common/state/store-ux-labs';
// utils access
import { clientHostName, isChromeDesktop, isFirefox, isIPhoneUser, isMacUser, isPwa, isVercelFromFrontend } from '~/common/util/pwaUtils';
import { BrowserLang, clientHostName, Is, isPwa } from '~/common/util/pwaUtils';
import { getGA4MeasurementId } from '~/common/components/GoogleAnalytics';
import { prettyTimestampForFilenames } from '~/common/util/timeUtils';
import { supportsClipboardRead } from '~/common/util/clipboardUtils';
@@ -71,6 +69,8 @@ function DebugJsonCard(props: { title: string, data: any }) {
}
const frontendBuild = Release.buildInfo('frontend');
function AppDebug() {
// state
@@ -81,19 +81,15 @@ function AppDebug() {
const chatsCount = useChatStore.getState().conversations?.length;
const uxLabsExperiments = Object.entries(useUXLabsStore.getState()).filter(([_k, v]) => v === true).map(([k, _]) => k).join(', ');
const { folders, enableFolders } = useFolderStore.getState();
const { lastSeenNewsVersion } = useAppNewsStateStore.getState();
const { usageCount } = useAppStateStore.getState();
const { lastSeenNewsVersion, usageCount } = useLogicSherpaStore.getState();
// derived state
const cClient = {
// isBrowser,
isChromeDesktop,
isFirefox,
isIPhone: isIPhoneUser,
isMac: isMacUser,
Is,
BrowserLang,
isPWA: isPwa(),
supportsClipboardPaste: supportsClipboardRead,
supportsClipboardPaste: supportsClipboardRead(),
supportsScreenCapture,
};
const cProduct = {
@@ -107,18 +103,21 @@ function AppDebug() {
chatsCount,
foldersCount: folders?.length,
foldersEnabled: enableFolders,
newsCurrent: incrementalNewsVersion,
newsCurrent: Release.Monotonics.NewsVersion,
newsSeen: lastSeenNewsVersion,
labsActive: uxLabsExperiments,
reloads: usageCount,
},
release: {
app: Release.App,
build: frontendBuild,
},
};
const cBackend = {
configuration: backendCaps,
deployment: {
home: Brand.URIs.Home,
hostName: clientHostName(),
isVercelFromFrontend,
measurementId: getGA4MeasurementId(),
plantUmlServerUrl: getPlantUmlServerUrl(),
routeIndex: ROUTE_INDEX,
@@ -164,6 +163,4 @@ function AppDebug() {
}
export default function DebugPage() {
return withLayout({ type: 'plain' }, <AppDebug />);
};
export default withNextJSPerPageLayout({ type: 'container' }, () => <AppDebug />);
+9 -9
View File
@@ -2,20 +2,19 @@ import * as React from 'react';
import { Box, Typography } from '@mui/joy';
import { useModelsStore } from '~/modules/llms/store-llms';
import { llmsStoreActions } from '~/common/stores/llms/store-llms';
import { InlineError } from '~/common/components/InlineError';
import { apiQuery } from '~/common/util/trpc.client';
import { navigateToIndex, useRouterQuery } from '~/common/app.routes';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
function CallbackOpenRouterPage(props: { openRouterCode: string | undefined }) {
// external state
const { data, isError, error, isLoading } = apiQuery.backend.exchangeOpenRouterKey.useQuery({ code: props.openRouterCode || '' }, {
const { data, isError, error, isPending } = apiQuery.backend.exchangeOpenRouterKey.useQuery({ code: props.openRouterCode || '' }, {
enabled: !!props.openRouterCode,
refetchOnWindowFocus: false,
staleTime: Infinity,
});
@@ -31,7 +30,7 @@ function CallbackOpenRouterPage(props: { openRouterCode: string | undefined }) {
return;
// 1. Save the key as the client key
useModelsStore.getState().setOpenRoutersKey(openRouterKey);
llmsStoreActions().setOpenRouterKey(openRouterKey);
// 2. Navigate to the chat app
void navigateToIndex(true); //.then(openModelsSetup);
@@ -56,7 +55,7 @@ function CallbackOpenRouterPage(props: { openRouterCode: string | undefined }) {
Welcome Back
</Typography>
{isLoading && <Typography level='body-sm'>Loading...</Typography>}
{isPending && <Typography level='body-sm'>Loading...</Typography>}
{isErrorInput && <InlineError error='There was an issue retrieving the code from OpenRouter.' />}
@@ -81,10 +80,11 @@ function CallbackOpenRouterPage(props: { openRouterCode: string | undefined }) {
* Docs: https://openrouter.ai/docs#oauth
* Example URL: https://localhost:3000/link/callback_openrouter?code=SomeCode
*/
export default function CallbackPage() {
export default withNextJSPerPageLayout({ type: 'container' }, () => {
// external state - get the 'code=...' from the URL
const { code } = useRouterQuery<{ code: string | undefined }>();
return withLayout({ type: 'plain' }, <CallbackOpenRouterPage openRouterCode={code} />);
}
return <CallbackOpenRouterPage openRouterCode={code} />;
});
+5 -4
View File
@@ -3,13 +3,14 @@ import * as React from 'react';
import { AppLinkChat } from '../../../src/apps/link-chat/AppLinkChat';
import { useRouterQuery } from '~/common/app.routes';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function ChatLinkPage() {
export default withNextJSPerPageLayout({ type: 'optima', suspendAutoModelsSetup: true }, () => {
// external state
const { chatLinkId } = useRouterQuery<{ chatLinkId: string | undefined }>();
return withLayout({ type: 'optima', suspendAutoModelsSetup: true }, <AppLinkChat chatLinkId={chatLinkId || null} />);
}
return <AppLinkChat chatLinkId={chatLinkId || null} />;
});
+9 -7
View File
@@ -3,14 +3,14 @@ import * as React from 'react';
import { Alert, Box, Button, Typography } from '@mui/joy';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import { setComposerStartupText } from '../../src/apps/chat/components/composer/store-composer';
import { setComposerStartupText } from '~/common/logic/store-logic-sherpa';
import { callBrowseFetchPage } from '~/modules/browse/browse.client';
import { callBrowseFetchPageOrThrow } from '~/modules/browse/browse.client';
import { LogoProgress } from '~/common/components/LogoProgress';
import { asValidURL } from '~/common/util/urlUtils';
import { navigateToIndex, useRouterQuery } from '~/common/app.routes';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
/**
@@ -75,9 +75,13 @@ function AppShareTarget() {
React.useEffect(() => {
if (intentURL) {
setIsDownloading(true);
callBrowseFetchPage(intentURL)
callBrowseFetchPageOrThrow(intentURL)
.then(page => {
if (page.stopReason !== 'error') {
if (!page.content) {
setErrorMessage(page.file ? 'No web page found, and we do not support files at the moment.' : 'No content found');
return;
}
let pageContent = page.content.markdown || page.content.text || page.content.html || '';
if (pageContent)
pageContent = '\n\n```' + intentURL + '\n' + pageContent + '\n```\n';
@@ -135,6 +139,4 @@ function AppShareTarget() {
* This page will be invoked on mobile when sharing Text/URLs/Files from other APPs
* Example URL: https://localhost:3000/link/share_target?title=This+Title&text=https%3A%2F%2Fexample.com%2Fapp%2Fpath
*/
export default function ShareTargetPage() {
return withLayout({ type: 'plain' }, <AppShareTarget />);
}
export default withNextJSPerPageLayout({ type: 'container' }, () => <AppShareTarget />);
+6 -5
View File
@@ -1,14 +1,15 @@
import * as React from 'react';
import { AppNews } from '../src/apps/news/AppNews';
import { markNewsAsSeen } from '../src/apps/news/news.version';
import { withLayout } from '~/common/layout/withLayout';
import { markNewsAsSeen } from '~/common/logic/store-logic-sherpa';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function NewsPage() {
export default withNextJSPerPageLayout({ type: 'optima', suspendAutoModelsSetup: true }, () => {
// 'touch' the last seen news version
React.useEffect(() => markNewsAsSeen(), []);
return withLayout({ type: 'optima', suspendAutoModelsSetup: true }, <AppNews />);
}
return <AppNews />;
});
+2 -4
View File
@@ -2,9 +2,7 @@ import * as React from 'react';
import { AppPersonas } from '../src/apps/personas/AppPersonas';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function PersonasPage() {
return withLayout({ type: 'optima' }, <AppPersonas />);
}
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppPersonas />);
+8
View File
@@ -0,0 +1,8 @@
import * as React from 'react';
import { AppTokens } from '../src/apps/tokens/AppTokens';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppTokens />);
+3 -7
View File
@@ -1,12 +1,8 @@
import * as React from 'react';
import { Box } from '@mui/joy';
import { AppPlaceholder } from '../src/apps/AppPlaceholder';
// import { AppWorkspace } from '../src/apps/personas/AppWorkspace';
import { withLayout } from '~/common/layout/withLayout';
import { withNextJSPerPageLayout } from '~/common/layout/withLayout';
export default function PersonasPage() {
return withLayout({ type: 'optima' }, <Box />);
}
export default withNextJSPerPageLayout({ type: 'optima' }, () => <AppPlaceholder />);
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+29 -8
View File
@@ -15,20 +15,22 @@
"scope": "/",
"icons": [
{
"src": "/icons/icon-192x192.png",
"sizes": "192x192",
"src": "/icons/icon-1024x1024.png",
"sizes": "1024x1024",
"type": "image/png",
"purpose": "maskable"
"purpose": "any maskable"
},
{
"src": "/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
"type": "image/png",
"purpose": "any"
},
{
"src": "/icons/icon-1024x1024.png",
"sizes": "1024x1024",
"type": "image/png"
"src": "/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
}
],
"file_handlers": [
@@ -56,7 +58,26 @@
{
"name": "Call",
"url": "/call",
"description": "Call a Persona"
"description": "Call a Persona",
"icons": [
{
"src": "/icons/icon-call-96x96.png",
"sizes": "96x96",
"type": "image/png"
}
]
},
{
"name": "New Voice Chat",
"url": "/?newChat=voiceInput",
"description": "Start a new chat with voice input",
"icons": [
{
"src": "/icons/icon-voicechat-96x96.png",
"sizes": "96x96",
"type": "image/png"
}
]
}
]
}
File diff suppressed because one or more lines are too long
+27
View File
@@ -0,0 +1,27 @@
import * as React from 'react';
import { Box, Container, Typography } from '@mui/joy';
export function AppSmallContainer({ title, description, children }: {
title: string;
description: React.ReactNode;
children: React.ReactNode;
}) {
return (
<Box sx={{ flexGrow: 1, overflowY: 'auto', p: { xs: 3, md: 6 } }}>
<Container disableGutters maxWidth='md' sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
<Box sx={{ mb: 2 }}>
<Typography level='h1' sx={{ mb: 1 }}>{title}</Typography>
<Typography>{description}</Typography>
</Box>
{children}
</Container>
</Box>
);
}
+15 -12
View File
@@ -5,23 +5,24 @@ import { Box, Button, Typography } from '@mui/joy';
import { BeamStoreApi, useBeamStore } from '~/modules/beam/store-beam.hooks';
import { BeamView } from '~/modules/beam/BeamView';
import { createBeamVanillaStore } from '~/modules/beam/store-beam-vanilla';
import { useModelsStore } from '~/modules/llms/store-llms';
import { createBeamVanillaStore } from '~/modules/beam/store-beam_vanilla';
import { createDConversation, createDMessage, DConversation, DMessage } from '~/common/state/store-chats';
import { OptimaToolbarIn } from '~/common/layout/optima/portals/OptimaPortalsIn';
import { createDConversation, DConversation } from '~/common/stores/chat/chat.conversation';
import { createDMessageTextContent, DMessage } from '~/common/stores/chat/chat.message';
import { getChatLLMId } from '~/common/stores/llms/store-llms';
import { useIsMobile } from '~/common/components/useMatchMedia';
import { usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
function initTestConversation(): DConversation {
const conversation = createDConversation();
conversation.messages.push(createDMessage('system', 'You are a helpful assistant.'));
conversation.messages.push(createDMessage('user', 'Hello, who are you? (please expand...)'));
conversation.messages.push(createDMessageTextContent('system', 'You are a helpful assistant.')); // Beam Test - seed1
conversation.messages.push(createDMessageTextContent('user', 'Hello, who are you? (please expand...)')); // Beam Test - seed2
return conversation;
}
function initTestBeamStore(messages: DMessage[], beamStore: BeamStoreApi = createBeamVanillaStore()): BeamStoreApi {
beamStore.getState().open(messages, useModelsStore.getState().chatLLMId, (text) => alert(text));
beamStore.getState().open(messages, getChatLLMId(), false, (content) => alert(content));
return beamStore;
}
@@ -56,8 +57,7 @@ export function AppBeam() {
}, [beamStoreApi]);
// layout
usePluggableOptimaLayout(null, React.useMemo(() => <>
const toolbarItems = React.useMemo(() => <>
{/* button to toggle debug info */}
<Button size='sm' variant='plain' color='neutral' onClick={() => setShowDebug(on => !on)}>
{showDebug ? 'Hide' : 'Show'} debug
@@ -72,10 +72,12 @@ export function AppBeam() {
<Button size='sm' variant='plain' color='neutral' onClick={handleClose}>
.close
</Button>
</>, [handleClose, showDebug]), null, 'AppBeam');
</>, [handleClose, showDebug]);
return (
return <>
<OptimaToolbarIn>{toolbarItems}</OptimaToolbarIn>
<Box sx={{ flexGrow: 1, overflowY: 'auto', position: 'relative' }}>
{isOpen && (
@@ -101,5 +103,6 @@ export function AppBeam() {
)}
</Box>
);
</>;
}
+1 -1
View File
@@ -2,7 +2,7 @@ import * as React from 'react';
import { Container, Sheet } from '@mui/joy';
import type { DConversationId } from '~/common/state/store-chats';
import type { DConversationId } from '~/common/stores/chat/chat.conversation';
import { useRouterQuery } from '~/common/app.routes';
import { CallWizard } from './CallWizard';
+11 -12
View File
@@ -9,11 +9,11 @@ import MicIcon from '@mui/icons-material/Mic';
import RecordVoiceOverTwoToneIcon from '@mui/icons-material/RecordVoiceOverTwoTone';
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
import { PreferencesTab, useOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { animationColorRainbow } from '~/common/util/animUtils';
import { navigateBack } from '~/common/app.routes';
import { optimaOpenPreferences } from '~/common/layout/optima/useOptima';
import { useCapabilityBrowserSpeechRecognition, useCapabilityElevenLabs } from '~/common/components/useCapabilities';
import { useChatStore } from '~/common/state/store-chats';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { useUICounter } from '~/common/state/store-ui';
@@ -44,7 +44,6 @@ export function CallWizard(props: { strict?: boolean, conversationId: string | n
const [recognitionOverride, setRecognitionOverride] = React.useState(false);
// external state
const { openPreferencesTab } = useOptimaLayout();
const recognition = useCapabilityBrowserSpeechRecognition();
const synthesis = useCapabilityElevenLabs();
const chatIsEmpty = useChatStore(state => {
@@ -62,22 +61,22 @@ export function CallWizard(props: { strict?: boolean, conversationId: string | n
const allGood = overriddenEmptyChat && overriddenRecognition && synthesis.mayWork;
const fatalGood = overriddenRecognition && synthesis.mayWork;
if (!novel && fatalGood)
return props.children;
const handleOverrideChatEmpty = () => setChatEmptyOverride(true);
const handleOverrideChatEmpty = React.useCallback(() => setChatEmptyOverride(true), []);
const handleOverrideRecognition = () => setRecognitionOverride(true);
const handleOverrideRecognition = React.useCallback(() => setRecognitionOverride(true), []);
const handleConfigureElevenLabs = () => {
openPreferencesTab(PreferencesTab.Voice);
};
const handleConfigureElevenLabs = React.useCallback(() => optimaOpenPreferences('voice'), []);
const handleFinishButton = () => {
const handleFinishButton = React.useCallback(() => {
if (!allGood)
return navigateBack();
touch();
};
}, [allGood, touch]);
if (!novel && fatalGood)
return props.children;
return <>
+15 -14
View File
@@ -1,14 +1,15 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import type { SxProps } from '@mui/joy/styles/types';
import { Avatar, Box, Card, CardContent, Chip, IconButton, Link as MuiLink, ListDivider, MenuItem, Sheet, Switch, Typography } from '@mui/joy';
import CallIcon from '@mui/icons-material/Call';
import { GitHubProjectIssueCard } from '~/common/components/GitHubProjectIssueCard';
import { OptimaPanelGroup } from '~/common/layout/optima/panel/OptimaPanelGroup';
import { animationShadowRingLimey } from '~/common/util/animUtils';
import { conversationTitle, DConversation, DConversationId, useChatStore } from '~/common/state/store-chats';
import { usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { conversationTitle, DConversation, DConversationId } from '~/common/stores/chat/chat.conversation';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { useSetOptimaAppMenu } from '~/common/layout/optima/useOptima';
import type { AppCallIntent } from './AppCall';
import { MockPersona, useMockPersonas } from './state/useMockPersonas';
@@ -60,7 +61,7 @@ const ContactCardConversationCall = (props: { conversation: DConversation, onCon
function CallContactCard(props: {
persona: MockPersona,
callGrayUI: boolean,
conversations: DConversation[],
conversations: Readonly<DConversation[]>,
setCallIntent: (intent: AppCallIntent) => void,
}) {
@@ -189,7 +190,7 @@ function CallContactCard(props: {
function useConversationsByPersona() {
const conversations = useChatStore(state => state.conversations, shallow);
const conversations = useChatStore(state => state.conversations);
return React.useMemo(() => {
// group by personaId
@@ -223,7 +224,12 @@ export function Contacts(props: { setCallIntent: (intent: AppCallIntent) => void
// pluggable UI
const menuItems = React.useMemo(() => <>
const menuItems = React.useMemo(() => <OptimaPanelGroup title='Contacts Settings'>
<MenuItem onClick={toggleGrayUI}>
Grayed UI
<Switch checked={grayUI} sx={{ ml: 'auto' }} />
</MenuItem>
<MenuItem onClick={toggleShowConversations}>
Conversations
@@ -231,18 +237,13 @@ export function Contacts(props: { setCallIntent: (intent: AppCallIntent) => void
</MenuItem>
<MenuItem onClick={toggleShowSupport}>
Support
Show Support
<Switch checked={showSupport} sx={{ ml: 'auto' }} />
</MenuItem>
<MenuItem onClick={toggleGrayUI}>
Grayed UI
<Switch checked={grayUI} sx={{ ml: 'auto' }} />
</MenuItem>
</OptimaPanelGroup>, [grayUI, showConversations, showSupport, toggleGrayUI, toggleShowConversations, toggleShowSupport]);
</>, [grayUI, showConversations, showSupport, toggleGrayUI, toggleShowConversations, toggleShowSupport]);
usePluggableOptimaLayout(null, null, menuItems, 'CallUI');
useSetOptimaAppMenu(menuItems, 'CallUI-Contacts');
return <>
+103 -64
View File
@@ -11,19 +11,27 @@ import RecordVoiceOverTwoToneIcon from '@mui/icons-material/RecordVoiceOverTwoTo
import { ScrollToBottom } from '~/common/scroll-to-bottom/ScrollToBottom';
import { ScrollToBottomButton } from '~/common/scroll-to-bottom/ScrollToBottomButton';
import { useChatLLMDropdown } from '../chat/components/useLLMDropdown';
import { useChatLLMDropdown } from '../chat/components/layout-bar/useLLMDropdown';
import { EXPERIMENTAL_speakTextStream } from '~/modules/elevenlabs/elevenlabs.client';
import { SystemPurposeId, SystemPurposes } from '../../data';
import { llmStreamingChatGenerate, VChatMessageIn } from '~/modules/llms/llm.client';
import { elevenLabsSpeakText } from '~/modules/elevenlabs/elevenlabs.client';
import { AixChatGenerateContent_DMessage, aixChatGenerateContent_DMessage_FromConversation } from '~/modules/aix/client/aix.client';
import { useElevenLabsVoiceDropdown } from '~/modules/elevenlabs/useElevenLabsVoiceDropdown';
import type { OptimaBarControlMethods } from '~/common/layout/optima/bar/OptimaBarDropdown';
import { AudioPlayer } from '~/common/util/audio/AudioPlayer';
import { Link } from '~/common/components/Link';
import { SpeechResult, useSpeechRecognition } from '~/common/components/useSpeechRecognition';
import { conversationTitle, createDMessage, DMessage, useChatStore } from '~/common/state/store-chats';
import { OptimaPanelGroup } from '~/common/layout/optima/panel/OptimaPanelGroup';
import { OptimaToolbarIn } from '~/common/layout/optima/portals/OptimaPortalsIn';
import { SpeechResult, useSpeechRecognition } from '~/common/components/speechrecognition/useSpeechRecognition';
import { conversationTitle, remapMessagesSysToUsr } from '~/common/stores/chat/chat.conversation';
import { createDMessageFromFragments, createDMessageTextContent, DMessage, messageFragmentsReduceText } from '~/common/stores/chat/chat.message';
import { createErrorContentFragment } from '~/common/stores/chat/chat.fragments';
import { launchAppChat, navigateToIndex } from '~/common/app.routes';
import { playSoundUrl, usePlaySoundUrl } from '~/common/util/audioUtils';
import { usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { useGlobalShortcuts } from '~/common/components/shortcuts/useGlobalShortcuts';
import { usePlayUrl } from '~/common/util/audio/usePlayUrl';
import { useSetOptimaAppMenu } from '~/common/layout/optima/useOptima';
import type { AppCallIntent } from './AppCall';
import { CallAvatar } from './components/CallAvatar';
@@ -48,7 +56,7 @@ function CallMenuItems(props: {
const handleChangeVoiceToggle = () => props.setOverride(!props.override);
return <>
return <OptimaPanelGroup title='Call'>
<MenuItem onClick={handlePushToTalkToggle}>
<ListItemDecorator>{props.pushToTalk ? <MicNoneIcon /> : <MicIcon />}</ListItemDecorator>
@@ -78,7 +86,7 @@ function CallMenuItems(props: {
Voice Calls Feedback
</MenuItem>
</>;
</OptimaPanelGroup>;
}
@@ -95,10 +103,11 @@ export function Telephone(props: {
const [personaTextInterim, setPersonaTextInterim] = React.useState<string | null>(null);
const [pushToTalk, setPushToTalk] = React.useState(true);
const [stage, setStage] = React.useState<'ring' | 'declined' | 'connected' | 'ended'>('ring');
const llmDropdownRef = React.useRef<OptimaBarControlMethods>(null);
const responseAbortController = React.useRef<AbortController | null>(null);
// external state
const { chatLLMId, chatLLMDropdown } = useChatLLMDropdown();
const { chatLLMId, chatLLMDropdown } = useChatLLMDropdown(llmDropdownRef);
const { chatTitle, reMessages } = useChatStore(useShallow(state => {
const conversation = props.callIntent.conversationId
? state.conversations.find(conversation => conversation.id === props.callIntent.conversationId) ?? null
@@ -118,12 +127,12 @@ export function Telephone(props: {
const onSpeechResultCallback = React.useCallback((result: SpeechResult) => {
setSpeechInterim(result.done ? null : { ...result });
if (result.done) {
const transcribed = result.transcript.trim();
if (transcribed.length >= 1)
setCallMessages(messages => [...messages, createDMessage('user', transcribed)]);
const userSpeechTranscribed = result.transcript.trim();
if (userSpeechTranscribed.length >= 1)
setCallMessages(messages => [...messages, createDMessageTextContent('user', userSpeechTranscribed)]); // [state] append user:speech
}
}, []);
const { isSpeechEnabled, isRecording, isRecordingAudio, isRecordingSpeech, startRecording, stopRecording, toggleRecording } = useSpeechRecognition(onSpeechResultCallback, 1000);
const { recognitionState, startRecognition, stopRecognition, toggleRecognition } = useSpeechRecognition('webSpeechApi', onSpeechResultCallback, 1000);
// derived state
const isRinging = stage === 'ring';
@@ -136,17 +145,23 @@ export function Telephone(props: {
// pickup / hangup
React.useEffect(() => {
!isRinging && playSoundUrl(isConnected ? '/sounds/chat-begin.mp3' : '/sounds/chat-end.mp3');
!isRinging && AudioPlayer.playUrl(isConnected ? '/sounds/chat-begin.mp3' : '/sounds/chat-end.mp3');
}, [isRinging, isConnected]);
// ringtone
usePlaySoundUrl(isRinging ? '/sounds/chat-ringtone.mp3' : null, 300, 2800 * 2);
usePlayUrl(isRinging ? '/sounds/chat-ringtone.mp3' : null, 300, 2800 * 2);
/// Shortcuts
useGlobalShortcuts('Telephone', React.useMemo(() => [
{ key: 'm', ctrl: true, action: toggleRecognition },
], [toggleRecognition]));
/// CONNECTED
const handleCallStop = () => {
stopRecording();
stopRecognition(false);
setStage('ended');
};
@@ -169,9 +184,10 @@ export function Telephone(props: {
const phoneMessages = personaCallStarters || ['Hello?', 'Hey!'];
const firstMessage = phoneMessages[Math.floor(Math.random() * phoneMessages.length)];
setCallMessages([createDMessage('assistant', firstMessage)]);
setCallMessages([createDMessageTextContent('assistant', firstMessage)]); // [state] set assistant:hello message
// fire/forget
void EXPERIMENTAL_speakTextStream(firstMessage, personaVoiceId);
void elevenLabsSpeakText(firstMessage, personaVoiceId, true, true);
return () => clearInterval(interval);
}, [isConnected, personaCallStarters, personaVoiceId]);
@@ -179,22 +195,30 @@ export function Telephone(props: {
// [E] persona streaming response - upon new user message
React.useEffect(() => {
// only act when we have a new user message
if (!isConnected || callMessages.length < 1 || callMessages[callMessages.length - 1].role !== 'user')
if (!isConnected || callMessages.length < 1)
return;
switch (callMessages[callMessages.length - 1].text) {
// Voice commands
const lastUserMessage = callMessages[callMessages.length - 1];
if (lastUserMessage.role !== 'user')
return;
switch (messageFragmentsReduceText(lastUserMessage.fragments)) {
// do not respond
case 'Stop.':
return;
// command: close the call
case 'Goodbye.':
setStage('ended');
setTimeout(launchAppChat, 2000);
return;
// command: regenerate answer
case 'Retry.':
case 'Try again.':
setCallMessages(messages => messages.slice(0, messages.length - 2));
return;
// command: restart chat
case 'Restart.':
setCallMessages([]);
@@ -204,43 +228,57 @@ export function Telephone(props: {
// bail if no llm selected
if (!chatLLMId) return;
// temp fix: when the chat has no messages, only assume a single system message
const chatMessages: { role: VChatMessageIn['role'], text: string }[] = (reMessages && reMessages.length > 0)
? reMessages
: personaSystemMessage
? [{ role: 'system', text: personaSystemMessage }]
: [];
// 'prompt' for a "telephone call"
// FIXME: can easily run ouf of tokens - if this gets traction, we'll fix it
const callPrompt: VChatMessageIn[] = [
{ role: 'system', content: 'You are having a phone call. Your response style is brief and to the point, and according to your personality, defined below.' },
...chatMessages.map(message => ({ role: message.role, content: message.text })),
{ role: 'system', content: 'You are now on the phone call related to the chat above. Respect your personality and answer with short, friendly and accurate thoughtful lines.' },
...callMessages.map(message => ({ role: message.role, content: message.text })),
// Call Message Generation Prompt
const callSystemInstruction = createDMessageTextContent('system', 'You are having a phone call. Your response style is brief and to the point, and according to your personality, defined below.');
const reMessagesRemapSysToUsr = remapMessagesSysToUsr(reMessages);
const callGenerationInputHistory: DMessage[] = [
// Chat messages, including the system prompt which is casted to a user message
// TODO: when upgrading to dynamic personas, we need to inject the persona message instead - not rely on reMessages, as messages[0] !== 'system'
...(reMessagesRemapSysToUsr ? reMessagesRemapSysToUsr : [createDMessageTextContent('user', personaSystemMessage)]),
// Call system prompt 2, to indicate the call has started
createDMessageTextContent('user', '**You are now on the phone call related to the chat above**.\nRespect your personality and answer with short, friendly and accurate thoughtful brief lines.'),
// Call history
...callMessages,
];
// perform completion
responseAbortController.current = new AbortController();
let finalText = '';
let error: any | null = null;
setPersonaTextInterim('💭...');
llmStreamingChatGenerate(chatLLMId, callPrompt, 'call', callMessages[0].id, null, null, responseAbortController.current.signal, ({ textSoFar }) => {
const text = textSoFar?.trim();
if (text) {
finalText = text;
setPersonaTextInterim(text);
}
aixChatGenerateContent_DMessage_FromConversation(
chatLLMId,
callSystemInstruction,
callGenerationInputHistory,
'call',
callMessages[0].id,
{ abortSignal: responseAbortController.current.signal },
(update: AixChatGenerateContent_DMessage, _isDone: boolean) => {
const updatedText = messageFragmentsReduceText(update.fragments).trim();
if (updatedText)
setPersonaTextInterim(finalText = updatedText);
},
).then((status) => {
// whether status.outcome === 'success' or not, we get a valid DMessage, eventually with Error Fragments inside
const fullMessage = createDMessageFromFragments('assistant', status.lastDMessage.fragments);
fullMessage.generator = status.lastDMessage.generator;
setCallMessages(messages => [...messages, fullMessage]); // [state] append assistant:call_response
// fire/forget
if (status.outcome === 'success' && finalText?.length >= 1)
void elevenLabsSpeakText(finalText, personaVoiceId, true, true);
}).catch((err: DOMException) => {
if (err?.name !== 'AbortError')
error = err;
if (err?.name !== 'AbortError') {
// create an error message to explain the exception
const errorMesage = createDMessageFromFragments('assistant', [createErrorContentFragment(err.message || err.toString())]);
setCallMessages(messages => [...messages, errorMesage]); // [state] append assistant:call_response-ERROR
}
}).finally(() => {
setPersonaTextInterim(null);
if (finalText || error)
setCallMessages(messages => [...messages, createDMessage('assistant', finalText + (error ? ` (ERROR: ${error.message || error.toString()})` : ''))]);
// fire/forget
if (finalText?.length >= 1)
void EXPERIMENTAL_speakTextStream(finalText, personaVoiceId);
});
return () => {
@@ -250,7 +288,7 @@ export function Telephone(props: {
}, [isConnected, callMessages, chatLLMId, personaVoiceId, personaSystemMessage, reMessages]);
// [E] Message interrupter
const abortTrigger = isConnected && isRecordingSpeech;
const abortTrigger = isConnected && recognitionState.hasSpeech;
React.useEffect(() => {
if (abortTrigger && responseAbortController.current) {
responseAbortController.current.abort();
@@ -261,16 +299,16 @@ export function Telephone(props: {
// [E] continuous speech recognition (reload)
const shouldStartRecording = isConnected && !pushToTalk && speechInterim === null && !isRecordingAudio;
const shouldStartRecording = isConnected && !pushToTalk && speechInterim === null && !recognitionState.hasAudio;
React.useEffect(() => {
if (shouldStartRecording)
startRecording();
}, [shouldStartRecording, startRecording]);
startRecognition();
}, [shouldStartRecording, startRecognition]);
// more derived state
const personaName = persona?.title ?? 'Unknown';
const isMicEnabled = isSpeechEnabled;
const isMicEnabled = recognitionState.isAvailable;
const isTTSEnabled = true;
const isEnabled = isMicEnabled && isTTSEnabled;
@@ -284,10 +322,11 @@ export function Telephone(props: {
, [overridePersonaVoice, pushToTalk],
);
usePluggableOptimaLayout(null, chatLLMDropdown, menuItems, 'CallUI');
useSetOptimaAppMenu(menuItems, 'CallUI-Call');
return <>
<OptimaToolbarIn>{chatLLMDropdown}</OptimaToolbarIn>
<Typography
level='h1'
@@ -339,7 +378,7 @@ export function Telephone(props: {
{callMessages.map((message) =>
<CallMessage
key={message.id}
text={message.text}
text={messageFragmentsReduceText(message.fragments)}
variant={message.role === 'assistant' ? 'solid' : 'soft'}
color={message.role === 'assistant' ? 'neutral' : 'primary'}
role={message.role}
@@ -357,10 +396,10 @@ export function Telephone(props: {
)}
{/* Listening... */}
{isRecording && (
{recognitionState.isActive && (
<CallMessage
text={<>{speechInterim?.transcript.trim() || null}{speechInterim?.interimTranscript.trim() ? <i> {speechInterim.interimTranscript}</i> : null}</>}
variant={(isRecordingSpeech || !!speechInterim?.transcript) ? 'soft' : 'outlined'}
variant={(recognitionState.hasSpeech || !!speechInterim?.transcript) ? 'soft' : 'outlined'}
color='primary'
role='user'
/>
@@ -386,11 +425,11 @@ export function Telephone(props: {
{isConnected && <CallButton Icon={CallEndIcon} text='Hang up' color='danger' variant='soft' onClick={handleCallStop} />}
{isConnected && (pushToTalk ? (
<CallButton
Icon={MicIcon} onClick={toggleRecording}
text={isRecordingSpeech ? 'Listening...' : isRecording ? 'Listening' : 'Push To Talk'}
variant={isRecordingSpeech ? 'solid' : isRecording ? 'soft' : 'outlined'}
Icon={MicIcon} onClick={toggleRecognition}
text={recognitionState.hasSpeech ? 'Listening...' : recognitionState.isActive ? 'Listening' : 'Push To Talk'}
variant={recognitionState.hasSpeech ? 'solid' : recognitionState.isActive ? 'soft' : 'outlined'}
color='primary'
sx={!isRecording ? { backgroundColor: 'background.surface' } : undefined}
sx={!recognitionState.isActive ? { backgroundColor: 'background.surface' } : undefined}
/>
) : null
// <CallButton disabled={true} Icon={MicOffIcon} onClick={() => setMicMuted(muted => !muted)}
@@ -406,9 +445,9 @@ export function Telephone(props: {
{/* DEBUG state */}
{avatarClickCount > 10 && (avatarClickCount % 2 === 0) && (
<Card variant='outlined' sx={{ maxHeight: '25dvh', overflow: 'auto', whiteSpace: 'pre', py: 0, width: '100%' }}>
Special commands: Stop, Retry, Try Again, Restart, Goodbye.
{JSON.stringify({ isSpeechEnabled, isRecordingAudio, speechInterim }, null, 2)}
<Card variant='outlined' sx={{ maxHeight: '25dvh', fontSize: 'sm', overflow: 'auto', whiteSpace: 'pre', py: 0, width: '100%' }}>
Special commands: Stop, Retry, Try Again, Restart, Goodbye.<br />
{JSON.stringify({ ...recognitionState, speechInterim }, null, 2)}
</Card>
)}
+2 -2
View File
@@ -3,13 +3,13 @@ import * as React from 'react';
import { Chip, ColorPaletteProp, VariantProp } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
import type { VChatMessageIn } from '~/modules/llms/llm.client';
import type { DMessage } from '~/common/stores/chat/chat.message';
export function CallMessage(props: {
text?: string | React.JSX.Element,
variant?: VariantProp, color?: ColorPaletteProp,
role: VChatMessageIn['role'],
role: DMessage['role'],
sx?: SxProps,
}) {
const isUserMessage = props.role === 'user';
+342 -237
View File
@@ -8,40 +8,51 @@ import { DEV_MODE_SETTINGS } from '../settings-modal/UxLabsSettings';
import { DiagramConfig, DiagramsModal } from '~/modules/aifn/digrams/DiagramsModal';
import { FlattenerModal } from '~/modules/aifn/flatten/FlattenerModal';
import { TradeConfig, TradeModal } from '~/modules/trade/TradeModal';
import { downloadConversation, openAndLoadConversations } from '~/modules/trade/trade.client';
import { getChatLLMId, useChatLLM } from '~/modules/llms/store-llms';
import { imaginePromptFromText } from '~/modules/aifn/imagine/imaginePromptFromText';
import { speakText } from '~/modules/elevenlabs/elevenlabs.client';
import { downloadSingleChat, importConversationsFromFilesAtRest, openConversationsAtRestPicker } from '~/modules/trade/trade.client';
import { imaginePromptFromTextOrThrow } from '~/modules/aifn/imagine/imaginePromptFromText';
import { elevenLabsSpeakText } from '~/modules/elevenlabs/elevenlabs.client';
import { useAreBeamsOpen } from '~/modules/beam/store-beam.hooks';
import { useCapabilityTextToImage } from '~/modules/t2i/t2i.client';
import { ConfirmationModal } from '~/common/components/ConfirmationModal';
import { ConversationsManager } from '~/common/chats/ConversationsManager';
import { GlobalShortcutItem, ShortcutKeyName, useGlobalShortcuts } from '~/common/components/useGlobalShortcut';
import type { DConversation, DConversationId } from '~/common/stores/chat/chat.conversation';
import type { OptimaBarControlMethods } from '~/common/layout/optima/bar/OptimaBarDropdown';
import { ConfirmationModal } from '~/common/components/modals/ConfirmationModal';
import { ConversationsManager } from '~/common/chat-overlay/ConversationsManager';
import { LLM_IF_ANT_PromptCaching, LLM_IF_OAI_Vision } from '~/common/stores/llms/llms.types';
import { OptimaDrawerIn, OptimaToolbarIn } from '~/common/layout/optima/portals/OptimaPortalsIn';
import { PanelResizeInset } from '~/common/components/panes/GoodPanelResizeHandler';
import { PreferencesTab, useOptimaLayout, usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { Release } from '~/common/app.release';
import { ScrollToBottom } from '~/common/scroll-to-bottom/ScrollToBottom';
import { ScrollToBottomButton } from '~/common/scroll-to-bottom/ScrollToBottomButton';
import { addSnackbar, removeSnackbar } from '~/common/components/useSnackbarsStore';
import { createDMessage, DConversationId, DMessage, DMessageMetadata, getConversation, getConversationSystemPurposeId, useConversation } from '~/common/state/store-chats';
import { ShortcutKey, useGlobalShortcuts } from '~/common/components/shortcuts/useGlobalShortcuts';
import { WorkspaceIdProvider } from '~/common/stores/workspace/WorkspaceIdProvider';
import { addSnackbar, removeSnackbar } from '~/common/components/snackbar/useSnackbarsStore';
import { createDMessageFromFragments, createDMessagePlaceholderIncomplete, DMessageMetadata, duplicateDMessageMetadata } from '~/common/stores/chat/chat.message';
import { createErrorContentFragment, createTextContentFragment, DMessageAttachmentFragment, DMessageContentFragment, duplicateDMessageFragmentsNoVoid } from '~/common/stores/chat/chat.fragments';
import { gcChatImageAssets } from '~/common/stores/chat/chat.gc';
import { getChatLLMId } from '~/common/stores/llms/store-llms';
import { getConversation, getConversationSystemPurposeId, useConversation } from '~/common/stores/chat/store-chats';
import { optimaActions, optimaOpenModels, optimaOpenPreferences, useSetOptimaAppMenu } from '~/common/layout/optima/useOptima';
import { themeBgAppChatComposer } from '~/common/app.theme';
import { useFolderStore } from '~/common/state/store-folders';
import { useIsMobile } from '~/common/components/useMatchMedia';
import { useChatLLM } from '~/common/stores/llms/llms.hooks';
import { useFolderStore } from '~/common/stores/folders/store-chat-folders';
import { useIsMobile, useIsTallScreen } from '~/common/components/useMatchMedia';
import { useOverlayComponents } from '~/common/layout/overlays/useOverlayComponents';
import { useRouterQuery } from '~/common/app.routes';
import { useUIPreferencesStore } from '~/common/state/store-ui';
import { useUXLabsStore } from '~/common/state/store-ux-labs';
import type { ComposerOutputMultiPart } from './components/composer/composer.types';
import { ChatBarAltBeam } from './components/ChatBarAltBeam';
import { ChatBarAltTitle } from './components/ChatBarAltTitle';
import { ChatBarDropdowns } from './components/ChatBarDropdowns';
import { ChatPane } from './components/layout-pane/ChatPane';
import { ChatBarAltBeam } from './components/layout-bar/ChatBarAltBeam';
import { ChatBarAltTitle } from './components/layout-bar/ChatBarAltTitle';
import { ChatBarDropdowns } from './components/layout-bar/ChatBarDropdowns';
import { ChatBeamWrapper } from './components/ChatBeamWrapper';
import { ChatDrawerMemo } from './components/ChatDrawer';
import { ChatDrawerMemo } from './components/layout-drawer/ChatDrawer';
import { ChatMessageList } from './components/ChatMessageList';
import { ChatPageMenuItems } from './components/ChatPageMenuItems';
import { Composer } from './components/composer/Composer';
import { usePanesManager } from './components/panes/usePanesManager';
import type { ChatExecuteMode } from './execute-mode/execute-mode.types';
import { _handleExecute } from './editors/_handleExecute';
@@ -49,28 +60,33 @@ import { _handleExecute } from './editors/_handleExecute';
export const CHAT_NOVEL_TITLE = 'Chat';
/**
* Mode: how to treat the input from the Composer
*/
export type ChatModeId =
| 'generate-text'
| 'generate-text-beam'
| 'append-user'
| 'generate-image'
| 'generate-react';
export interface AppChatIntent {
initialConversationId: string | null;
initialConversationId?: string;
newChat?: 'voiceInput';
}
const scrollToBottomSx = {
display: 'flex',
flexDirection: 'column',
};
const chatMessageListSx: SxProps = {
flexGrow: 1,
};
const chatBeamWrapperSx: SxProps = {
flexGrow: 1,
// minHeight: 'calc(100vh - 69px - var(--AGI-Nav-width))',
};
const composerOpenSx: SxProps = {
zIndex: 21, // just to allocate a surface, and potentially have a shadow
minWidth: { md: 480 }, // don't get compresses too much on desktop
backgroundColor: themeBgAppChatComposer,
borderTop: `1px solid`,
borderTopColor: 'divider',
p: { xs: 1, md: 2 },
borderTopColor: 'rgba(var(--joy-palette-neutral-mainChannel, 99 107 116) / 0.4)',
// hack: eats the bottom of the last message (as it has a 1px divider)
mt: '-1px',
};
const composerClosedSx: SxProps = {
@@ -81,14 +97,15 @@ const composerClosedSx: SxProps = {
export function AppChat() {
// state
const { showPromisedOverlay } = useOverlayComponents();
const [isComposerMulticast, setIsComposerMulticast] = React.useState(false);
const [isMessageSelectionMode, setIsMessageSelectionMode] = React.useState(false);
const [diagramConfig, setDiagramConfig] = React.useState<DiagramConfig | null>(null);
const [tradeConfig, setTradeConfig] = React.useState<TradeConfig | null>(null);
const [clearConversationId, setClearConversationId] = React.useState<DConversationId | null>(null);
const [deleteConversationIds, setDeleteConversationIds] = React.useState<DConversationId[] | null>(null);
const [flattenConversationId, setFlattenConversationId] = React.useState<DConversationId | null>(null);
const showNextTitleChange = React.useRef(false);
const llmDropdownRef = React.useRef<OptimaBarControlMethods>(null);
const personaDropdownRef = React.useRef<OptimaBarControlMethods>(null);
const composerTextAreaRef = React.useRef<HTMLTextAreaElement>(null);
const [_activeFolderId, setActiveFolderId] = React.useState<string | null>(null);
@@ -96,13 +113,12 @@ export function AppChat() {
const theme = useTheme();
const isMobile = useIsMobile();
const isTallScreen = useIsTallScreen();
const intent = useRouterQuery<Partial<AppChatIntent>>();
const showAltTitleBar = useUXLabsStore(state => DEV_MODE_SETTINGS && state.labsChatBarAlt === 'title');
const { openLlmOptions, openModelsSetup, openPreferencesTab } = useOptimaLayout();
const { chatLLM } = useChatLLM();
const {
@@ -118,19 +134,23 @@ export function AppChat() {
setFocusedPaneIndex,
} = usePanesManager();
const chatHandlers = React.useMemo(() => chatPanes.map(pane => {
return pane.conversationId ? ConversationsManager.getHandler(pane.conversationId) : null;
}), [chatPanes]);
const { paneUniqueConversationIds, paneHandlers, paneBeamStores } = React.useMemo(() => {
const paneConversationIds: (DConversationId | null)[] = chatPanes.map(pane => pane.conversationId || null);
const paneHandlers = paneConversationIds.map(cId => cId ? ConversationsManager.getHandler(cId) : null);
const paneBeamStores = paneHandlers.map(handler => handler?.getBeamStore() ?? null);
const paneUniqueConversationIds = Array.from(new Set(paneConversationIds.filter(Boolean))) as DConversationId[];
return {
paneHandlers: paneHandlers,
paneBeamStores: paneBeamStores,
paneUniqueConversationIds: paneUniqueConversationIds,
};
}, [chatPanes]);
const beamsStores = React.useMemo(() => chatHandlers.map(handler => {
return handler?.getBeamStore() ?? null;
}), [chatHandlers]);
const beamsOpens = useAreBeamsOpen(beamsStores);
const beamsOpens = useAreBeamsOpen(paneBeamStores);
const beamOpenStoreInFocusedPane = React.useMemo(() => {
const open = focusedPaneIndex !== null ? (beamsOpens?.[focusedPaneIndex] ?? false) : false;
return open ? beamsStores?.[focusedPaneIndex!] ?? null : null;
}, [beamsOpens, beamsStores, focusedPaneIndex]);
return open ? paneBeamStores?.[focusedPaneIndex!] ?? null : null;
}, [beamsOpens, focusedPaneIndex, paneBeamStores]);
const {
// focused
@@ -147,14 +167,16 @@ export function AppChat() {
deleteConversations,
} = useConversation(focusedPaneConversationId);
// this will be used for the side panel
// const focusedConversationWorkspaceId = workspaceForConversationIdentity(focusedPaneConversationId);
//// const focusedConversationWorkspace = useWorkspaceIdForConversation(focusedPaneConversationId);
const { mayWork: capabilityHasT2I } = useCapabilityTextToImage();
const { activeFolderId } = useFolderStore(({ enableFolders, folders }) => {
const activeFolderId = useFolderStore(({ enableFolders, folders }) => {
const activeFolderId = enableFolders ? _activeFolderId : null;
const activeFolder = activeFolderId ? folders.find(folder => folder.id === activeFolderId) : null;
return {
activeFolderId: activeFolder?.id ?? null,
};
return activeFolder?.id ?? null;
});
@@ -162,7 +184,7 @@ export function AppChat() {
const isMultiPane = chatPanes.length >= 2;
const isMultiAddable = chatPanes.length < 4;
const isMultiConversationId = isMultiPane && new Set(chatPanes.map((pane) => pane.conversationId)).size >= 2;
const isMultiConversationId = paneUniqueConversationIds.length >= 2;
const willMulticast = isComposerMulticast && isMultiConversationId;
const disableNewButton = isFocusedChatEmpty && !isMultiPane;
@@ -179,124 +201,125 @@ export function AppChat() {
showNextTitleChange.current = true;
}, [navigateHistoryInFocusedPane]);
// [effect] Handle the initial conversation intent
React.useEffect(() => {
intent.initialConversationId && handleOpenConversationInFocusedPane(intent.initialConversationId);
}, [handleOpenConversationInFocusedPane, intent.initialConversationId]);
// [effect] Show snackbar with the focused chat title after a history navigation in focused pane
React.useEffect(() => {
if (showNextTitleChange.current) {
showNextTitleChange.current = false;
const title = (focusedChatNumber >= 0 ? `#${focusedChatNumber + 1} · ` : '') + (focusedChatTitle || 'New Chat');
const id = addSnackbar({ key: 'focused-title', message: title, type: 'title' });
return () => removeSnackbar(id);
}
}, [focusedChatNumber, focusedChatTitle]);
// Execution
const handleExecuteAndOutcome = React.useCallback(async (chatModeId: ChatModeId, conversationId: DConversationId, history: DMessage[]) => {
const outcome = await _handleExecute(chatModeId, conversationId, history);
const handleExecuteAndOutcome = React.useCallback(async (chatExecuteMode: ChatExecuteMode, conversationId: DConversationId, callerNameDebug: string) => {
const outcome = await _handleExecute(chatExecuteMode, conversationId, callerNameDebug);
if (outcome === 'err-no-chatllm')
openModelsSetup();
optimaOpenModels();
else if (outcome === 'err-t2i-unconfigured')
openPreferencesTab(PreferencesTab.Draw);
optimaOpenPreferences('draw');
else if (outcome === 'err-no-persona')
addSnackbar({ key: 'chat-no-persona', message: 'No persona selected.', type: 'issue' });
else if (outcome === 'err-no-conversation')
addSnackbar({ key: 'chat-no-conversation', message: 'No active conversation.', type: 'issue' });
else if (outcome === 'err-no-last-message')
addSnackbar({ key: 'chat-no-conversation', message: 'No conversation history.', type: 'issue' });
return outcome === true;
}, [openModelsSetup, openPreferencesTab]);
}, []);
const handleComposerAction = React.useCallback((conversationId: DConversationId, chatModeId: ChatModeId, multiPartMessage: ComposerOutputMultiPart, metadata?: DMessageMetadata): boolean => {
// validate inputs
if (multiPartMessage.length !== 1 || multiPartMessage[0].type !== 'text-block') {
addSnackbar({
key: 'chat-composer-action-invalid',
message: 'Only a single text part is supported for now.',
type: 'issue',
overrides: {
autoHideDuration: 2000,
},
});
const handleComposerAction = React.useCallback((conversationId: DConversationId, chatExecuteMode: ChatExecuteMode, fragments: (DMessageContentFragment | DMessageAttachmentFragment)[], metadata?: DMessageMetadata): boolean => {
// [multicast] send the message to all the panes
const uniqueConversationIds = willMulticast
? Array.from(new Set([conversationId, ...paneUniqueConversationIds]))
: [conversationId];
// validate conversation existence
const uniqueConverations = uniqueConversationIds.map(cId => getConversation(cId)).filter(Boolean) as DConversation[];
if (!uniqueConverations.length)
return false;
}
const userText = multiPartMessage[0].text;
// multicast: send the message to all the panes
const uniqueConversationIds = new Set([conversationId]);
if (willMulticast)
chatPanes.forEach(pane => pane.conversationId && uniqueConversationIds.add(pane.conversationId));
// we loop to handle both the normal and multicast modes
let enqueuedAny = false;
for (const _cId of uniqueConversationIds) {
const history = getConversation(_cId)?.messages;
if (!history) continue;
for (const conversation of uniqueConverations) {
const newUserMessage = createDMessage('user', userText);
if (metadata) newUserMessage.metadata = metadata;
// create the user:message
// NOTE: this can lead to multiple chat messages with data refs that are referring to the same dblobs,
// however, we already got transferred ownership of the dblobs at this point.
const userMessage = createDMessageFromFragments('user', duplicateDMessageFragmentsNoVoid(fragments)); // [chat] create user:message to send per-chat
if (metadata) userMessage.metadata = duplicateDMessageMetadata(metadata);
ConversationsManager.getHandler(conversation.id).messageAppend(userMessage); // [chat] append user message in each conversation
// fire/forget
void handleExecuteAndOutcome(chatModeId, _cId, [...history, newUserMessage]);
enqueuedAny = true;
void handleExecuteAndOutcome(chatExecuteMode /* various */, conversation.id, 'chat-composer-action'); // append user message, then '*-*'
}
return enqueuedAny;
}, [chatPanes, handleExecuteAndOutcome, willMulticast]);
const handleConversationExecuteHistory = React.useCallback(async (conversationId: DConversationId, history: DMessage[]) => {
await handleExecuteAndOutcome('generate-text', conversationId, history);
return true;
}, [paneUniqueConversationIds, handleExecuteAndOutcome, willMulticast]);
const handleConversationExecuteHistory = React.useCallback(async (conversationId: DConversationId) => {
await handleExecuteAndOutcome('generate-content', conversationId, 'chat-execute-history'); // replace with 'history', then 'generate-content'
}, [handleExecuteAndOutcome]);
const handleMessageRegenerateLastInFocusedPane = React.useCallback(async () => {
const focusedConversation = getConversation(focusedPaneConversationId);
if (focusedConversation?.messages?.length) {
const lastMessage = focusedConversation.messages[focusedConversation.messages.length - 1];
const history = lastMessage.role === 'assistant' ? focusedConversation.messages.slice(0, -1) : [...focusedConversation.messages];
await handleExecuteAndOutcome('generate-text', focusedConversation.id, history);
}
// Ctrl + Shift + Z
if (!focusedPaneConversationId) return;
const cHandler = ConversationsManager.getHandler(focusedPaneConversationId);
if (!cHandler.isValid()) return;
const inputHistory = cHandler.historyViewHeadOrThrow('chat-regenerate-shortcut');
if (!inputHistory.length) return;
// remove the last message if assistant's
const lastMessage = inputHistory[inputHistory.length - 1];
if (lastMessage.role === 'assistant')
cHandler.historyTruncateTo(lastMessage.id, -1);
// generate: NOTE: this will replace the system message correctly
await handleExecuteAndOutcome('generate-content', focusedPaneConversationId, 'chat-regenerate-last'); // truncate if assistant, then gen-text
}, [focusedPaneConversationId, handleExecuteAndOutcome]);
const handleMessageBeamLastInFocusedPane = React.useCallback(async () => {
// Ctrl + Shift + B
const focusedConversation = getConversation(focusedPaneConversationId);
if (focusedConversation?.messages?.length) {
const lastMessage = focusedConversation.messages[focusedConversation.messages.length - 1];
if (lastMessage.role === 'assistant')
ConversationsManager.getHandler(focusedConversation.id).beamInvoke(focusedConversation.messages.slice(0, -1), [lastMessage], lastMessage.id);
else if (lastMessage.role === 'user')
ConversationsManager.getHandler(focusedConversation.id).beamInvoke(focusedConversation.messages, [], null);
}
if (!focusedPaneConversationId) return;
const cHandler = ConversationsManager.getHandler(focusedPaneConversationId);
if (!cHandler.isValid()) return;
const inputHistory = cHandler.historyViewHeadOrThrow('chat-beam-shortcut');
if (!inputHistory.length) return;
// TODO: replace the Persona and Auto-Cache-hint in the history?
// replace the prompt in history
const lastMessage = inputHistory[inputHistory.length - 1];
if (lastMessage.role === 'assistant')
cHandler.beamInvoke(inputHistory.slice(0, -1), [lastMessage], lastMessage.id);
else if (lastMessage.role === 'user')
cHandler.beamInvoke(inputHistory, [], null);
}, [focusedPaneConversationId]);
const handleTextDiagram = React.useCallback((diagramConfig: DiagramConfig | null) => setDiagramConfig(diagramConfig), []);
const handleTextImagine = React.useCallback(async (conversationId: DConversationId, messageText: string) => {
const conversation = getConversation(conversationId);
if (!conversation)
return;
const imaginedPrompt = await imaginePromptFromText(messageText, conversationId) || 'An error sign.';
await handleExecuteAndOutcome('generate-image', conversationId, [
...conversation.messages,
createDMessage('user', imaginedPrompt),
]);
const handleImagineFromText = React.useCallback(async (conversationId: DConversationId, subjectText: string) => {
const cHandler = ConversationsManager.getHandler(conversationId);
if (!cHandler.isValid()) return;
const userImagineMessage = createDMessagePlaceholderIncomplete('user', `Thinking at the subject...`); // [chat] append user:imagine prompt
cHandler.messageAppend(userImagineMessage);
await imaginePromptFromTextOrThrow(subjectText, conversationId)
.then(imaginedPrompt => {
// Replace the placeholder with the message to draw, then execute the draw
cHandler.messageFragmentReplace(userImagineMessage.id, userImagineMessage.fragments[0].fId, createTextContentFragment(imaginedPrompt), true);
return handleExecuteAndOutcome('generate-image', conversationId, 'chat-imagine-from-text'); // append message for 'imagine', then generate-image
})
.catch((error: any) => {
// Replace the placeholder with the error message
cHandler.messageFragmentReplace(userImagineMessage.id, userImagineMessage.fragments[0].fId, createErrorContentFragment(`Issue requesting an Image prompt. ${error?.message || ''}`), true);
});
}, [handleExecuteAndOutcome]);
const handleTextSpeak = React.useCallback(async (text: string): Promise<void> => {
await speakText(text);
await elevenLabsSpeakText(text, undefined, true, true);
}, []);
// Chat actions
const handleConversationNewInFocusedPane = React.useCallback((forceNoRecycle?: boolean) => {
const handleConversationNewInFocusedPane = React.useCallback((forceNoRecycle: boolean, isIncognito: boolean) => {
// create conversation (or recycle the existing top-of-stack empty conversation)
const conversationId = (recycleNewConversationId && !forceNoRecycle)
const conversationId = (recycleNewConversationId && !forceNoRecycle && !isIncognito)
? recycleNewConversationId
: prependNewConversation(getConversationSystemPurposeId(focusedPaneConversationId) ?? undefined);
: prependNewConversation(getConversationSystemPurposeId(focusedPaneConversationId) ?? undefined, isIncognito);
// switch the focused pane to the new conversation
handleOpenConversationInFocusedPane(conversationId);
@@ -316,23 +339,30 @@ export function AppChat() {
setTradeConfig({ dir: 'export', conversationId, exportAll });
}, []);
const handleFileOpenConversation = React.useCallback(() => {
openAndLoadConversations(true)
.then((outcome) => {
// activate the last (most recent) imported conversation
if (outcome?.activateConversationId) {
showNextTitleChange.current = true;
handleOpenConversationInFocusedPane(outcome.activateConversationId);
}
})
.catch(() => {
addSnackbar({ key: 'chat-import-fail', message: 'Could not open the file.', type: 'issue' });
});
}, [handleOpenConversationInFocusedPane]);
const handleConversationsImportFromFiles = React.useCallback(
(files: File[] | null): Promise<void> =>
importConversationsFromFilesAtRest(files, true)
.then((outcome) => {
// activate the last (most recent) imported conversation
if (outcome.activateConversationId) {
showNextTitleChange.current = true;
handleOpenConversationInFocusedPane(outcome.activateConversationId);
}
})
.catch(() => {
addSnackbar({ key: 'chat-import-fail', message: 'Could not open file.', type: 'issue' });
}),
[handleOpenConversationInFocusedPane],
);
const handleConversationsImportFormFilePicker = React.useCallback(
() => openConversationsAtRestPicker().then(handleConversationsImportFromFiles),
[handleConversationsImportFromFiles],
);
const handleFileSaveConversation = React.useCallback((conversationId: DConversationId | null) => {
const conversation = getConversation(conversationId);
conversation && downloadConversation(conversation, 'json')
conversation && downloadSingleChat(conversation, 'json')
.then(() => {
addSnackbar({ key: 'chat-save-as-ok', message: 'File saved.', type: 'success' });
})
@@ -342,7 +372,7 @@ export function AppChat() {
});
}, []);
const handleConversationBranch = React.useCallback((srcConversationId: DConversationId, messageId: string | null): DConversationId | null => {
const handleConversationBranch = React.useCallback((srcConversationId: DConversationId, messageId: string | null, addSplitPane: boolean): DConversationId | null => {
// clone data
const branchedConversationId = branchConversation(srcConversationId, messageId);
@@ -352,28 +382,39 @@ export function AppChat() {
// replace/open a new pane with this
showNextTitleChange.current = true;
if (!isMultiAddable)
handleOpenConversationInFocusedPane(branchedConversationId);
else
if (addSplitPane && isMultiAddable)
handleOpenConversationInSplitPane(branchedConversationId);
else
handleOpenConversationInFocusedPane(branchedConversationId);
return branchedConversationId;
}, [activeFolderId, branchConversation, handleOpenConversationInFocusedPane, handleOpenConversationInSplitPane, isMultiAddable]);
const handleConversationFlatten = React.useCallback((conversationId: DConversationId) => setFlattenConversationId(conversationId), []);
const handleConfirmedClearConversation = React.useCallback(() => {
if (clearConversationId) {
ConversationsManager.getHandler(clearConversationId).messagesReplace([]);
setClearConversationId(null);
const handleConversationReset = React.useCallback(async (conversationId: DConversationId) => {
if (await showPromisedOverlay('chat-reset-confirmation', { rejectWithValue: false }, ({ onResolve, onUserReject }) =>
<ConfirmationModal
open onClose={onUserReject} onPositive={() => onResolve(true)}
confirmationText='This will clear all messages while keeping the current chat settings, model, and persona. Do you want to continue?'
positiveActionText='Restart Chat'
title='Restart Chat'
/>,
)) {
ConversationsManager.getHandler(conversationId).historyClear();
}
}, [clearConversationId]);
}, [showPromisedOverlay]);
const handleConversationClear = React.useCallback((conversationId: DConversationId) => setClearConversationId(conversationId), []);
const handleDeleteConversations = React.useCallback(async (conversationIds: DConversationId[], bypassConfirmation: boolean) => {
const handleDeleteConversations = React.useCallback((conversationIds: DConversationId[], bypassConfirmation: boolean) => {
if (!bypassConfirmation)
return setDeleteConversationIds(conversationIds);
// show confirmation dialog
if (!bypassConfirmation && !await showPromisedOverlay('chat-delete-confirmation', { rejectWithValue: false }, ({ onResolve, onUserReject }) =>
<ConfirmationModal
open onClose={onUserReject} onPositive={() => onResolve(true)}
confirmationText={`Are you absolutely sure you want to delete ${conversationIds.length === 1 ? 'this conversation' : 'these conversations'}? This action cannot be undone.`}
positiveActionText={conversationIds.length === 1 ? 'Delete conversation' : `Yes, delete all ${conversationIds.length} conversations`}
/>,
)) return;
// perform deletion, and return the next (or a new) conversation
const nextConversationId = deleteConversations(conversationIds, /*focusedSystemPurposeId ??*/ undefined);
@@ -381,40 +422,9 @@ export function AppChat() {
// switch the focused pane to the new conversation - NOTE: this makes the assumption that deletion had impact on the focused pane
handleOpenConversationInFocusedPane(nextConversationId);
setDeleteConversationIds(null);
}, [deleteConversations, handleOpenConversationInFocusedPane]);
const handleConfirmedDeleteConversations = React.useCallback(() => {
!!deleteConversationIds?.length && handleDeleteConversations(deleteConversationIds, true);
}, [deleteConversationIds, handleDeleteConversations]);
// Shortcuts
const handleOpenChatLlmOptions = React.useCallback(() => {
const chatLLMId = getChatLLMId();
if (!chatLLMId) return;
openLlmOptions(chatLLMId);
}, [openLlmOptions]);
const shortcuts = React.useMemo((): GlobalShortcutItem[] => [
// focused conversation
['b', true, true, false, handleMessageBeamLastInFocusedPane],
['r', true, true, false, handleMessageRegenerateLastInFocusedPane],
['n', true, false, true, handleConversationNewInFocusedPane],
['o', true, false, false, handleFileOpenConversation],
['s', true, false, false, () => handleFileSaveConversation(focusedPaneConversationId)],
['b', true, false, true, () => isFocusedChatEmpty || (focusedPaneConversationId && handleConversationBranch(focusedPaneConversationId, null))],
['x', true, false, true, () => isFocusedChatEmpty || (focusedPaneConversationId && handleConversationClear(focusedPaneConversationId))],
['d', true, false, true, () => focusedPaneConversationId && handleDeleteConversations([focusedPaneConversationId], false)],
[ShortcutKeyName.Left, true, false, true, () => handleNavigateHistoryInFocusedPane('back')],
[ShortcutKeyName.Right, true, false, true, () => handleNavigateHistoryInFocusedPane('forward')],
// global
['o', true, true, false, handleOpenChatLlmOptions],
['+', true, true, false, useUIPreferencesStore.getState().increaseContentScaling],
['-', true, true, false, useUIPreferencesStore.getState().decreaseContentScaling],
], [focusedPaneConversationId, handleConversationBranch, handleConversationClear, handleConversationNewInFocusedPane, handleFileOpenConversation, handleFileSaveConversation, handleDeleteConversations, handleMessageBeamLastInFocusedPane, handleMessageRegenerateLastInFocusedPane, handleNavigateHistoryInFocusedPane, handleOpenChatLlmOptions, isFocusedChatEmpty]);
useGlobalShortcuts(shortcuts);
// run GC for dblobs in this conversation
void gcChatImageAssets(); // fire/forget
}, [showPromisedOverlay, deleteConversations, handleOpenConversationInFocusedPane]);
// Pluggable Optima components
@@ -424,17 +434,21 @@ export function AppChat() {
const focusedBarContent = React.useMemo(() => beamOpenStoreInFocusedPane
? <ChatBarAltBeam beamStore={beamOpenStoreInFocusedPane} isMobile={isMobile} />
: (barAltTitle === null)
? <ChatBarDropdowns conversationId={focusedPaneConversationId} />
? <ChatBarDropdowns conversationId={focusedPaneConversationId} llmDropdownRef={llmDropdownRef} personaDropdownRef={personaDropdownRef} />
: <ChatBarAltTitle conversationId={focusedPaneConversationId} conversationTitle={barAltTitle} />
, [barAltTitle, beamOpenStoreInFocusedPane, focusedPaneConversationId, isMobile],
);
const drawerContent = React.useMemo(() =>
// Disabled by default, as it lags the opening of the drawer and immediatly vanishes during the closing animation
const isDrawerOpen = true; // useOptimaDrawerOpen();
const drawerContent = React.useMemo(() => !isDrawerOpen ? null :
<ChatDrawerMemo
isMobile={isMobile}
// isMobile={isMobile /* expensive as it undoes the memo; not passed anymore */}
activeConversationId={focusedPaneConversationId}
activeFolderId={activeFolderId}
chatPanesConversationIds={chatPanes.map(pane => pane.conversationId).filter(Boolean) as DConversationId[]}
chatPanesConversationIds={paneUniqueConversationIds}
disableNewButton={disableNewButton}
onConversationActivate={handleOpenConversationInFocusedPane}
onConversationBranch={handleConversationBranch}
@@ -444,45 +458,145 @@ export function AppChat() {
onConversationsImportDialog={handleConversationImportDialog}
setActiveFolderId={setActiveFolderId}
/>,
[activeFolderId, chatPanes, disableNewButton, focusedPaneConversationId, handleConversationBranch, handleConversationExport, handleConversationImportDialog, handleConversationNewInFocusedPane, handleDeleteConversations, handleOpenConversationInFocusedPane, isMobile],
[activeFolderId, disableNewButton, focusedPaneConversationId, handleConversationBranch, handleConversationExport, handleConversationImportDialog, handleConversationNewInFocusedPane, handleDeleteConversations, handleOpenConversationInFocusedPane, isDrawerOpen, paneUniqueConversationIds],
);
const focusedMenuItems = React.useMemo(() =>
<ChatPageMenuItems
isMobile={isMobile}
<ChatPane
conversationId={focusedPaneConversationId}
disableItems={!focusedPaneConversationId || isFocusedChatEmpty}
hasConversations={hasConversations}
isMessageSelectionMode={isMessageSelectionMode}
isVerticalSplit={isMobile || isTallScreen}
onConversationBranch={handleConversationBranch}
onConversationClear={handleConversationClear}
onConversationClear={handleConversationReset}
onConversationFlatten={handleConversationFlatten}
// onConversationNew={handleConversationNewInFocusedPane}
setIsMessageSelectionMode={setIsMessageSelectionMode}
/>,
[focusedPaneConversationId, handleConversationBranch, handleConversationClear, handleConversationFlatten, hasConversations, isFocusedChatEmpty, isMessageSelectionMode, isMobile],
[focusedPaneConversationId, handleConversationBranch, handleConversationFlatten, handleConversationReset, hasConversations, isFocusedChatEmpty, isMessageSelectionMode, isMobile, isTallScreen],
);
usePluggableOptimaLayout(drawerContent, focusedBarContent, focusedMenuItems, 'AppChat');
useSetOptimaAppMenu(focusedMenuItems, 'AppChat');
// Effects
// [effect] Handle the conversation intent
React.useEffect(() => {
// Debug: open a null chat
if (Release.IsNodeDevBuild && intent.initialConversationId === 'null')
openConversationInFocusedPane(null! /* for debugging purporse */);
// Open the initial conversation if set
else if (intent.initialConversationId)
openConversationInFocusedPane(intent.initialConversationId);
// Create a new chat if requested
else if (intent.newChat !== undefined)
handleConversationNewInFocusedPane(false, false);
}, [handleConversationNewInFocusedPane, intent.initialConversationId, intent.newChat, openConversationInFocusedPane]);
// [effect] Show snackbar with the focused chat title after a history navigation in focused pane
React.useEffect(() => {
if (showNextTitleChange.current) {
showNextTitleChange.current = false;
const title = (focusedChatNumber >= 0 ? `#${focusedChatNumber + 1} · ` : '') + (focusedChatTitle || 'New Chat');
const id = addSnackbar({ key: 'focused-title', message: title, type: 'center-title' });
return () => removeSnackbar(id);
}
}, [focusedChatNumber, focusedChatTitle]);
// Shortcuts
const handleOpenChatLlmOptions = React.useCallback(() => {
const chatLLMId = getChatLLMId();
if (!chatLLMId) return;
optimaActions().openModelOptions(chatLLMId);
}, []);
const handleMoveFocus = React.useCallback((direction: number, wholeList?: boolean) => {
// find the parent list
let messageListElement: HTMLElement | null;
let withinBeam = false;
const activeElement = document.activeElement as HTMLElement;
if (activeElement) {
messageListElement = document.querySelector('[role=beam-list]') as HTMLElement;
if (!messageListElement)
messageListElement = activeElement.closest('[role=chat-messages-list]') as HTMLElement;
else
withinBeam = true;
} else
messageListElement = document.querySelector('[role=chat-messages-list]') as HTMLElement;
if (!messageListElement) return;
// find the scrollable container and if we're at the bottom
const scrollContainer = messageListElement.closest('[role=scrollable]') as HTMLElement;
if (!scrollContainer) return;
const isAtBottom = Math.abs(scrollContainer.scrollHeight - scrollContainer.scrollTop - scrollContainer.clientHeight) < 1;
// determine the current message and next index
const messageElements = Array.from(messageListElement.querySelectorAll(withinBeam ? '[role=beam-card]' : '[role=chat-message]')) as HTMLElement[];
const currentIndex = messageElements.findIndex(el => el.contains(activeElement));
// if going down and we're at/past the last message, scroll to bottom
const snapToBottom = direction > 0 && (wholeList || (currentIndex === -1 || currentIndex >= messageElements.length - 1));
const nextIndex = (wholeList && direction < 0) ? 0
: snapToBottom ? messageElements.length - 1
: (isAtBottom && direction < 0) ? currentIndex
: currentIndex === -1 ? (direction < 0 ? 0 : messageElements.length - 1)
: currentIndex + direction;
if (nextIndex < 0 || nextIndex >= messageElements.length) return;
// perform the smooth scroll and focus
const targetElement = messageElements[nextIndex];
targetElement.focus({ preventScroll: true, focusVisible: true } as FocusOptions);
targetElement.scrollIntoView({ behavior: 'smooth', block: snapToBottom ? 'end' : 'start' });
}, []);
useGlobalShortcuts('AppChat', React.useMemo(() => [
// focused conversation
{ key: 'z', ctrl: true, shift: true, disabled: isFocusedChatEmpty, action: handleMessageRegenerateLastInFocusedPane, description: 'Retry' },
{ key: 'b', ctrl: true, shift: true, disabled: isFocusedChatEmpty, action: handleMessageBeamLastInFocusedPane, description: 'Beam Edit' },
{ key: 'o', ctrl: true, action: handleConversationsImportFormFilePicker },
{ key: 's', ctrl: true, action: () => handleFileSaveConversation(focusedPaneConversationId) },
{ key: 'n', ctrl: true, shift: true, action: () => handleConversationNewInFocusedPane(false, false) },
{ key: 'x', ctrl: true, shift: true, action: () => isFocusedChatEmpty || (focusedPaneConversationId && handleConversationReset(focusedPaneConversationId)) },
{ key: 'd', ctrl: true, shift: true, action: () => focusedPaneConversationId && handleDeleteConversations([focusedPaneConversationId], false) },
{ key: '[', ctrl: true, action: () => handleNavigateHistoryInFocusedPane('back') },
{ key: ']', ctrl: true, action: () => handleNavigateHistoryInFocusedPane('forward') },
// change active message (in any possible panel)
{ key: ShortcutKey.Up, ctrl: true, action: () => handleMoveFocus(-1) },
{ key: ShortcutKey.Down, ctrl: true, action: () => handleMoveFocus(1) },
{ key: ShortcutKey.Up, ctrl: true, shift: true, action: () => handleMoveFocus(-1, true) },
{ key: ShortcutKey.Down, ctrl: true, shift: true, action: () => handleMoveFocus(1, true) },
// open the dropdowns
{ key: 'l', ctrl: true, action: () => llmDropdownRef.current?.openListbox() /*, description: 'Open Models Dropdown'*/ },
{ key: 'p', ctrl: true, action: () => personaDropdownRef.current?.openListbox() /*, description: 'Open Persona Dropdown'*/ },
// focused conversation llm
{ key: 'o', ctrl: true, shift: true, action: handleOpenChatLlmOptions },
], [focusedPaneConversationId, handleConversationNewInFocusedPane, handleConversationReset, handleConversationsImportFormFilePicker, handleDeleteConversations, handleFileSaveConversation, handleMessageBeamLastInFocusedPane, handleMessageRegenerateLastInFocusedPane, handleMoveFocus, handleNavigateHistoryInFocusedPane, handleOpenChatLlmOptions, isFocusedChatEmpty]));
return <>
<OptimaDrawerIn>{drawerContent}</OptimaDrawerIn>
<OptimaToolbarIn>{focusedBarContent}</OptimaToolbarIn>
<PanelGroup
direction={isMobile ? 'vertical' : 'horizontal'}
direction={(isMobile || isTallScreen) ? 'vertical' : 'horizontal'}
id='app-chat-panels'
>
{chatPanes.map((pane, idx) => {
const _paneIsFocused = idx === focusedPaneIndex;
const _paneConversationId = pane.conversationId;
const _paneChatHandler = chatHandlers[idx] ?? null;
const _paneBeamStore = beamsStores[idx] ?? null;
const _paneBeamIsOpen = !!beamsOpens?.[idx] && !!_paneBeamStore;
const _paneChatHandler = paneHandlers[idx] ?? null;
const _paneIsIncognito = _paneChatHandler?.isIncognito() ?? false;
const _paneBeamStoreApi = paneBeamStores[idx] ?? null;
const _paneBeamIsOpen = !!beamsOpens?.[idx] && !!_paneBeamStoreApi;
const _panesCount = chatPanes.length;
const _keyAndId = `chat-pane-${pane.paneId}`;
const _sepId = `sep-pane-${idx}`;
return <React.Fragment key={_keyAndId}>
return <WorkspaceIdProvider conversationId={_paneIsFocused ? _paneConversationId : null} key={_keyAndId}>
<Panel
id={_keyAndId}
@@ -520,13 +634,17 @@ export function AppChat() {
// it was optional before: https://github.com/bvaughn/react-resizable-panels/issues/241
pointerEvents: 'auto',
}),
...((_paneIsIncognito && {
backgroundColor: theme.palette.background.level3,
})),
}}
>
<ScrollToBottom
bootToBottom
stickToBottomInitial
sx={{ display: 'flex', flexDirection: 'column' }}
disableAutoStick={isMobile && _paneBeamIsOpen}
sx={scrollToBottomSx}
>
{!_paneBeamIsOpen && (
@@ -534,29 +652,28 @@ export function AppChat() {
conversationId={_paneConversationId}
conversationHandler={_paneChatHandler}
capabilityHasT2I={capabilityHasT2I}
chatLLMAntPromptCaching={chatLLM?.interfaces?.includes(LLM_IF_ANT_PromptCaching) ?? false}
chatLLMContextTokens={chatLLM?.contextTokens ?? null}
chatLLMSupportsImages={chatLLM?.interfaces?.includes(LLM_IF_OAI_Vision) ?? false}
fitScreen={isMobile || isMultiPane}
isMobile={isMobile}
isMessageSelectionMode={isMessageSelectionMode}
setIsMessageSelectionMode={setIsMessageSelectionMode}
onConversationBranch={handleConversationBranch}
onConversationExecuteHistory={handleConversationExecuteHistory}
onConversationNew={handleConversationNewInFocusedPane}
onTextDiagram={handleTextDiagram}
onTextImagine={handleTextImagine}
onTextImagine={handleImagineFromText}
onTextSpeak={handleTextSpeak}
sx={{
flexGrow: 1,
}}
sx={chatMessageListSx}
/>
)}
{_paneBeamIsOpen && (
<ChatBeamWrapper
beamStore={_paneBeamStore}
beamStore={_paneBeamStoreApi}
isMobile={isMobile}
inlineSx={{
flexGrow: 1,
// minHeight: 'calc(100vh - 69px - var(--AGI-Nav-width))',
}}
inlineSx={chatBeamWrapperSx}
/>
)}
@@ -574,7 +691,7 @@ export function AppChat() {
</PanelResizeHandle>
)}
</React.Fragment>;
</WorkspaceIdProvider>;
})}
</PanelGroup>
@@ -583,18 +700,24 @@ export function AppChat() {
isMobile={isMobile}
chatLLM={chatLLM}
composerTextAreaRef={composerTextAreaRef}
conversationId={focusedPaneConversationId}
targetConversationId={focusedPaneConversationId}
capabilityHasT2I={capabilityHasT2I}
isMulticast={!isMultiConversationId ? null : isComposerMulticast}
isDeveloperMode={isFocusedChatDeveloper}
onAction={handleComposerAction}
onTextImagine={handleTextImagine}
onConversationsImportFromFiles={handleConversationsImportFromFiles}
onTextImagine={handleImagineFromText}
setIsMulticast={setIsComposerMulticast}
sx={beamOpenStoreInFocusedPane ? composerClosedSx : composerOpenSx}
/>
{/* Diagrams */}
{!!diagramConfig && <DiagramsModal config={diagramConfig} onClose={() => setDiagramConfig(null)} />}
{!!diagramConfig && (
<DiagramsModal
config={diagramConfig}
onClose={() => setDiagramConfig(null)}
/>
)}
{/* Flatten */}
{!!flattenConversationId && (
@@ -614,23 +737,5 @@ export function AppChat() {
/>
)}
{/* [confirmation] Reset Conversation */}
{!!clearConversationId && (
<ConfirmationModal
open onClose={() => setClearConversationId(null)} onPositive={handleConfirmedClearConversation}
confirmationText='Are you sure you want to discard all messages?'
positiveActionText='Clear conversation'
/>
)}
{/* [confirmation] Delete All */}
{!!deleteConversationIds?.length && (
<ConfirmationModal
open onClose={() => setDeleteConversationIds(null)} onPositive={handleConfirmedDeleteConversations}
confirmationText={`Are you absolutely sure you want to delete ${deleteConversationIds.length === 1 ? 'this conversation' : 'these conversations'}? This action cannot be undone.`}
positiveActionText={deleteConversationIds.length === 1 ? 'Delete conversation' : `Yes, delete all ${deleteConversationIds.length} conversations`}
/>
)}
</>;
}
+3 -3
View File
@@ -3,18 +3,18 @@ import ClearIcon from '@mui/icons-material/Clear';
import type { ICommandsProvider } from './ICommandsProvider';
export const CommandsAlter: ICommandsProvider = {
id: 'chat-alter',
id: 'cmd-chat-alter',
rank: 25,
getCommands: () => [{
primary: '/assistant',
alternatives: ['/a'],
arguments: ['text'],
arguments: ['text...'],
description: 'Injects assistant response',
}, {
primary: '/system',
alternatives: ['/s'],
arguments: ['text'],
arguments: ['text...'],
description: 'Injects system message',
}, {
primary: '/clear',
-16
View File
@@ -1,16 +0,0 @@
import { ChatBeamIcon } from '~/common/components/icons/ChatBeamIcon';
import type { ICommandsProvider } from './ICommandsProvider';
export const CommandsBeam: ICommandsProvider = {
id: 'mode-beam',
rank: 9,
getCommands: () => [{
primary: '/beam',
arguments: ['prompt'],
description: 'Combine the smarts of models',
Icon: ChatBeamIcon,
}],
};
-16
View File
@@ -1,16 +0,0 @@
import LanguageIcon from '@mui/icons-material/Language';
import type { ICommandsProvider } from './ICommandsProvider';
export const CommandsBrowse: ICommandsProvider = {
id: 'ass-browse',
rank: 20,
getCommands: () => [{
primary: '/browse',
arguments: ['URL'],
description: 'Assistant will download the web page',
Icon: LanguageIcon,
}],
};
+5 -1
View File
@@ -2,8 +2,12 @@ import FormatPaintTwoToneIcon from '@mui/icons-material/FormatPaintTwoTone';
import type { ICommandsProvider } from './ICommandsProvider';
export function textToDrawCommand(text: string): string {
return `/draw ${text}`;
}
export const CommandsDraw: ICommandsProvider = {
id: 'ass-t2i',
id: 'cmd-ass-t2i',
rank: 10,
getCommands: () => [{
+1 -1
View File
@@ -3,7 +3,7 @@ import PsychologyIcon from '@mui/icons-material/Psychology';
import type { ICommandsProvider } from './ICommandsProvider';
export const CommandsReact: ICommandsProvider = {
id: 'ass-react',
id: 'cmd-mode-react',
rank: 15,
getCommands: () => [{
+17 -15
View File
@@ -1,27 +1,23 @@
import { ChatCommand, ICommandsProvider } from './ICommandsProvider';
import type { ChatCommand, ICommandsProvider } from './ICommandsProvider';
import { CommandsAlter } from './CommandsAlter';
import { CommandsBeam } from './CommandsBeam';
import { CommandsBrowse } from './CommandsBrowse';
import { CommandsDraw } from './CommandsDraw';
import { CommandsHelp } from './CommandsHelp';
import { CommandsReact } from './CommandsReact';
export type CommandsProviderId = 'ass-browse' | 'ass-t2i' | 'ass-react' | 'chat-alter' | 'cmd-help' | 'mode-beam';
export type CommandsProviderId = 'cmd-ass-t2i' | 'cmd-chat-alter' | 'cmd-help' | 'cmd-mode-react';
type TextCommandPiece =
| { type: 'text'; value: string; }
| { type: 'cmd'; providerId: CommandsProviderId, command: string; params?: string, isError?: boolean };
| { type: 'nocmd'; value: string; }
| { type: 'cmd'; providerId: CommandsProviderId, command: string; params?: string, isErrorNoArgs?: boolean };
const ChatCommandsProviders: Record<CommandsProviderId, ICommandsProvider> = {
'ass-browse': CommandsBrowse,
'ass-react': CommandsReact,
'ass-t2i': CommandsDraw,
'chat-alter': CommandsAlter,
'cmd-ass-t2i': CommandsDraw,
'cmd-chat-alter': CommandsAlter,
'cmd-help': CommandsHelp,
'mode-beam': CommandsBeam,
'cmd-mode-react': CommandsReact,
};
export function findAllChatCommands(): ChatCommand[] {
@@ -31,12 +27,18 @@ export function findAllChatCommands(): ChatCommand[] {
.flat();
}
export function helpPrettyChatCommands() {
return findAllChatCommands()
.map(cmd => ` - ${cmd.primary}` + (cmd.alternatives?.length ? ` (${cmd.alternatives.join(', ')})` : '') + `: ${cmd.description}`)
.join('\n');
}
export function extractChatCommand(input: string): TextCommandPiece[] {
const inputTrimmed = input.trim();
// quick exit: command does not start with '/'
if (!inputTrimmed.startsWith('/'))
return [{ type: 'text', value: input }];
return [{ type: 'nocmd', value: input }];
// Find the first space to separate the command from its parameters (if any)
const firstSpaceIndex = inputTrimmed.indexOf(' ');
@@ -56,7 +58,7 @@ export function extractChatCommand(input: string): TextCommandPiece[] {
providerId: provider.id,
command: potentialCommand,
params: textAfterCommand || undefined,
isError: !textAfterCommand || undefined,
isErrorNoArgs: !textAfterCommand,
}];
// command without arguments, treat any text after as a separate text piece
@@ -67,7 +69,7 @@ export function extractChatCommand(input: string): TextCommandPiece[] {
params: undefined,
}];
textAfterCommand && pieces.push({
type: 'text',
type: 'nocmd',
value: textAfterCommand,
});
return pieces;
@@ -77,7 +79,7 @@ export function extractChatCommand(input: string): TextCommandPiece[] {
// No command found, return the entire input as text
return [{
type: 'text',
type: 'nocmd',
value: input,
}];
}
+205 -126
View File
@@ -4,25 +4,34 @@ import { useShallow } from 'zustand/react/shallow';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, List } from '@mui/joy';
import type { SystemPurposeExample } from '../../../data';
import type { DiagramConfig } from '~/modules/aifn/digrams/DiagramsModal';
import type { ConversationHandler } from '~/common/chats/ConversationHandler';
import { InlineError } from '~/common/components/InlineError';
import { PreferencesTab, useOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { ShortcutKeyName, useGlobalShortcut } from '~/common/components/useGlobalShortcut';
import { createDMessage, DConversationId, DMessage, DMessageUserFlag, getConversation, messageToggleUserFlag, useChatStore } from '~/common/state/store-chats';
import type { ConversationHandler } from '~/common/chat-overlay/ConversationHandler';
import { DConversationId, excludeSystemMessages } from '~/common/stores/chat/chat.conversation';
import { ShortcutKey, useGlobalShortcuts } from '~/common/components/shortcuts/useGlobalShortcuts';
import { convertFilesToDAttachmentFragments } from '~/common/attachment-drafts/attachment.pipeline';
import { createDMessageFromFragments, createDMessageTextContent, DMessage, DMessageId, DMessageUserFlag, DMetaReferenceItem, MESSAGE_FLAG_AIX_SKIP } from '~/common/stores/chat/chat.message';
import { createTextContentFragment, DMessageFragment, DMessageFragmentId } from '~/common/stores/chat/chat.fragments';
import { openFileForAttaching } from '~/common/components/ButtonAttachFiles';
import { optimaOpenPreferences } from '~/common/layout/optima/useOptima';
import { useBrowserTranslationWarning } from '~/common/components/useIsBrowserTranslating';
import { useCapabilityElevenLabs } from '~/common/components/useCapabilities';
import { useEphemerals } from '~/common/chats/EphemeralsStore';
import { useChatOverlayStore } from '~/common/chat-overlay/store-perchat_vanilla';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { useScrollToBottom } from '~/common/scroll-to-bottom/useScrollToBottom';
import { CMLZeroConversation } from './messages-list/CMLZeroConversation';
import { ChatMessage, ChatMessageMemo } from './message/ChatMessage';
import { CleanerMessage, MessagesSelectionHeader } from './message/CleanerMessage';
import { Ephemerals } from './Ephemerals';
import { PersonaSelector } from './persona-selector/PersonaSelector';
import { useChatShowSystemMessages } from '../store-app-chat';
import { useChatAutoSuggestHTMLUI, useChatShowSystemMessages } from '../store-app-chat';
const stableNoMessages: DMessage[] = [];
/**
* A list of ChatMessages
*/
@@ -30,11 +39,15 @@ export function ChatMessageList(props: {
conversationId: DConversationId | null,
conversationHandler: ConversationHandler | null,
capabilityHasT2I: boolean,
chatLLMAntPromptCaching: boolean,
chatLLMContextTokens: number | null,
chatLLMSupportsImages: boolean,
fitScreen: boolean,
isMobile: boolean,
isMessageSelectionMode: boolean,
onConversationBranch: (conversationId: DConversationId, messageId: string) => void,
onConversationExecuteHistory: (conversationId: DConversationId, history: DMessage[]) => Promise<void>,
onConversationBranch: (conversationId: DConversationId, messageId: string, addSplitPane: boolean) => void,
onConversationExecuteHistory: (conversationId: DConversationId) => Promise<void>,
onConversationNew: (forceNoRecycle: boolean, isIncognito: boolean) => void,
onTextDiagram: (diagramConfig: DiagramConfig | null) => void,
onTextImagine: (conversationId: DConversationId, selectedText: string) => Promise<void>,
onTextSpeak: (selectedText: string) => Promise<void>,
@@ -49,118 +62,163 @@ export function ChatMessageList(props: {
// external state
const { notifyBooting } = useScrollToBottom();
const { openPreferencesTab } = useOptimaLayout();
const danger_experimentalHtmlWebUi = useChatAutoSuggestHTMLUI();
const [showSystemMessages] = useChatShowSystemMessages();
const optionalTranslationWarning = useBrowserTranslationWarning();
const { conversationMessages, historyTokenCount, editMessage, deleteMessage, setMessages } = useChatStore(useShallow(state => {
const conversation = state.conversations.find(conversation => conversation.id === props.conversationId);
const { conversationMessages, historyTokenCount } = useChatStore(useShallow(({ conversations }) => {
const conversation = conversations.find(conversation => conversation.id === props.conversationId);
return {
conversationMessages: conversation ? conversation.messages : [],
conversationMessages: conversation ? conversation.messages : stableNoMessages,
historyTokenCount: conversation ? conversation.tokenCount : 0,
deleteMessage: state.deleteMessage,
editMessage: state.editMessage,
setMessages: state.setMessages,
};
}));
const ephemerals = useEphemerals(props.conversationHandler);
const { _composerInReferenceToCount, ephemerals } = useChatOverlayStore(props.conversationHandler?.conversationOverlayStore ?? null, useShallow(state => ({
_composerInReferenceToCount: state.inReferenceTo?.length ?? 0,
ephemerals: state.ephemerals?.length ? state.ephemerals : null,
})));
const { mayWork: isSpeakable } = useCapabilityElevenLabs();
// derived state
const { conversationId, capabilityHasT2I, onConversationBranch, onConversationExecuteHistory, onTextDiagram, onTextImagine, onTextSpeak } = props;
const { conversationHandler, conversationId, capabilityHasT2I, onConversationBranch, onConversationExecuteHistory, onTextDiagram, onTextImagine, onTextSpeak } = props;
const composerCanAddInReferenceTo = _composerInReferenceToCount < 5;
const composerHasInReferenceto = _composerInReferenceToCount > 0;
// text actions
const handleRunExample = React.useCallback(async (examplePrompt: string) => {
conversationId && await onConversationExecuteHistory(conversationId, [...conversationMessages, createDMessage('user', examplePrompt)]);
}, [conversationId, conversationMessages, onConversationExecuteHistory]);
const handleRunExample = React.useCallback(async (example: SystemPurposeExample) => {
if (!conversationId || !conversationHandler) return;
// Simple Example Prompt (User text message)
if (typeof example === 'string') {
conversationHandler.messageAppend(createDMessageTextContent('user', example)); // [chat] append user:persona question
await onConversationExecuteHistory(conversationId);
return;
}
// User-Action Example Prompts (User text message + File attachments)
switch (example.action) {
case 'require-data-attachment':
await openFileForAttaching(true, async (filesWithHandle) => {
// Retrieve fully-fledged Attachment Fragments (converted/extracted, with sources, mimes, etc.) from the selected files
const attachmentFragments = await convertFilesToDAttachmentFragments('file-open', filesWithHandle, {
hintAddImages: props.chatLLMSupportsImages,
});
// Create a User message with the prompt and the attachment fragments
if (attachmentFragments.length) {
conversationHandler.messageAppend(createDMessageFromFragments('user', [ // [chat] append user:persona question + attachment(s)
createTextContentFragment(example.prompt),
...attachmentFragments,
]));
await onConversationExecuteHistory(conversationId);
}
});
break;
}
}, [conversationHandler, conversationId, onConversationExecuteHistory, props.chatLLMSupportsImages]);
const handleMessageContinue = React.useCallback(async (_messageId: DMessageId /* Ignored for now */) => {
if (conversationId && conversationHandler) {
conversationHandler.messageAppend(createDMessageTextContent('user', 'Continue')); // [chat] append user:Continue
await onConversationExecuteHistory(conversationId);
}
}, [conversationHandler, conversationId, onConversationExecuteHistory]);
// message menu methods proxy
const handleMessageAssistantFrom = React.useCallback(async (messageId: string, offset: number) => {
const messages = getConversation(conversationId)?.messages;
if (messages) {
const truncatedHistory = messages.slice(0, messages.findIndex(m => m.id === messageId) + offset + 1);
conversationId && await onConversationExecuteHistory(conversationId, truncatedHistory);
const handleMessageAssistantFrom = React.useCallback(async (messageId: DMessageId, offset: number) => {
if (conversationId && conversationHandler) {
conversationHandler.historyTruncateTo(messageId, offset);
await onConversationExecuteHistory(conversationId);
}
}, [conversationId, onConversationExecuteHistory]);
}, [conversationHandler, conversationId, onConversationExecuteHistory]);
const handleMessageBeam = React.useCallback(async (messageId: string) => {
// Right-click menu Beam
if (!conversationId || !props.conversationHandler) return;
const messages = getConversation(conversationId)?.messages;
if (messages?.length) {
const truncatedHistory = messages.slice(0, messages.findIndex(m => m.id === messageId) + 1);
const lastMessage = truncatedHistory[truncatedHistory.length - 1];
if (lastMessage) {
// assistant: do an in-place beam
if (lastMessage.role === 'assistant') {
if (truncatedHistory.length >= 2)
props.conversationHandler.beamInvoke(truncatedHistory.slice(0, -1), [lastMessage], lastMessage.id);
} else {
// user: truncate and append (but if the next message is an assistant message, import it)
const nextMessage = messages[truncatedHistory.length];
if (nextMessage?.role === 'assistant')
props.conversationHandler.beamInvoke(truncatedHistory, [nextMessage], null);
else
props.conversationHandler.beamInvoke(truncatedHistory, [], null);
}
}
const handleMessageBeam = React.useCallback(async (messageId: DMessageId) => {
// Message option menu Beam
if (!conversationId || !props.conversationHandler || !props.conversationHandler.isValid()) return;
const inputHistory = props.conversationHandler.historyViewHeadOrThrow('chat-beam-message');
if (!inputHistory.length) return;
// TODO: replace the Persona and Auto-Cache-hint in the history?
// truncate the history to the given message (may or may not have more after)
const truncatedHistory = inputHistory.slice(0, inputHistory.findIndex(m => m.id === messageId) + 1);
const lastTruncatedMessage = truncatedHistory[truncatedHistory.length - 1];
if (!lastTruncatedMessage) return;
// assistant: do an in-place beam
if (lastTruncatedMessage.role === 'assistant') {
if (truncatedHistory.length >= 2)
props.conversationHandler.beamInvoke(truncatedHistory.slice(0, -1), [lastTruncatedMessage], lastTruncatedMessage.id);
} else if (lastTruncatedMessage.role === 'user') {
// user: truncate and append (but if the next message is an assistant message, import it)
const possibleNextMessage = inputHistory[truncatedHistory.length];
if (possibleNextMessage?.role === 'assistant')
props.conversationHandler.beamInvoke(truncatedHistory, [possibleNextMessage], null);
else
props.conversationHandler.beamInvoke(truncatedHistory, [], null);
}
}, [conversationId, props.conversationHandler]);
const handleMessageBranch = React.useCallback((messageId: string) => {
conversationId && onConversationBranch(conversationId, messageId);
const handleMessageBranch = React.useCallback((messageId: DMessageId) => {
conversationId && onConversationBranch(conversationId, messageId, true);
}, [conversationId, onConversationBranch]);
const handleMessageTruncate = React.useCallback((messageId: string) => {
const messages = getConversation(conversationId)?.messages;
if (conversationId && messages) {
const truncatedHistory = messages.slice(0, messages.findIndex(m => m.id === messageId) + 1);
setMessages(conversationId, truncatedHistory);
}
}, [conversationId, setMessages]);
const handleMessageDelete = React.useCallback((messageId: string) => {
conversationId && deleteMessage(conversationId, messageId);
}, [conversationId, deleteMessage]);
const handleMessageEdit = React.useCallback((messageId: string, newText: string) => {
conversationId && editMessage(conversationId, messageId, { text: newText }, true);
}, [conversationId, editMessage]);
const handleMessageToggleUserFlag = React.useCallback((messageId: string, userFlag: DMessageUserFlag) => {
conversationId && editMessage(conversationId, messageId, (message) => ({
userFlags: messageToggleUserFlag(message, userFlag),
}), false);
}, [conversationId, editMessage]);
const handleReplyTo = React.useCallback((_messageId: string, text: string) => {
props.conversationHandler?.getOverlayStore().getState().setReplyToText(text);
const handleMessageTruncate = React.useCallback((messageId: DMessageId) => {
props.conversationHandler?.historyTruncateTo(messageId, 0);
}, [props.conversationHandler]);
const handleTextDiagram = React.useCallback(async (messageId: string, text: string) => {
const handleMessageDelete = React.useCallback((messageId: DMessageId) => {
props.conversationHandler?.messagesDelete([messageId]);
}, [props.conversationHandler]);
const handleMessageAppendFragment = React.useCallback((messageId: DMessageId, fragment: DMessageFragment) => {
props.conversationHandler?.messageFragmentAppend(messageId, fragment, false, false);
}, [props.conversationHandler]);
const handleMessageDeleteFragment = React.useCallback((messageId: DMessageId, fragmentId: DMessageFragmentId) => {
props.conversationHandler?.messageFragmentDelete(messageId, fragmentId, false, true);
}, [props.conversationHandler]);
const handleMessageReplaceFragment = React.useCallback((messageId: DMessageId, fragmentId: DMessageFragmentId, newFragment: DMessageFragment) => {
props.conversationHandler?.messageFragmentReplace(messageId, fragmentId, newFragment, false);
}, [props.conversationHandler]);
const handleMessageToggleUserFlag = React.useCallback((messageId: DMessageId, userFlag: DMessageUserFlag, _maxPerConversation?: number) => {
props.conversationHandler?.messageToggleUserFlag(messageId, userFlag, true /* touch */);
// Note: we don't support 'maxPerConversation' yet, which is supposed to turn off the flag from the beginning if it's too numerous
// if (_maxPerConversation) {
// ...
// }
}, [props.conversationHandler]);
const handleAddInReferenceTo = React.useCallback((item: DMetaReferenceItem) => {
props.conversationHandler?.overlayActions.addInReferenceTo(item);
}, [props.conversationHandler]);
const handleTextDiagram = React.useCallback(async (messageId: DMessageId, text: string) => {
conversationId && onTextDiagram({ conversationId: conversationId, messageId, text });
}, [conversationId, onTextDiagram]);
const handleTextImagine = React.useCallback(async (text: string) => {
if (!capabilityHasT2I)
return openPreferencesTab(PreferencesTab.Draw);
return optimaOpenPreferences('draw');
if (conversationId) {
setIsImagining(true);
await onTextImagine(conversationId, text);
setIsImagining(false);
}
}, [capabilityHasT2I, conversationId, onTextImagine, openPreferencesTab]);
}, [capabilityHasT2I, conversationId, onTextImagine]);
const handleTextSpeak = React.useCallback(async (text: string) => {
if (!isSpeakable)
return openPreferencesTab(PreferencesTab.Voice);
return optimaOpenPreferences('voice');
setIsSpeaking(true);
await onTextSpeak(text);
setIsSpeaking(false);
}, [isSpeakable, onTextSpeak, openPreferencesTab]);
}, [isSpeakable, onTextSpeak]);
// operate on the local selection set
@@ -173,36 +231,43 @@ export function ChatMessageList(props: {
setSelectedMessages(newSelected);
};
const handleSelectMessage = (messageId: string, selected: boolean) => {
const handleSelectMessage = (messageId: DMessageId, selected: boolean) => {
const newSelected = new Set(selectedMessages);
selected ? newSelected.add(messageId) : newSelected.delete(messageId);
setSelectedMessages(newSelected);
};
const handleSelectionDelete = () => {
if (conversationId)
for (const selectedMessage of selectedMessages)
deleteMessage(conversationId, selectedMessage);
const handleSelectionDelete = React.useCallback(() => {
props.conversationHandler?.messagesDelete(Array.from(selectedMessages));
setSelectedMessages(new Set());
};
}, [props.conversationHandler, selectedMessages]);
useGlobalShortcut(props.isMessageSelectionMode && ShortcutKeyName.Esc, false, false, false, () => {
props.setIsMessageSelectionMode(false);
});
const handleSelectionHide = React.useCallback(() => {
for (let selectedMessage of Array.from(selectedMessages))
props.conversationHandler?.messageSetUserFlag(selectedMessage, MESSAGE_FLAG_AIX_SKIP, true, true);
setSelectedMessages(new Set());
}, [props.conversationHandler, selectedMessages]);
const { isMessageSelectionMode, setIsMessageSelectionMode } = props;
useGlobalShortcuts('ChatMessageList_Selection', React.useMemo(() => !isMessageSelectionMode ? [] : [
{ key: ShortcutKey.Esc, action: () => setIsMessageSelectionMode(false), description: 'Close Cleanup', level: 10 - 1 },
], [isMessageSelectionMode, setIsMessageSelectionMode]));
// text-diff functionality: only diff the last message and when it's complete (not typing), and they're similar in size
// text-diff functionality: only diff the last complete message, and they're similar in size
const { diffTargetMessage, diffPrevText } = React.useMemo(() => {
const [msgB, msgA] = conversationMessages.filter(m => m.role === 'assistant').reverse();
if (msgB?.text && msgA?.text && !msgB?.typing) {
const textA = msgA.text, textB = msgB.text;
const lenA = textA.length, lenB = textB.length;
if (lenA > 80 && lenB > 80 && lenA > lenB / 3 && lenB > lenA / 3)
return { diffTargetMessage: msgB, diffPrevText: textA };
}
return { diffTargetMessage: undefined, diffPrevText: undefined };
}, [conversationMessages]);
// const { diffTargetMessage, diffPrevText } = React.useMemo(() => {
// const [msgB, msgA] = conversationMessages.filter(m => m.role === 'assistant').reverse();
// const textB = msgB ? singleTextOrThrow(msgB) : undefined;
// const textA = msgA ? singleTextOrThrow(msgA) : undefined;
// if (textB && textA && !msgB?.pendingIncomplete) {
// const lenA = textA.length, lenB = textB.length;
// if (lenA > 80 && lenB > 80 && lenA > lenB / 3 && lenB > lenA / 3)
// return { diffTargetMessage: msgB, diffPrevText: textA };
// }
// return { diffTargetMessage: undefined, diffPrevText: undefined };
// }, [conversationMessages]);
// scroll to the very bottom of a new chat
@@ -212,33 +277,39 @@ export function ChatMessageList(props: {
}, [conversationId, notifyBooting]);
// style memo
const listSx: SxProps = React.useMemo(() => ({
p: 0,
...props.sx,
// fix for the double-border on the last message (one by the composer, one to the bottom of the message)
// marginBottom: '-1px',
// layout
display: 'flex',
flexDirection: 'column',
}), [props.sx]);
// no conversation: sine qua non
if (!conversationId)
return <CMLZeroConversation onConversationNew={props.onConversationNew} />;
// no content: show the persona selector
const filteredMessages = conversationMessages
.filter(m => m.role !== 'system' || showSystemMessages); // hide the System message if the user choses to
const filteredMessages = excludeSystemMessages(conversationMessages, showSystemMessages);
if (!filteredMessages.length)
return (
<Box sx={{ ...props.sx }}>
{conversationId
? <PersonaSelector conversationId={conversationId} runExample={handleRunExample} />
: <InlineError severity='info' error='Select a conversation' sx={{ m: 2 }} />}
<PersonaSelector conversationId={conversationId} isMobile={props.isMobile} runExample={handleRunExample} />
</Box>
);
return (
<List sx={{
p: 0,
...(props.sx || {}),
// fix for the double-border on the last message (one by the composer, one to the bottom of the message)
// marginBottom: '-1px',
// layout
display: 'flex',
flexDirection: 'column',
}}>
<List role='chat-messages-list' sx={listSx}>
{optionalTranslationWarning}
@@ -249,13 +320,14 @@ export function ChatMessageList(props: {
onClose={() => props.setIsMessageSelectionMode(false)}
onSelectAll={handleSelectAll}
onDeleteMessages={handleSelectionDelete}
onHideMessages={handleSelectionHide}
/>
)}
{filteredMessages.map((message, idx, { length: count }) => {
{filteredMessages.map((message, idx) => {
// Optimization: if the component is going to change (e.g. the message is typing), we don't want to memoize it to not throw garbage in memory
const ChatMessageMemoOrNot = message.typing ? ChatMessage : ChatMessageMemo;
// Optimization: only memo complete components, or we'd be memoizing garbage
const ChatMessageMemoOrNot = !message.pendingIncomplete ? ChatMessageMemo : ChatMessage;
return props.isMessageSelectionMode ? (
@@ -271,19 +343,26 @@ export function ChatMessageList(props: {
<ChatMessageMemoOrNot
key={'msg-' + message.id}
message={message}
diffPreviousText={message === diffTargetMessage ? diffPrevText : undefined}
// diffPreviousText={message === diffTargetMessage ? diffPrevText : undefined}
fitScreen={props.fitScreen}
isBottom={idx === count - 1}
hasInReferenceTo={composerHasInReferenceto}
isMobile={props.isMobile}
isBottom={idx === filteredMessages.length - 1}
isImagining={isImagining}
isSpeaking={isSpeaking}
showAntPromptCaching={props.chatLLMAntPromptCaching}
showUnsafeHtmlCode={danger_experimentalHtmlWebUi}
onAddInReferenceTo={!composerCanAddInReferenceTo ? undefined : handleAddInReferenceTo}
onMessageAssistantFrom={handleMessageAssistantFrom}
onMessageBeam={handleMessageBeam}
onMessageBranch={handleMessageBranch}
onMessageContinue={handleMessageContinue}
onMessageDelete={handleMessageDelete}
onMessageEdit={handleMessageEdit}
onMessageFragmentAppend={handleMessageAppendFragment}
onMessageFragmentDelete={handleMessageDeleteFragment}
onMessageFragmentReplace={handleMessageReplaceFragment}
onMessageToggleUserFlag={handleMessageToggleUserFlag}
onMessageTruncate={handleMessageTruncate}
// onReplyTo={handleReplyTo}
onTextDiagram={handleTextDiagram}
onTextImagine={capabilityHasT2I ? handleTextImagine : undefined}
onTextSpeak={isSpeakable ? handleTextSpeak : undefined}
@@ -293,14 +372,14 @@ export function ChatMessageList(props: {
},
)}
{!!ephemerals.length && (
{/* Render ephemerals (sidebar ReAct output widgets) at the bottom */}
{!!ephemerals?.length && !!conversationHandler && (
<Ephemerals
ephemerals={ephemerals}
conversationId={props.conversationId}
conversationHandler={conversationHandler}
sx={{
mt: 'auto',
overflowY: 'auto',
minHeight: 64,
}}
/>
)}
@@ -1,151 +0,0 @@
import * as React from 'react';
import { Box, IconButton, ListDivider, ListItemDecorator, MenuItem, Switch, Tooltip } from '@mui/joy';
import AddIcon from '@mui/icons-material/Add';
import CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';
import CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';
import ClearIcon from '@mui/icons-material/Clear';
import CompressIcon from '@mui/icons-material/Compress';
import ForkRightIcon from '@mui/icons-material/ForkRight';
import HorizontalSplitIcon from '@mui/icons-material/HorizontalSplit';
import HorizontalSplitOutlinedIcon from '@mui/icons-material/HorizontalSplitOutlined';
import SettingsSuggestOutlinedIcon from '@mui/icons-material/SettingsSuggestOutlined';
import VerticalSplitIcon from '@mui/icons-material/VerticalSplit';
import VerticalSplitOutlinedIcon from '@mui/icons-material/VerticalSplitOutlined';
import type { DConversationId } from '~/common/state/store-chats';
import { KeyStroke } from '~/common/components/KeyStroke';
import { useOptimaDrawers } from '~/common/layout/optima/useOptimaDrawers';
import { useChatShowSystemMessages } from '../store-app-chat';
import { usePaneDuplicateOrClose } from './panes/usePanesManager';
export function ChatPageMenuItems(props: {
isMobile: boolean,
conversationId: DConversationId | null,
disableItems: boolean,
hasConversations: boolean,
isMessageSelectionMode: boolean,
onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void,
onConversationClear: (conversationId: DConversationId) => void,
onConversationFlatten: (conversationId: DConversationId) => void,
// onConversationNew: (forceNoRecycle: boolean) => void,
setIsMessageSelectionMode: (isMessageSelectionMode: boolean) => void,
}) {
// external state
const { closePageMenu } = useOptimaDrawers();
const { canAddPane, isMultiPane, duplicateFocusedPane, removeOtherPanes } = usePaneDuplicateOrClose();
const [showSystemMessages, setShowSystemMessages] = useChatShowSystemMessages();
const handleIncreaseMultiPane = React.useCallback((event?: React.MouseEvent) => {
event?.stopPropagation();
// create a new pane with the current conversation
duplicateFocusedPane();
// load a brand new conversation inside
// FIXME: still testing this
// props.onConversationNew(true);
}, [duplicateFocusedPane]);
const handleToggleMultiPane = React.useCallback((_event: React.MouseEvent) => {
if (isMultiPane)
removeOtherPanes();
else
handleIncreaseMultiPane(undefined);
}, [handleIncreaseMultiPane, isMultiPane, removeOtherPanes]);
const closeMenu = (event: React.MouseEvent) => {
event.stopPropagation();
closePageMenu();
};
const handleConversationClear = (event: React.MouseEvent<HTMLDivElement>) => {
closeMenu(event);
props.conversationId && props.onConversationClear(props.conversationId);
};
const handleConversationBranch = (event: React.MouseEvent<HTMLDivElement>) => {
closeMenu(event);
props.conversationId && props.onConversationBranch(props.conversationId, null);
};
const handleConversationFlatten = (event: React.MouseEvent<HTMLDivElement>) => {
closeMenu(event);
props.conversationId && props.onConversationFlatten(props.conversationId);
};
const handleToggleMessageSelectionMode = (event: React.MouseEvent) => {
closeMenu(event);
props.setIsMessageSelectionMode(!props.isMessageSelectionMode);
};
const handleToggleSystemMessages = () => setShowSystemMessages(!showSystemMessages);
return <>
{/* System Message(s) */}
<MenuItem onClick={handleToggleSystemMessages}>
<ListItemDecorator><SettingsSuggestOutlinedIcon /></ListItemDecorator>
System messages
<Switch checked={showSystemMessages} onChange={handleToggleSystemMessages} sx={{ ml: 'auto' }} />
</MenuItem>
{/* Un /Split */}
<MenuItem onClick={handleToggleMultiPane}>
<ListItemDecorator>{props.isMobile
? (isMultiPane ? <HorizontalSplitIcon /> : <HorizontalSplitOutlinedIcon />)
: (isMultiPane ? <VerticalSplitIcon /> : <VerticalSplitOutlinedIcon />)
}</ListItemDecorator>
{/* Unsplit / Split text*/}
{isMultiPane ? 'Unsplit' : props.isMobile ? 'Split Down' : 'Split Right'}
{/* '+' */}
{isMultiPane && (
<Tooltip title='Add Another Split'>
<IconButton
size='sm'
variant='outlined'
disabled={!canAddPane}
onClick={handleIncreaseMultiPane}
sx={{ ml: 'auto', /*mr: '2px',*/ my: '-0.25rem' /* absorb the menuItem padding */ }}
>
<AddIcon />
</IconButton>
</Tooltip>
)}
</MenuItem>
<MenuItem disabled={props.disableItems} onClick={handleConversationBranch}>
<ListItemDecorator><ForkRightIcon /></ListItemDecorator>
Branch
</MenuItem>
<ListDivider />
<MenuItem disabled={props.disableItems} onClick={handleToggleMessageSelectionMode} sx={props.isMessageSelectionMode ? { fontWeight: 'lg' } : {}}>
<ListItemDecorator>{props.isMessageSelectionMode ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />}</ListItemDecorator>
Cleanup ...
</MenuItem>
<MenuItem disabled={props.disableItems} onClick={handleConversationFlatten}>
<ListItemDecorator><CompressIcon color='success' /></ListItemDecorator>
Compress ...
</MenuItem>
<ListDivider />
<MenuItem disabled={props.disableItems} onClick={handleConversationClear}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
<Box sx={{ flexGrow: 1, display: 'flex', justifyContent: 'space-between', gap: 1 }}>
Reset Chat
{!props.disableItems && <KeyStroke combo='Ctrl + Alt + X' />}
</Box>
</MenuItem>
</>;
}
+168 -87
View File
@@ -1,14 +1,22 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, Grid, IconButton, Sheet, styled, Typography } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import MaximizeIcon from '@mui/icons-material/Maximize';
import MinimizeIcon from '@mui/icons-material/Minimize';
import VerticalSplitIcon from '@mui/icons-material/VerticalSplit';
import VerticalSplitOutlinedIcon from '@mui/icons-material/VerticalSplitOutlined';
import { ConversationsManager } from '~/common/chats/ConversationsManager';
import { DConversationId } from '~/common/state/store-chats';
import { DEphemeral } from '~/common/chats/EphemeralsStore';
import { lineHeightChatTextMd } from '~/common/app.theme';
import { ScaledTextBlockRenderer } from '~/modules/blocks/ScaledTextBlockRenderer';
import type { DEphemeral } from '~/common/chat-overlay/store-perchat-ephemerals_slice';
import { ConversationHandler } from '~/common/chat-overlay/ConversationHandler';
import { adjustContentScaling, ContentScaling, lineHeightChatTextMd } from '~/common/app.theme';
import { useUIPreferencesStore } from '~/common/state/store-ui';
// State Pane
const StateLine = styled(Typography)(({ theme }) => ({
textOverflow: 'ellipsis',
@@ -46,8 +54,7 @@ function ObjectRenderer({ name }: { name: string }) {
return <StateLine><b>{name}</b>: <i>object not displayed</i></StateLine>;
}
function StateRenderer(props: { state: object }) {
function StateRenderer(props: { state: object, contentScaling: ContentScaling }) {
if (typeof props.state !== 'object')
return <pre>Developer Warning: state is not an object: {JSON.stringify(props.state, null, 2)}</pre>;
@@ -55,10 +62,17 @@ function StateRenderer(props: { state: object }) {
return (
<Box>
<Typography fontSize='smaller' sx={{ mb: 1 }}>
## Internal State
</Typography>
<Sheet sx={{ p: 1 }}>
<ScaledTextBlockRenderer
text='**Internal State**'
contentScaling={props.contentScaling}
textRenderVariant='markdown'
/>
<Box sx={{
mt: 1,
p: 1,
borderRadius: 'md',
background: 'linear-gradient(180deg, var(--joy-palette-success-softHoverBg), transparent)',
}}>
{!entries && <Typography level='body-sm'>No state variables</Typography>}
{entries.map(([key, value]) =>
isPrimitive(value)
@@ -69,97 +83,164 @@ function StateRenderer(props: { state: object }) {
? <ObjectRenderer key={'state-' + key} name={key} />
: <Typography key={'state-' + key} level='body-sm'>{key}: {value}</Typography>,
)}
</Sheet>
</Box>
</Box>
);
}
function EphemeralItem({ conversationId, ephemeral }: { conversationId: string, ephemeral: DEphemeral }) {
const leftPaneSx = {
// <pre> looks
overflowWrap: 'anywhere',
whiteSpace: 'break-spaces',
// 'undo' some of the github-markdown CSS customizations
'.markdown-body': { mx: '0!important' },
'.markdown-body p': { mb: 0 },
};
const rightPaneSx = {
borderLeft: { md: `1px dashed` },
borderTop: { xs: `1px dashed`, md: 'none' },
};
function EphemeralItem(props: {
ephemeral: DEphemeral,
conversationHandler: ConversationHandler,
contentScaling: ContentScaling,
}) {
const { ephemeral, conversationHandler } = props;
// Event handlers
const handleDelete = React.useCallback(() => {
ConversationsManager.getHandler(conversationId).ephemeralsStore.delete(ephemeral.id);
}, [conversationId, ephemeral.id]);
conversationHandler.overlayActions.ephemeralsDelete(ephemeral.id);
}, [conversationHandler, ephemeral.id]);
return <Box
sx={{
p: { xs: 1, md: 2 },
position: 'relative',
// border: (i < ephemerals.length - 1) ? `2px solid ${theme.palette.divider}` : undefined,
'&:hover > button': { opacity: 1 },
}}>
const handleToggleMinimized = React.useCallback(() => {
conversationHandler.overlayActions.ephemeralsToggleMinimized(ephemeral.id);
}, [conversationHandler, ephemeral.id]);
{/* Title */}
{ephemeral.title && <Typography level='title-sm' sx={{ mb: 1.5 }}>
{ephemeral.title} Development Tools
</Typography>}
{/* Vertical | split */}
<Grid container spacing={2}>
{/* Left pane (console) */}
<Grid xs={12} md={ephemeral.state ? 6 : 12}>
<Typography fontSize='smaller' sx={{ overflowWrap: 'anywhere', whiteSpace: 'break-spaces', lineHeight: lineHeightChatTextMd }}>
{ephemeral.text}
</Typography>
</Grid>
{/* Right pane (state) */}
{!!ephemeral.state && <Grid
xs={12} md={6}
sx={{
borderLeft: { md: `1px dashed` },
borderTop: { xs: `1px dashed`, md: 'none' },
}}>
<StateRenderer state={ephemeral.state} />
</Grid>}
</Grid>
{/* Close button (right of title) */}
<IconButton
size='sm'
onClick={handleDelete}
sx={{
position: 'absolute', top: 8, right: 8,
opacity: { xs: 1, sm: 0.5 }, transition: 'opacity 0.3s',
}}>
<CloseRoundedIcon />
</IconButton>
</Box>;
}
// const dashedBorderSVG = encodeURIComponent(`
// <svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'>
// <rect x='0' y='0' width='100%' height='100%' fill='none' stroke='currentColor' stroke-width='2' stroke-dasharray='16, 2' />
// </svg>
// `);
const handleToggleShowState = React.useCallback(() => {
conversationHandler.overlayActions.ephemeralsToggleShowStatePane(ephemeral.id);
}, [conversationHandler, ephemeral.id]);
export function Ephemerals(props: { ephemerals: DEphemeral[], conversationId: DConversationId | null, sx?: SxProps }) {
// global state
// const ephemerals = useChatStore(state => {
// const conversation = state.conversations.find(conversation => conversation.id === props.conversationId);
// return conversation ? conversation.ephemerals : [];
// }, shallow);
const ephemerals = props.ephemerals;
// if (!ephemerals?.length) return null;
const showStatePane = ephemeral.showStatePane && !!ephemeral.state;
return (
<Sheet
variant='soft' color='success' invertedColors
sx={{
borderTop: '1px solid',
borderTopColor: 'divider',
// backgroundImage: `url("data:image/svg+xml,${dashedBorderSVG.replace('currentColor', '%23A1E8A1')}")`,
// backgroundSize: '100% 100%',
// backgroundRepeat: 'no-repeat',
...(props.sx || {}),
<Box sx={{
borderTop: '1px solid',
borderTopColor: 'divider',
// border: (i < ephemerals.length - 1) ? `2px solid ${theme.palette.divider}` : undefined,
display: 'flex',
flexDirection: 'column',
}}>
{/* Top Line - Title and Buttons */}
<Box sx={{
py: 1,
px: { xs: 1, md: 2 },
backgroundColor: 'success.softHoverBg',
display: 'flex',
gap: 1,
alignItems: 'center'
}}>
{ephemerals.map((ephemeral, i) =>
props.conversationId && <EphemeralItem key={`ephemeral-${i}`} conversationId={props.conversationId} ephemeral={ephemeral} />)}
<Typography level='title-sm' sx={{ flex: 1, color: 'success.solidBg' }}>
{ephemeral.title} Internal Monologue
</Typography>
{/* Show State */}
{!ephemeral.minimized && (
<IconButton
size='sm'
variant={ephemeral.showStatePane ? 'solid' : 'outlined'}
onClick={handleToggleShowState}
>
{ephemeral.showStatePane ? <VerticalSplitIcon /> : <VerticalSplitOutlinedIcon />}
</IconButton>
)}
{/* Minimize/Expand Button */}
<IconButton
size='sm'
variant={'outlined'}
onClick={handleToggleMinimized}
>
{ephemeral.minimized ? <MaximizeIcon /> : <MinimizeIcon />}
</IconButton>
{/* Close */}
<IconButton
size='sm'
variant={ephemeral.done ? 'solid' : 'outlined'}
onClick={handleDelete}
>
<CloseRoundedIcon />
</IconButton>
</Box>
{/* Content */}
{!ephemeral.minimized && <Box sx={{
py: 1,
px: { xs: 1, md: 2 },
}}>
{/* Content Grid */}
<Grid container spacing={2} sx={{ mt: 0.5 }}>
{/* Left pane (log) */}
<Grid xs={12} md={showStatePane ? 6 : 12}>
{/* New renderer, with */}
<Box sx={leftPaneSx}>
<ScaledTextBlockRenderer
text={ephemeral.text}
contentScaling={props.contentScaling}
textRenderVariant='markdown'
/>
</Box>
</Grid>
{/* Right pane (state) */}
{showStatePane && (
<Grid xs={12} md={6} sx={rightPaneSx}>
<StateRenderer
state={ephemeral.state}
contentScaling={props.contentScaling}
/>
</Grid>
)}
</Grid>
</Box>}
</Box>
);
}
export function Ephemerals(props: {
ephemerals: DEphemeral[],
conversationHandler: ConversationHandler,
sx?: SxProps
}) {
// external state
const adjContentScaling = useUIPreferencesStore(state => adjustContentScaling(state.contentScaling, -1));
return (
<Sheet variant='soft' color='success' invertedColors sx={props.sx}>
{props.ephemerals.map((ephemeral, i) => (
<EphemeralItem
key={ephemeral.id}
ephemeral={ephemeral}
conversationHandler={props.conversationHandler}
contentScaling={adjContentScaling}
/>
))}
</Sheet>
);
+228
View File
@@ -0,0 +1,228 @@
import * as React from 'react';
import { useShallow } from 'zustand/react/shallow';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, IconButton, styled, Typography } from '@mui/joy';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import MinimizeIcon from '@mui/icons-material/Minimize';
// import { isMacUser } from '~/common/util/pwaUtils';
import type { ShortcutObject } from '~/common/components/shortcuts/useGlobalShortcuts';
import { ConfirmationModal } from '~/common/components/modals/ConfirmationModal';
import { GoodTooltip } from '~/common/components/GoodTooltip';
import { useGlobalShortcutsStore } from '~/common/components/shortcuts/store-global-shortcuts';
import { useOverlayComponents } from '~/common/layout/overlays/useOverlayComponents';
import { useUXLabsStore } from '~/common/state/store-ux-labs';
// configuration
const COMPOSER_ENABLE_MINIMIZE = false;
const hideButtonTooltip = (
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
Hide Shortcuts<br />
Enable again in Settings &gt; Labs
</Box>
);
const hideButtonSx: SxProps = {
'--IconButton-size': '28px',
'--Icon-fontSize': '16px',
'--Icon-color': 'var(--joy-palette-text-tertiary)',
mr: -0.5,
};
// const animateAppear = keyframes`
// from {
// opacity: 0;
// transform: translateY(10px);
// }
// to {
// opacity: 1;
// transform: translateY(0);
// }
// `;
const StatusBarContainer = styled(Box)({
borderBottom: '1px solid',
// borderBottomColor: 'var(--joy-palette-divider)',
borderBottomColor: 'rgba(var(--joy-palette-neutral-mainChannel) / 0.1)',
// borderTopColor: 'rgba(var(--joy-palette-neutral-mainChannel, 99 107 116) / 0.4)',
// backgroundColor: 'var(--joy-palette-background-surface)',
// paddingBlock: '0.25rem',
paddingInline: '0.5rem',
// layout
display: 'flex',
flexFlow: 'row nowrap',
columnGap: '1.5rem', // space between shortcuts
lineHeight: '1em',
// animation: `${animateAppear} 0.3s ease-out`,
// transition: 'all 0.2s ease',
// '&:hover': {
// backgroundColor: 'var(--joy-palette-background-level1)',
// },
});
const ShortcutContainer = styled(Box)({
display: 'flex',
alignItems: 'center',
whiteSpace: 'nowrap',
gap: '2px', // space between modifiers
marginBlock: '0.25rem',
// transition: 'transform 0.2s ease',
// '&:hover': {
// transform: 'scale(1.05)',
// },
'&:hover > div': {
backgroundColor: 'var(--joy-palette-background-level1)',
},
cursor: 'pointer',
[`&[aria-disabled="true"]`]: {
opacity: 0.5,
pointerEvents: 'none',
}
});
const ShortcutKey = styled(Box)({
fontSize: 'var(--joy-fontSize-xs)',
fontWeight: 'var(--joy-fontWeight-md)',
border: '1px solid',
borderColor: 'var(--joy-palette-neutral-outlinedBorder)',
borderRadius: 'var(--joy-radius-xs)',
// backgroundColor: 'var(--joy-palette-neutral-outlinedBorder)',
backgroundColor: 'var(--joy-palette-background-popup)',
// boxShadow: 'inset 2px 0px 4px -2px var(--joy-palette-background-backdrop)',
boxShadow: 'var(--joy-shadow-xs)',
// minWidth: '1rem',
paddingBlock: '1px',
paddingInline: '4px',
// pointerEvents: 'none',
cursor: 'pointer',
transition: 'background-color 1s ease',
});
// Display mac-style shortcuts on windows as well
const displayMacModifiers = true;
function _platformAwareModifier(symbol: 'Ctrl' | 'Alt' | 'Shift') {
switch (symbol) {
case 'Ctrl':
return displayMacModifiers ? '⌃' : 'Ctrl';
case 'Shift':
return displayMacModifiers ? '⇧' : '⇧';
case 'Alt':
return displayMacModifiers ? '⌥' /* Option */ : 'Alt';
}
}
function ShortcutItem(props: { shortcut: ShortcutObject }) {
const handleClicked = React.useCallback(() => {
if (props.shortcut.action !== '_specialPrintShortcuts')
props.shortcut.action();
}, [props.shortcut]);
return (
<ShortcutContainer onClick={!props.shortcut.disabled ? handleClicked : undefined} aria-disabled={props.shortcut.disabled}>
{!!props.shortcut.ctrl && <ShortcutKey>{_platformAwareModifier('Ctrl')}</ShortcutKey>}
{!!props.shortcut.shift && <ShortcutKey>{_platformAwareModifier('Shift')}</ShortcutKey>}
{/*{!!props.shortcut.altForNonMac && <ShortcutKey onClick={handleClicked}>{_platformAwareModifier('Alt')}</ShortcutKey>}*/}
<ShortcutKey>{props.shortcut.key === 'Escape' ? 'Esc' : props.shortcut.key === 'Enter' ? '↵' : props.shortcut.key.toUpperCase()}</ShortcutKey>
&nbsp;<Typography level='body-xs'>{props.shortcut.description}</Typography>
{props.shortcut.endDecoratorIcon && <props.shortcut.endDecoratorIcon sx={{ fontSize: 'md' }} />}
</ShortcutContainer>
);
}
export function StatusBar(props: { toggleMinimized?: () => void, isMinimized?: boolean }) {
// state (modifiers pressed/not)
const { showPromisedOverlay } = useOverlayComponents();
// const [ctrlPressed, setCtrlPressed] = React.useState(false);
// const [shiftPressed, setShiftPressed] = React.useState(false);
// external state
const labsShowShortcutBar = useUXLabsStore(state => state.labsShowShortcutBar);
const shortcuts = useGlobalShortcutsStore(useShallow(state => {
let visibleShortcuts = !labsShowShortcutBar ? [] : state.getAllShortcuts().filter(shortcut => !!shortcut.description);
const maxLevel = Math.max(...visibleShortcuts.map(s => s.level ?? 0));
if (maxLevel > 0)
visibleShortcuts = visibleShortcuts.filter(s => s.level === maxLevel);
visibleShortcuts.sort((a, b) => {
// if they don't have a 'shift', they are sorted first
if (a.shift !== b.shift)
return a.shift ? 1 : -1;
// (Hack) If the description is 'Beam', it goes last
if (a.description === 'Beam Edit')
return 1;
// alphabetical for the rest
return a.key.localeCompare(b.key);
});
return visibleShortcuts;
}));
// handlers
const handleHideShortcuts = React.useCallback((event: React.MouseEvent) => {
if (event.shiftKey) {
console.log('shortcutGroups', useGlobalShortcutsStore.getState().shortcutGroups);
return;
}
showPromisedOverlay('shortcuts-confirm-close', {}, ({ onResolve, onUserReject }) =>
<ConfirmationModal
open onClose={onUserReject} onPositive={() => onResolve(true)}
confirmationText='Remove productivity tips and shortcuts? You can add it back in Settings > Labs.'
positiveActionText='Remove'
/>,
).then(() => useUXLabsStore.getState().setLabsShowShortcutBar(false)).catch(() => null /* ignore closure */);
}, [showPromisedOverlay]);
// React to modifiers
// React.useEffect(() => {
// const handleKeyDown = (e: KeyboardEvent) => {
// if (e.key === 'Control') setCtrlPressed(true);
// if (e.key === 'Shift') setShiftPressed(true);
// };
// const handleKeyUp = (e: KeyboardEvent) => {
// if (e.key === 'Control') setCtrlPressed(false);
// if (e.key === 'Shift') setShiftPressed(false);
// };
// window.addEventListener('keydown', handleKeyDown);
// window.addEventListener('keyup', handleKeyUp);
// return () => {
// window.removeEventListener('keydown', handleKeyDown);
// window.removeEventListener('keyup', handleKeyUp);
// };
// }, []);
if (!labsShowShortcutBar)
return null;
return (
<StatusBarContainer aria-label='Status bar'>
{(!props.toggleMinimized || !COMPOSER_ENABLE_MINIMIZE) && !props.isMinimized ? (
// Close Button
<GoodTooltip variantOutlined arrow placement='top' title={hideButtonTooltip}>
<IconButton size='sm' sx={hideButtonSx} onClick={handleHideShortcuts}>
<CloseRoundedIcon />
</IconButton>
</GoodTooltip>
) : (
// Minimize / Maximize Button - note the Maximize icon would be more correct, but also less discoverable
<IconButton size='sm' sx={hideButtonSx} onClick={props.toggleMinimized}>
{props.isMinimized ? <ExpandLessIcon /> : <MinimizeIcon />}
</IconButton>
)}
{/* Show all shortcuts */}
{shortcuts.map((shortcut, idx) => (
<ShortcutItem key={shortcut.key + idx} shortcut={shortcut} />
))}
</StatusBarContainer>
);
}
@@ -1,25 +1,71 @@
import * as React from 'react';
import { Box, Button, IconButton, Modal, ModalClose, Option, Select, Sheet, Typography } from '@mui/joy';
import CameraAltIcon from '@mui/icons-material/CameraAlt';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, Button, ButtonGroup, IconButton, Modal, ModalClose, Option, Select, Sheet, Tooltip, Typography } from '@mui/joy';
import AddRoundedIcon from '@mui/icons-material/AddRounded';
import CameraEnhanceIcon from '@mui/icons-material/CameraEnhance';
import CameraFrontIcon from '@mui/icons-material/CameraFront';
import CameraRearIcon from '@mui/icons-material/CameraRear';
import DownloadIcon from '@mui/icons-material/Download';
import InfoIcon from '@mui/icons-material/Info';
import FlipCameraAndroidOutlinedIcon from '@mui/icons-material/FlipCameraAndroidOutlined';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import { InlineError } from '~/common/components/InlineError';
import { downloadVideoFrameAsPNG, renderVideoFrameAsPNGFile } from '~/common/util/videoUtils';
import { Is } from '~/common/util/pwaUtils';
import { animationBackgroundCameraFlash } from '~/common/util/animUtils';
import { downloadVideoFrame, renderVideoFrameAsFile } from '~/common/util/videoUtils';
import { useCameraCapture } from '~/common/components/useCameraCapture';
// configuration
const DEBUG_NO_CAMERA_OPTION = false;
const FLASH_DURATION_MS = 600;
const ADD_COOLDOWN_MS = 300;
const captureButtonContainerSx: SxProps = {
display: 'flex',
gap: 1,
justifyContent: 'space-between',
alignItems: 'center',
};
const captureButtonGroupSx: SxProps = {
'--ButtonGroup-separatorColor': 'none !important',
// '--ButtonGroup-separatorSize': '2px',
borderRadius: '3rem',
// boxShadow: 'md',
boxShadow: '0 8px 12px -6px rgb(var(--joy-palette-neutral-darkChannel) / 50%)',
};
const captureButtonSx: SxProps = {
backgroundColor: 'neutral.solidHoverBg',
pl: 3.25,
pr: 4.5,
py: 1.5,
minWidth: { md: 200 },
'&:hover': {
backgroundColor: 'neutral.plainHoverColor',
},
};
const addButtonSx: SxProps = {
pl: 2.5,
pr: 2,
};
export function CameraCaptureModal(props: {
onCloseModal: () => void,
onAttachImage: (file: File) => void
onCloseModal: () => void;
onAttachImage: (file: File) => void;
// onOCR: (ocrText: string) => void }
}) {
// state
const [showInfo, setShowInfo] = React.useState(false);
// const [ocrProgress/*, setOCRProgress*/] = React.useState<number | null>(null);
const [isFlashing, setIsFlashing] = React.useState(false); // For flash effect
const [isAddButtonDisabled, setIsAddButtonDisabled] = React.useState(false); // Cooldown state
// external state
const {
@@ -39,29 +85,28 @@ export function CameraCaptureModal(props: {
onCloseModal();
}, [onCloseModal, resetVideo]);
/*const handleVideoOCRClicked = async () => {
if (!videoRef.current) return;
const renderedFrame = renderVideoFrameToCanvas(videoRef.current);
setOCRProgress(0);
const { recognize } = await import('tesseract.js');
const result = await recognize(renderedFrame, undefined, {
logger: m => {
// noinspection SuspiciousTypeOfGuard
if (typeof m.progress === 'number')
setOCRProgress(m.progress);
},
errorHandler: e => console.error(e),
});
setOCRProgress(null);
stopAndClose();
props.onOCR(result.data.text);
};*/
const handleFlashEffect = React.useCallback((cooldownMs: number) => {
// Flash effect
setIsFlashing(true);
setTimeout(() => {
setIsFlashing(false);
}, FLASH_DURATION_MS); // Flash duration in milliseconds
// Cooldown
if (cooldownMs) {
setIsAddButtonDisabled(true);
setTimeout(() => {
setIsAddButtonDisabled(false);
}, cooldownMs);
}
}, []);
const handleVideoSnapClicked = React.useCallback(async () => {
if (!videoRef.current) return;
try {
const file = await renderVideoFrameAsPNGFile(videoRef.current, 'camera');
// handleFlashEffect(0); // Trigger flash
const file = await renderVideoFrameAsFile(videoRef.current, 'camera', 'image/jpeg', 0.95);
onAttachImage(file);
stopAndClose();
} catch (error) {
@@ -69,96 +114,250 @@ export function CameraCaptureModal(props: {
}
}, [onAttachImage, stopAndClose, videoRef]);
const handleVideoDownloadClicked = React.useCallback(() => {
const handleVideoAddClicked = React.useCallback(async () => {
if (!videoRef.current) return;
downloadVideoFrameAsPNG(videoRef.current, 'camera');
try {
handleFlashEffect(ADD_COOLDOWN_MS); // Trigger flash and cooldown
const file = await renderVideoFrameAsFile(videoRef.current, 'camera', 'image/jpeg', 0.95);
onAttachImage(file);
} catch (error) {
console.error('Error capturing video frame:', error);
}
}, [handleFlashEffect, onAttachImage, videoRef]);
const handleVideoDownloadClicked = React.useCallback(async () => {
if (!videoRef.current) return;
await downloadVideoFrame(videoRef.current, 'camera', 'image/jpeg', 0.98);
}, [videoRef]);
// Reduced set of cameras
const displayCameras = React.useMemo(() => {
// iOS/English: "Front Camera", "Back Camera"
if (Is.OS.iOS) {
let reducedCameras = cameras.filter((device) => ['Front Camera', 'Back Camera'].includes(device.label));
if (reducedCameras.length > 0)
return reducedCameras;
}
return cameras;
}, [cameras]);
const { canSwitchCameras, isFrontCamera, isBackCamera } = React.useMemo(() => {
// determine if the current device is a front or back camera
let isFrontCamera = false;
let isBackCamera = false;
if (cameraIdx !== -1) {
const currentDevice = displayCameras[cameraIdx];
if (currentDevice) {
isFrontCamera = currentDevice.label.includes('Front Camera') || currentDevice.label.toLowerCase().includes('front');
isBackCamera = currentDevice.label.includes('Back Camera') || currentDevice.label.toLowerCase().includes('back');
}
}
// quick out if we only have 1 or 0 cameras
if (displayCameras.length <= 1)
return { canSwitchCameras: false, isFrontCamera, isBackCamera };
// use a reduction to find both the front and back cameras
const foundCameras = displayCameras.reduce((acc, device) => {
if (acc.front && acc.back) return acc;
if (device.label.includes('Front Camera')) acc.front = true;
else if (device.label.toLowerCase().includes('front')) acc.front = true;
if (device.label.includes('Back Camera')) acc.back = true;
else if (device.label.toLowerCase().includes('back')) acc.back = true;
return acc;
}, { front: false, back: false });
return { canSwitchCameras: (foundCameras.front && foundCameras.back) || displayCameras.length === 2, isFrontCamera, isBackCamera };
}, [cameraIdx, displayCameras]);
const handleCameraSwitch = React.useCallback(() => {
// safety checks: has multiple cameras, and current camera is valid
if (displayCameras.length <= 1 || cameraIdx === -1) return;
const currentCamera = displayCameras[cameraIdx] || undefined;
if (!currentCamera) return;
// finds the camera to switch to
let nextIdx: number | undefined = undefined;
// iOS
if (currentCamera.label.includes('Front Camera'))
nextIdx = displayCameras.findIndex((device) => device.label.includes('Back Camera'));
else if (currentCamera.label.includes('Back Camera'))
nextIdx = displayCameras.findIndex((device) => device.label.includes('Front Camera'));
// Android
if (nextIdx === undefined && currentCamera.label.includes('facing front'))
nextIdx = displayCameras.map((device) => device.label).findLastIndex((label) => label.includes('facing back'));
else if (nextIdx === undefined && currentCamera.label.includes('facing back'))
nextIdx = displayCameras.map((device) => device.label).findLastIndex((label) => label.includes('facing front'));
// Generic: if we have 2 cameras, flip to the other one
if (nextIdx === undefined && displayCameras.length === 2)
nextIdx = cameraIdx === 0 ? 1 : 0;
// if we found a valid camera, switch to it
if (nextIdx !== undefined && nextIdx !== -1)
setCameraIdx(nextIdx);
}, [cameraIdx, displayCameras, setCameraIdx]);
return (
<Modal open onClose={stopAndClose} sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<Modal
open
onClose={stopAndClose}
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
slotProps={{
backdrop: {
sx: {
backdropFilter: 'none', // using none because this is heavy
// backdropFilter: 'blur(4px)',
// backgroundColor: 'rgba(11 13 14 / 0.75)',
backgroundColor: 'rgba(var(--joy-palette-neutral-darkChannel) / 0.5)',
},
},
}}
>
<Box sx={{
display: 'flex', flexDirection: 'column', m: 1,
borderRadius: 'md', overflow: 'hidden',
boxShadow: 'sm',
boxShadow: 'lg',
}}>
{/* Top bar */}
<Sheet variant='solid' invertedColors sx={{ display: 'flex', justifyContent: 'space-between', p: 1 }}>
<Select
variant='solid' color='neutral'
value={cameraIdx} onChange={(_event: any, value: number | null) => setCameraIdx(value === null ? -1 : value)}
indicator={<KeyboardArrowDownIcon />}
>
<Option value={-1}>
No Camera
</Option>
{cameras.map((device: MediaDeviceInfo, camIndex) => (
<Option key={'video-dev-' + camIndex} value={camIndex}>
{device.label}
</Option>
))}
</Select>
<Sheet variant='solid' invertedColors={true} sx={{
p: 1,
backgroundColor: 'neutral.800',
display: 'flex',
justifyContent: 'space-between',
}}>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Select
size='sm'
variant={displayCameras.length > 1 ? 'soft' : 'plain'}
color='neutral'
value={cameraIdx} onChange={(_event: any, value: number | null) => setCameraIdx(value === null ? -1 : value)}
indicator={<KeyboardArrowDownIcon />}
sx={{ background: 'transparent' }}
slotProps={{ listbox: { size: 'md' } }}
>
{(!displayCameras.length || DEBUG_NO_CAMERA_OPTION) && (
<Option key='video-dev-none' value={-1}>
No Camera
</Option>
)}
{displayCameras.map((device: MediaDeviceInfo, camIndex) => (
<Option key={'video-dev-' + camIndex} value={camIndex}>
{/*{device.label?.includes('Face') ? <CameraFrontIcon />*/}
{/* : device.label?.includes('tual') ? <CameraRearIcon />*/}
{/* : null}*/}
{device.label
?.replace('camera2 ', 'Camera ')
.replace('facing front', 'Front')
.replace('facing back', 'Back')}
</Option>
))}
</Select>
<ModalClose onClick={stopAndClose} sx={{ position: 'static' }} />
{canSwitchCameras && (
<IconButton size='sm' onClick={handleCameraSwitch}>
{isFrontCamera ? <CameraRearIcon /> : isBackCamera ? <CameraFrontIcon /> : <FlipCameraAndroidOutlinedIcon />}
</IconButton>
)}
</Box>
<ModalClose size='lg' onClick={stopAndClose} sx={{ position: 'static' }} />
</Sheet>
{/* (main) Video */}
<Box sx={{ position: 'relative' }}>
<Box sx={{ position: 'relative', backgroundColor: 'background.level3' }}>
<video
ref={videoRef} autoPlay playsInline
style={{
display: 'block', width: '100%', maxHeight: 'calc(100vh - 200px)',
display: 'block',
width: !Is.Browser.Safari ? '100%' : undefined,
marginLeft: 'auto', marginRight: 'auto',
maxHeight: 'calc(100vh - 200px)',
background: '#8888', //opacity: ocrProgress !== null ? 0.5 : 1,
}}
/>
{showInfo && !!info && <Typography
sx={{
position: 'absolute', inset: 0, zIndex: 1, /* camera info on top of video */
background: 'rgba(0,0,0,0.5)', color: 'white',
whiteSpace: 'pre', overflowY: 'scroll',
}}>
{info}
</Typography>}
{/* Flash overlay */}
{isFlashing && (
<Box
sx={{
position: 'absolute', inset: 0, zIndex: 2,
animation: `${animationBackgroundCameraFlash} ${FLASH_DURATION_MS / 1000}s`,
}}
/>
)}
{showInfo && !!info && (
<Typography
sx={{
position: 'absolute', inset: 0, zIndex: 1, /* camera info on top of video */
background: 'rgba(0,0,0,0.5)', color: 'white',
whiteSpace: 'pre', overflowY: 'scroll',
}}>
{info}
</Typography>
)}
{/*{ocrProgress !== null && <CircularProgress sx={{ position: 'absolute', top: 'calc(50% - 34px / 2)', left: 'calc(50% - 34px / 2)', zIndex: 2 }} />}*/}
</Box>
{/* Bottom controls (zoom, ocr, download) & progress */}
<Sheet variant='soft' sx={{ display: 'flex', flexDirection: 'column', gap: 1, p: 1 }}>
{/* Bottom controls (zoom, download) & progress */}
<Sheet
variant='soft'
sx={{
p: 1,
display: 'flex',
flexDirection: 'column',
gap: 1,
}}
>
{!!error && <InlineError error={error} />}
{zoomControl}
{/*{ocrProgress !== null && <LinearProgress color='primary' determinate value={100 * ocrProgress} sx={{ px: 2 }} />}*/}
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'space-between' }}>
<Box paddingBottom={zoomControl ? 1 : undefined} sx={captureButtonContainerSx}>
{/* Info */}
<IconButton size='lg' disabled={!info} variant='soft' onClick={() => setShowInfo(info => !info)}>
<InfoIcon />
<IconButton disabled={!info} onClick={() => setShowInfo((prev) => !prev)}>
<InfoOutlinedIcon />
</IconButton>
{/*<Button disabled={ocrProgress !== null} fullWidth variant='solid' size='lg' onClick={handleVideoOCRClicked} sx={{ flex: 1, maxWidth: 260 }}>*/}
{/* Extract Text*/}
{/*</Button>*/}
{/* Capture */}
<Button
fullWidth
variant='solid' color='neutral'
onClick={handleVideoSnapClicked}
endDecorator={<CameraAltIcon />}
sx={{ flex: 1, maxWidth: 200, py: 2, borderRadius: '3rem' }}
>
Capture
</Button>
<ButtonGroup variant='solid' sx={captureButtonGroupSx}>
<Tooltip disableInteractive arrow placement='top' title='Add to message'>
<IconButton size='sm' disabled={isAddButtonDisabled} onClick={handleVideoAddClicked} sx={addButtonSx}>
<AddRoundedIcon />
</IconButton>
</Tooltip>
<Button size='lg' onClick={handleVideoSnapClicked} endDecorator={<CameraEnhanceIcon />} sx={captureButtonSx}>
Capture
</Button>
</ButtonGroup>
{/* Download */}
<IconButton size='lg' variant='soft' onClick={handleVideoDownloadClicked}>
<IconButton onClick={handleVideoDownloadClicked}>
<DownloadIcon />
</IconButton>
</Box>
</Sheet>
@@ -1,99 +0,0 @@
import * as React from 'react';
import { Box, MenuItem, Radio, Typography } from '@mui/joy';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { KeyStroke, platformAwareKeystrokes } from '~/common/components/KeyStroke';
import { useUIPreferencesStore } from '~/common/state/store-ui';
import { ChatModeId } from '../../AppChat';
interface ChatModeDescription {
label: string;
description: string | React.JSX.Element;
highlight?: boolean;
shortcut?: string;
hideOnDesktop?: boolean;
requiresTTI?: boolean;
}
const ChatModeItems: { [key in ChatModeId]: ChatModeDescription } = {
'generate-text': {
label: 'Chat',
description: 'Persona replies',
},
'generate-text-beam': {
label: 'Beam', // Best of, Auto-Prime, Top Pick, Select Best
description: 'Combine multiple models', // Smarter: combine...
shortcut: 'Ctrl + Enter',
hideOnDesktop: true,
},
'append-user': {
label: 'Write',
description: 'Append a message',
shortcut: 'Alt + Enter',
},
'generate-image': {
label: 'Draw',
description: 'AI Image Generation',
requiresTTI: true,
},
'generate-react': {
label: 'Reason + Act', // · α
description: 'Answer questions in multiple steps',
},
};
function fixNewLineShortcut(shortcut: string, enterIsNewLine: boolean) {
if (shortcut === 'ENTER')
return enterIsNewLine ? 'Shift + Enter' : 'Enter';
return shortcut;
}
export function ChatModeMenu(props: {
isMobile: boolean,
anchorEl: HTMLAnchorElement | null,
onClose: () => void,
chatModeId: ChatModeId,
onSetChatModeId: (chatMode: ChatModeId) => void,
capabilityHasTTI: boolean,
}) {
// external state
const enterIsNewline = useUIPreferencesStore(state => state.enterIsNewline);
return (
<CloseableMenu
placement='top-end'
open anchorEl={props.anchorEl} onClose={props.onClose}
sx={{ minWidth: 320 }}
>
{/*<MenuItem color='neutral' selected>*/}
{/* Conversation Mode*/}
{/*</MenuItem>*/}
{/**/}
{/*<ListDivider />*/}
{/* ChatMode items */}
{Object.entries(ChatModeItems)
.filter(([_key, data]) => !data.hideOnDesktop || props.isMobile)
.map(([key, data]) =>
<MenuItem key={'chat-mode-' + key} onClick={() => props.onSetChatModeId(key as ChatModeId)}>
<Box sx={{ flexGrow: 1, display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 2 }}>
<Radio color={data.highlight ? 'success' : undefined} checked={key === props.chatModeId} />
<Box sx={{ flexGrow: 1 }}>
<Typography>{data.label}</Typography>
<Typography level='body-xs'>{data.description}{(data.requiresTTI && !props.capabilityHasTTI) ? 'Unconfigured' : ''}</Typography>
</Box>
{(key === props.chatModeId || !!data.shortcut) && (
<KeyStroke combo={platformAwareKeystrokes(fixNewLineShortcut((key === props.chatModeId) ? 'ENTER' : data.shortcut ? data.shortcut : 'ENTER', enterIsNewline))} />
)}
</Box>
</MenuItem>)}
</CloseableMenu>
);
}
File diff suppressed because it is too large Load Diff
@@ -1,178 +0,0 @@
import * as React from 'react';
import { Badge, Box, ColorPaletteProp, Tooltip } from '@mui/joy';
function alignRight(value: number, columnSize: number = 8) {
const str = value.toLocaleString();
return str.padStart(columnSize);
}
function formatCost(cost: number) {
return cost < 1
? (cost * 100).toFixed(cost < 0.010 ? 2 : 1) + ' ¢'
: '$ ' + cost.toFixed(2);
}
export function tokensPrettyMath(tokenLimit: number | 0, directTokens: number, historyTokens?: number, responseMaxTokens?: number, tokenPriceIn?: number, tokenPriceOut?: number): {
color: ColorPaletteProp,
message: string,
remainingTokens: number,
costMax?: number,
costMin?: number,
} {
const usedInputTokens = directTokens + (historyTokens || 0);
const usedMaxTokens = usedInputTokens + (responseMaxTokens || 0);
const remainingTokens = tokenLimit - usedMaxTokens;
const gteLimit = (remainingTokens <= 0 && tokenLimit > 0);
// message
let message: string = gteLimit ? '⚠️ ' : '';
// costs
let costMax: number | undefined = undefined;
let costMin: number | undefined = undefined;
// no limit: show used tokens only
if (!tokenLimit) {
message += `Requested: ${usedMaxTokens.toLocaleString()} tokens`;
}
// has full information (d + i < l)
else if (historyTokens || responseMaxTokens) {
message +=
`${Math.abs(remainingTokens).toLocaleString()} ${remainingTokens >= 0 ? 'available' : 'excess'} message tokens\n\n` +
` = Model max tokens: ${alignRight(tokenLimit)}\n` +
` - This message: ${alignRight(directTokens)}\n` +
` - History: ${alignRight(historyTokens || 0)}\n` +
` - Max response: ${alignRight(responseMaxTokens || 0)}`;
// add the price, if available
if (tokenPriceIn || tokenPriceOut) {
costMin = tokenPriceIn ? usedInputTokens * tokenPriceIn / 1E6 : undefined;
const costOutMax = (tokenPriceOut && responseMaxTokens) ? responseMaxTokens * tokenPriceOut / 1E6 : undefined;
if (costMin || costOutMax) {
message += `\n\n\n▶ Chat Turn Cost (max, approximate)\n`;
if (costMin) message += '\n' +
` Input tokens: ${alignRight(usedInputTokens)}\n` +
` Input Price $/M: ${tokenPriceIn!.toFixed(2).padStart(8)}\n` +
` Input cost: ${('$' + costMin!.toFixed(4)).padStart(8)}\n`;
if (costOutMax) message += '\n' +
` Max output tokens: ${alignRight(responseMaxTokens!)}\n` +
` Output Price $/M: ${tokenPriceOut!.toFixed(2).padStart(8)}\n` +
` Max output cost: ${('$' + costOutMax!.toFixed(4)).padStart(8)}\n`;
if (costMin) message += '\n' +
` > Min turn cost: ${formatCost(costMin).padStart(8)}`;
costMax = (costMin && costOutMax) ? costMin + costOutMax : undefined;
if (costMax) message += '\n' +
` < Max turn cost: ${formatCost(costMax).padStart(8)}`;
}
}
}
// Cleaner mode: d + ? < R (total is the remaining in this case)
else {
message +=
`${(tokenLimit + usedMaxTokens).toLocaleString()} available tokens after deleting this\n\n` +
` = Currently free: ${alignRight(tokenLimit)}\n` +
` + This message: ${alignRight(usedMaxTokens)}`;
}
const color: ColorPaletteProp =
(tokenLimit && remainingTokens < 0)
? 'danger'
: remainingTokens < tokenLimit / 4
? 'warning'
: 'primary';
return { color, message, remainingTokens, costMax, costMin };
}
export const TokenTooltip = (props: { message: string | null, color: ColorPaletteProp, placement?: 'top' | 'top-end', children: React.ReactElement }) =>
<Tooltip
placement={props.placement}
variant={props.color !== 'primary' ? 'solid' : 'soft'} color={props.color}
title={props.message ? <Box sx={{ p: 2, whiteSpace: 'pre' }}>{props.message}</Box> : null}
sx={{
fontFamily: 'code',
// fontSize: '0.8125rem',
border: '1px solid',
borderColor: `${props.color}.outlinedColor`,
boxShadow: 'md',
}}
>
{props.children}
</Tooltip>;
/**
* Simple little component to show the token count (and a tooltip on hover)
*/
export const TokenBadgeMemo = React.memo(TokenBadge);
function TokenBadge(props: {
direct: number,
history?: number,
responseMax?: number,
limit: number,
tokenPriceIn?: number,
tokenPriceOut?: number,
showCost?: boolean
showExcess?: boolean,
absoluteBottomRight?: boolean,
inline?: boolean,
}) {
const { message, color, remainingTokens, costMax, costMin } =
tokensPrettyMath(props.limit, props.direct, props.history, props.responseMax, props.tokenPriceIn, props.tokenPriceOut);
let badgeValue: string;
const showAltCosts = !!props.showCost && !!costMax && costMin !== undefined;
if (showAltCosts) {
badgeValue = '< ' + formatCost(costMax);
} else {
// show the direct tokens, unless we exceed the limit and 'showExcess' is enabled
const value = (props.showExcess && (props.limit && remainingTokens <= 0))
? Math.abs(remainingTokens)
: props.direct;
badgeValue = value.toLocaleString();
}
const shallHide = !props.direct && remainingTokens >= 0 && !showAltCosts;
if (shallHide) return null;
return (
<TokenTooltip color={color} message={message} placement='top-end'>
<Badge
variant='soft' color={color} max={1000000}
// invisible={shallHide}
badgeContent={badgeValue}
slotProps={{
root: {
sx: {
...((props.absoluteBottomRight) && { position: 'absolute', bottom: 8, right: 8 }),
cursor: 'help',
},
},
badge: {
sx: {
// the badge (not the tooltip)
// boxShadow: 'sm',
fontFamily: 'code',
fontSize: 'xs',
...((props.absoluteBottomRight || props.inline) && { position: 'static', transform: 'none' }),
},
},
}}
/>
</TokenTooltip>
);
}
@@ -0,0 +1,179 @@
import * as React from 'react';
import { Controller, useFieldArray, useForm } from 'react-hook-form';
import { Box, Button, FormControl, FormHelperText, IconButton, Input, Stack, Typography } from '@mui/joy';
import AddIcon from '@mui/icons-material/Add';
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import LanguageRoundedIcon from '@mui/icons-material/LanguageRounded';
import YouTubeIcon from '@mui/icons-material/YouTube';
import { extractYoutubeVideoIDFromURL } from '~/modules/youtube/youtube.utils';
import { GoodModal } from '~/common/components/modals/GoodModal';
import { addSnackbar } from '~/common/components/snackbar/useSnackbarsStore';
import { asValidURL } from '~/common/util/urlUtils';
// configuration
const MAX_URLS = 5;
type WebInputData = {
url: string,
// attachImages?: boolean,
}
type WebInputModalInputs = {
links: WebInputData[];
}
function WebInputModal(props: {
onClose: () => void,
onWebLinks: (urls: WebInputData[]) => void,
}) {
// state
const { control: formControl, handleSubmit: formHandleSubmit, formState: { isValid: formIsValid, isDirty: formIsDirty } } = useForm<WebInputModalInputs>({
values: { links: [{ url: '' }] },
// mode: 'onChange', // validate on change
});
const { fields: formFields, append: formFieldsAppend, remove: formFieldsRemove } = useFieldArray({ control: formControl, name: 'links' });
// derived
const urlFieldCount = formFields.length;
// handlers
const { onClose, onWebLinks } = props;
const handleClose = React.useCallback(() => onClose(), [onClose]);
const handleSubmit = React.useCallback(({ links }: WebInputModalInputs) => {
// clean and prefix URLs
const cleanUrls = links.reduce((acc, { url, ...linkRest }) => {
const trimmed = (url || '').trim();
if (trimmed) {
// this form uses a 'relaxed' URL validation, meaning one can write 'big-agi.com' and we'll assume https://
const relaxedUrl = asValidURL(trimmed, true);
if (relaxedUrl)
acc.push({ url: relaxedUrl, ...linkRest });
}
return acc;
}, [] as WebInputData[]);
if (!cleanUrls.length) {
addSnackbar({ key: 'invalid-urls', message: 'Please enter at least one valid web address', type: 'issue', overrides: { autoHideDuration: 2000 } });
return;
}
onWebLinks(cleanUrls);
handleClose();
}, [handleClose, onWebLinks]);
return (
<GoodModal
open
onClose={handleClose}
title='Add Web Content'
titleStartDecorator={<LanguageRoundedIcon />}
closeText={'Cancel'}
// unfilterBackdrop
// themedColor='neutral'
hideBottomClose
>
<Box fontSize='md'>
Enter web page addresses to import their content.
</Box>
<Typography level='body-sm'>
Works on most websites and for YouTube videos (e.g., youtube.com/...) the transcript will be imported.
{/*You can add up to {MAX_URLS} URLs.*/}
</Typography>
<form onSubmit={formHandleSubmit(handleSubmit)}>
<Stack spacing={1}>
{formFields.map((field, index) => (
<Controller
key={field.id}
control={formControl}
name={`links.${index}.url`}
rules={{ required: 'Please enter a valid URL' }}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<FormControl error={!!error}>
<Box sx={{ display: 'flex', gap: 1 }}>
<Input
autoFocus={index === 0}
required={index === 0}
placeholder='https://...'
endDecorator={extractYoutubeVideoIDFromURL(value) ? <YouTubeIcon sx={{ color: 'red' }} /> : undefined}
value={value}
onChange={onChange}
sx={{ flex: 1 }}
/>
{urlFieldCount > 1 && (
<IconButton
size='sm'
variant='plain'
color='neutral'
onClick={() => formFieldsRemove(index)}
>
<DeleteOutlineIcon />
</IconButton>
)}
</Box>
{error && <FormHelperText>{error.message}</FormHelperText>}
</FormControl>
)}
/>
))}
</Stack>
{/* Add a new link */}
<Box sx={{ display: 'flex', justifyContent: 'space-between', gap: 1, mt: 2.5 }}>
{formIsDirty && <Button
color='neutral'
variant='soft'
disabled={urlFieldCount >= MAX_URLS}
onClick={() => formFieldsAppend({ url: '' })}
startDecorator={<AddIcon />}
>
Another
{/*{urlFieldCount >= MAX_URLS ? 'Enough URLs' : urlFieldCount === 1 ? 'Add URL' : urlFieldCount === 2 ? 'Add another' : urlFieldCount === 3 ? 'And another one' : urlFieldCount === 4 ? 'Why stopping' : 'Just one more'}*/}
</Button>}
<Button
variant='solid'
type='submit'
disabled={!formIsValid || !formIsDirty}
sx={{ minWidth: 160, ml: 'auto' }}
>
Add {urlFieldCount > 1 ? `(${urlFieldCount})` : ''}
</Button>
</Box>
</form>
</GoodModal>
);
}
export function useWebInputModal(onAttachWebLinks: (urls: WebInputData[]) => void) {
// state
const [open, setOpen] = React.useState(false);
const openWebInputDialog = React.useCallback(() => setOpen(true), []);
const webInputDialogComponent = React.useMemo(() => open && (
<WebInputModal
onClose={() => setOpen(false)}
onWebLinks={onAttachWebLinks}
/>
), [onAttachWebLinks, open]);
return {
openWebInputDialog,
webInputDialogComponent,
};
}
@@ -2,40 +2,46 @@ import * as React from 'react';
import { Box, ListItem, ListItemButton, ListItemDecorator, Sheet, Typography } from '@mui/joy';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import type { ActileItem } from './ActileProvider';
import { CloseablePopup } from '~/common/components/CloseablePopup';
import type { ActileItem, ActileProvider } from './ActileProvider';
export function ActilePopup(props: {
anchorEl: HTMLElement | null,
onClose: () => void,
title?: string,
items: ActileItem[],
activeItemIndex: number | undefined,
itemsByProvider: { provider: ActileProvider, items: ActileItem[] }[],
activeItemIndex: number,
activePrefixLength: number,
onItemClick: (item: ActileItem) => void,
children?: React.ReactNode
}) {
const hasAnyIcon = props.items.some(item => !!item.Icon);
// We need to keep track of the overall item index to correctly match with activeItemIndex
const itemIndices = React.useMemo(() => {
const indices: { providerKey: string, itemKey: string, isActive: boolean }[] = [];
let indexCounter = 0;
props.itemsByProvider.forEach(({ provider, items }) => {
items.forEach((item) => {
indices.push({
providerKey: provider.key,
itemKey: item.key,
isActive: indexCounter === props.activeItemIndex,
});
indexCounter += 1;
});
});
return indices;
}, [props.itemsByProvider, props.activeItemIndex]);
return (
<CloseableMenu
noTopPadding noBottomPadding
open anchorEl={props.anchorEl} onClose={props.onClose}
sx={{ minWidth: 320 }}
<CloseablePopup
menu anchorEl={props.anchorEl} onClose={props.onClose}
maxHeightGapPx={320}
minWidth={320}
noBottomPadding
noTopPadding
>
{!!props.title && (
<Sheet variant='soft' sx={{ p: 1, borderBottom: '1px solid', borderBottomColor: 'neutral.softActiveBg' }}>
<Typography level='title-sm'>
{props.title}
</Typography>
</Sheet>
)}
{!props.items.length && (
{!props.itemsByProvider.length && (
<ListItem variant='soft' color='warning'>
<Typography level='body-md'>
No matching command
@@ -43,46 +49,65 @@ export function ActilePopup(props: {
</ListItem>
)}
{props.items.map((item, idx) => {
const isActive = idx === props.activeItemIndex;
const labelBold = item.label.slice(0, props.activePrefixLength);
const labelNormal = item.label.slice(props.activePrefixLength);
return (
<ListItem
key={item.key}
variant={isActive ? 'soft' : undefined}
color={isActive ? 'primary' : undefined}
onClick={() => props.onItemClick(item)}
>
<ListItemButton color='primary'>
{hasAnyIcon && (
<ListItemDecorator>
{item.Icon ? <item.Icon /> : null}
</ListItemDecorator>
)}
<Box>
{props.itemsByProvider.map(({ provider, items }) => (
<React.Fragment key={provider.key}>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Typography level='title-sm' color={isActive ? 'primary' : undefined}>
<span style={{ textDecoration: 'underline' }}><b>{labelBold}</b></span>{labelNormal}
</Typography>
{item.argument && <Typography level='body-sm'>
{item.argument}
{/* Provider Label */}
<Sheet variant='soft' sx={{ p: 1, borderBottom: '1px solid', borderBottomColor: 'neutral.softActiveBg' }}>
<Typography level='title-sm'>
{provider.label}
</Typography>
</Sheet>
{/* Items */}
{items.map((item) => {
const index = itemIndices.findIndex(idx => idx.providerKey === provider.key && idx.itemKey === item.key);
const isActive = itemIndices[index]?.isActive;
const labelBold = item.label.slice(0, props.activePrefixLength);
const labelNormal = item.label.slice(props.activePrefixLength);
return (
<ListItem
key={`${provider.key}-${item.key}`}
variant={isActive ? 'soft' : undefined}
color={isActive ? 'primary' : undefined}
onClick={() => props.onItemClick(item)}
>
<ListItemButton color='primary'>
{item.Icon && (
<ListItemDecorator>
<item.Icon />
</ListItemDecorator>
)}
{/* Item*/}
<Box>
{/* Item main text */}
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Typography level='title-sm' color={isActive ? 'primary' : undefined}>
<span style={{ textDecoration: 'underline' }}><b>{labelBold}</b></span>{labelNormal}
</Typography>
{item.argument && <Typography level='body-sm'>
{item.argument}
</Typography>}
</Box>
{/* Item description */}
{!!item.description && <Typography level='body-xs'>
{item.description}
</Typography>}
</Box>
{!!item.description && <Typography level='body-xs'>
{item.description}
</Typography>}
</Box>
</ListItemButton>
</ListItem>
);
},
)}
</ListItemButton>
</ListItem>
);
})}
</React.Fragment>
))}
{props.children}
</CloseableMenu>
</CloseablePopup>
);
}
}
@@ -1,15 +1,27 @@
import type { FunctionComponent } from 'react';
export interface ActileProvider<TItem extends ActileItem = ActileItem> {
// Unique key for the provider
readonly key: 'pcmd' | 'pstrmsg' | 'pattlbl';
// Label for display
get label(): string;
// Interface for the provider
fastCheckTriggerText: (trailingText: string) => boolean;
fetchItems: () => ActileProviderItems<TItem>;
onItemSelect: (item: ActileItem) => void;
}
export type ActileProviderItems<TItem extends ActileItem = ActileItem> = Promise<{ searchPrefix: string, items: TItem[] }>;
export interface ActileItem {
key: string;
providerKey: ActileProvider['key'];
label: string;
argument?: string;
description?: string;
Icon?: FunctionComponent;
}
export interface ActileProvider<TItem extends ActileItem = ActileItem> {
fastCheckTriggerText: (trailingText: string) => boolean;
fetchItems: () => Promise<{ title: string, searchPrefix: string, items: TItem[] }>;
onItemSelect: (item: ActileItem) => void;
}
@@ -0,0 +1,37 @@
import type { ActileItem, ActileProvider, ActileProviderItems } from './ActileProvider';
import type { AttachmentDraftsStoreApi } from '~/common/attachment-drafts/store-attachment-drafts_slice';
export interface AttachmentLabelItem extends ActileItem {
// nothing to do do here, this is really just a label
}
export const providerAttachmentLabels = (
attachmentsStoreApi: AttachmentDraftsStoreApi | null,
onLabelSelect: (item: ActileItem, searchPrefix: string) => void,
): ActileProvider<AttachmentLabelItem> => ({
key: 'pattlbl',
get label() {
return 'Attachment Labels';
},
// Uses '@' as the trigger
fastCheckTriggerText: (trailingText: string) => trailingText === '@' || trailingText.endsWith(' @'),
fetchItems: async (): ActileProviderItems<AttachmentLabelItem> => ({
searchPrefix: '',
items: attachmentsStoreApi?.getState()?.attachmentDrafts.map(draft => ({
key: draft.id,
providerKey: 'pattlbl',
label: draft.label,
argument: undefined,
description: 'name',
Icon: undefined,
} as AttachmentLabelItem)) ?? [],
}),
onItemSelect: item => onLabelSelect(item as AttachmentLabelItem, '@'),
});
@@ -1,26 +1,35 @@
import { ActileItem, ActileProvider } from './ActileProvider';
import { findAllChatCommands } from '../../../commands/commands.registry';
import type { ActileItem, ActileProvider, ActileProviderItems } from './ActileProvider';
export function providerCommands(onCommandSelect: (item: ActileItem) => void): ActileProvider {
return {
export const providerCommands = (
onCommandSelect: (item: ActileItem, searchPrefix: string) => void,
): ActileProvider => ({
key: 'pcmd',
get label() {
return 'Chat Commands';
},
fastCheckTriggerText: (trailingText: string) => {
// only the literal '/' is a trigger
fastCheckTriggerText: (trailingText: string) => trailingText === '/',
return trailingText === '/';
},
// no real need to be async
fetchItems: async () => ({
title: 'Chat Commands',
searchPrefix: '/',
items: findAllChatCommands().map((cmd) => ({
key: cmd.primary,
label: cmd.primary,
argument: cmd.arguments?.join(' ') ?? undefined,
description: cmd.description,
Icon: cmd.Icon,
} satisfies ActileItem)),
}),
fetchItems: async (): ActileProviderItems => ({
searchPrefix: '/',
items: findAllChatCommands().map((cmd) => ({
key: cmd.primary,
providerKey: 'pcmd',
label: cmd.primary,
argument: cmd.arguments?.join(' ') ?? undefined,
description: cmd.description,
Icon: cmd.Icon,
} satisfies ActileItem)),
}),
onItemSelect: onCommandSelect,
};
}
onItemSelect: (item) => onCommandSelect(item as ActileItem, '/'),
});
@@ -1,6 +1,8 @@
import { conversationTitle, DConversationId, messageHasUserFlag, useChatStore } from '~/common/state/store-chats';
import { conversationTitle, DConversationId } from '~/common/stores/chat/chat.conversation';
import { MESSAGE_FLAG_STARRED, messageFragmentsReduceText, messageHasUserFlag } from '~/common/stores/chat/chat.message';
import { useChatStore } from '~/common/stores/chat/store-chats';
import { ActileItem, ActileProvider } from './ActileProvider';
import type { ActileItem, ActileProvider, ActileProviderItems } from './ActileProvider';
export interface StarredMessageItem extends ActileItem {
@@ -8,39 +10,44 @@ export interface StarredMessageItem extends ActileItem {
messageId: string,
}
export function providerStarredMessage(onMessageSeelect: (item: StarredMessageItem) => void): ActileProvider<StarredMessageItem> {
return {
export const providerStarredMessages = (onMessageSelect: (item: StarredMessageItem) => void): ActileProvider<StarredMessageItem> => ({
// only the literal '@' at start of chat, or ' @' at end of chat
fastCheckTriggerText: (trailingText: string) => trailingText === '@' || trailingText.endsWith(' @'),
key: 'pstrmsg',
// finds all the starred messages in all the conversations - this could be heavy
fetchItems: async () => {
const { conversations } = useChatStore.getState();
get label() {
return 'Starred Messages';
},
const starredMessages: StarredMessageItem[] = [];
conversations.forEach((conversation) => {
conversation.messages.forEach((message) => {
messageHasUserFlag(message, 'starred') && starredMessages.push({
// data
conversationId: conversation.id,
messageId: message.id,
// looks
key: message.id,
label: conversationTitle(conversation) + ' - ' + message.text.slice(0, 32) + '...',
// description: message.text.slice(32, 100),
Icon: undefined,
} satisfies StarredMessageItem);
});
// only the literal '@' at start of chat, or ' @' at end of chat
fastCheckTriggerText: (trailingText: string) => trailingText === '@' || trailingText.endsWith(' @'),
// finds all the starred messages in all the conversations - this could be heavy
fetchItems: async (): ActileProviderItems<StarredMessageItem> => {
const { conversations } = useChatStore.getState();
const starredMessages: StarredMessageItem[] = [];
conversations.forEach((conversation) => {
conversation.messages.forEach((message) => {
messageHasUserFlag(message, MESSAGE_FLAG_STARRED) && starredMessages.push({
key: message.id,
providerKey: 'pstrmsg',
// data
conversationId: conversation.id,
messageId: message.id,
// looks
label: conversationTitle(conversation) + ' - ' + messageFragmentsReduceText(message.fragments).slice(0, 32) + '...',
// description: message.text.slice(32, 100),
Icon: undefined,
} satisfies StarredMessageItem);
});
});
return {
title: 'Starred Messages',
searchPrefix: '',
items: starredMessages,
};
},
return {
searchPrefix: '',
items: starredMessages,
};
},
onItemSelect: item => onMessageSeelect(item as StarredMessageItem),
};
}
onItemSelect: item => onMessageSelect(item as StarredMessageItem),
});
@@ -1,5 +1,6 @@
import * as React from 'react';
import { ActileItem, ActileProvider } from './ActileProvider';
import type { ActileItem, ActileProvider } from './ActileProvider';
import { ActilePopup } from './ActilePopup';
@@ -7,71 +8,74 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
// state
const [popupOpen, setPopupOpen] = React.useState(false);
const [provider, setProvider] = React.useState<ActileProvider | null>(null);
const [title, setTitle] = React.useState<string>('');
const [items, setItems] = React.useState<ActileItem[]>([]);
const [itemsByProvider, setItemsByProvider] = React.useState<{ provider: ActileProvider, items: ActileItem[] }[]>([]);
const [activeSearchString, setActiveSearchString] = React.useState<string>('');
const [activeItemIndex, setActiveItemIndex] = React.useState<number>(0);
// derived state
const activeItems = React.useMemo(() => {
const activeItemsByProvider = React.useMemo(() => {
const search = activeSearchString.trim().toLowerCase();
return items.filter(item => item.label?.toLowerCase().startsWith(search));
}, [items, activeSearchString]);
const activeItem = activeItemIndex >= 0 && activeItemIndex < activeItems.length ? activeItems[activeItemIndex] : null;
return itemsByProvider.map(({ provider, items }) => ({
provider,
items: items.filter(item => item.label?.toLowerCase().startsWith(search)),
})).filter(({ items }) => items.length > 0);
}, [itemsByProvider, activeSearchString]);
const flatActiveItems = React.useMemo(() => {
return activeItemsByProvider.flatMap(({ items }) => items);
}, [activeItemsByProvider]);
const totalItems = flatActiveItems.length;
const activeItem = totalItems > 0 && activeItemIndex >= 0 && activeItemIndex < totalItems ? flatActiveItems[activeItemIndex] : null;
const handleClose = React.useCallback(() => {
setPopupOpen(false);
setProvider(null);
setTitle('');
setItems([]);
setItemsByProvider([]);
setActiveSearchString('');
setActiveItemIndex(0);
}, []);
const handlePopupItemClicked = React.useCallback((item: ActileItem) => {
const provider = providers.find(p => p.key === item.providerKey);
provider?.onItemSelect(item);
handleClose();
}, [handleClose, provider]);
}, [providers, handleClose]);
const handleEnterKey = React.useCallback(() => {
activeItem && handlePopupItemClicked(activeItem);
if (activeItem)
handlePopupItemClicked(activeItem);
}, [activeItem, handlePopupItemClicked]);
const actileInterceptTextChange = React.useCallback((trailingText: string) => {
for (const provider of providers) {
if (provider.fastCheckTriggerText(trailingText)) {
provider
.fetchItems()
.then(({ title, searchPrefix, items }) => {
// if there are no items, ignore
if (items.length) {
setPopupOpen(true);
setProvider(provider);
setTitle(title);
setItems(items);
setActiveSearchString(searchPrefix);
}
})
.catch(error => {
handleClose();
console.error('Failed to fetch popup items:', error);
});
return true;
}
// Collect all providers whose trigger matches
const matchingProviders = providers.filter(provider => provider.fastCheckTriggerText(trailingText));
if (matchingProviders.length > 0) {
// Fetch items from all matching providers
Promise.all(matchingProviders.map(provider =>
provider.fetchItems().then(({ searchPrefix, items }) => ({
provider,
searchPrefix,
items: items.map(item => ({ ...item, providerKey: provider.key })),
})),
)).then((results) => {
// Filter out empty results
results = results.filter(result => result.items.length > 0);
if (results.length) {
setPopupOpen(true);
setItemsByProvider(results.map(result => ({ provider: result.provider, items: result.items })));
setActiveSearchString(results[0].searchPrefix); // Assuming all search prefixes are the same
setActiveItemIndex(0);
}
}).catch(error => {
handleClose();
console.error('Failed to fetch popup items:', error);
});
return true;
}
return false;
}, [handleClose, providers]);
const actileInterceptKeydown = React.useCallback((_event: React.KeyboardEvent<HTMLTextAreaElement>): boolean => {
// Popup open: Intercept
const { key, currentTarget, ctrlKey, metaKey } = _event;
if (popupOpen) {
@@ -80,11 +84,11 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
handleClose();
} else if (key === 'ArrowUp') {
_event.preventDefault();
setActiveItemIndex((prevIndex) => (prevIndex > 0 ? prevIndex - 1 : activeItems.length - 1));
setActiveItemIndex((prevIndex) => (prevIndex > 0 ? prevIndex - 1 : totalItems - 1));
} else if (key === 'ArrowDown') {
_event.preventDefault();
setActiveItemIndex((prevIndex) => (prevIndex < activeItems.length - 1 ? prevIndex + 1 : 0));
} else if (key === 'Enter' || key === 'ArrowRight' || key === 'Tab' || (key === ' ' && activeItems.length === 1)) {
setActiveItemIndex((prevIndex) => (prevIndex < totalItems - 1 ? prevIndex + 1 : 0));
} else if (key === 'Enter' || key === 'ArrowRight' || key === 'Tab' || (key === ' ' && totalItems === 1)) {
_event.preventDefault();
handleEnterKey();
} else if (key === 'Backspace') {
@@ -100,26 +104,24 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
const trailingText = (currentTarget.value || '') + key;
return actileInterceptTextChange(trailingText);
}, [actileInterceptTextChange, activeItems.length, handleClose, handleEnterKey, popupOpen]);
}, [actileInterceptTextChange, handleClose, handleEnterKey, popupOpen, totalItems]);
const actileComponent = React.useMemo(() => {
return !popupOpen ? null : (
<ActilePopup
anchorEl={anchorRef.current}
onClose={handleClose}
title={title}
items={activeItems}
itemsByProvider={activeItemsByProvider}
activeItemIndex={activeItemIndex}
activePrefixLength={activeSearchString.length}
onItemClick={handlePopupItemClicked}
/>
);
}, [activeItemIndex, activeItems, activeSearchString.length, anchorRef, handleClose, handlePopupItemClicked, popupOpen, title]);
}, [activeItemIndex, activeItemsByProvider, activeSearchString.length, anchorRef, handleClose, handlePopupItemClicked, popupOpen]);
return {
actileComponent,
actileInterceptKeydown,
actileInterceptTextChange,
};
};
};
@@ -1,210 +0,0 @@
import * as React from 'react';
import { Box, Button, CircularProgress, ColorPaletteProp, Sheet, Typography } from '@mui/joy';
import AbcIcon from '@mui/icons-material/Abc';
import CodeIcon from '@mui/icons-material/Code';
import ImageOutlinedIcon from '@mui/icons-material/ImageOutlined';
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
import PivotTableChartIcon from '@mui/icons-material/PivotTableChart';
import TelegramIcon from '@mui/icons-material/Telegram';
import TextFieldsIcon from '@mui/icons-material/TextFields';
import TextureIcon from '@mui/icons-material/Texture';
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
import { GoodTooltip } from '~/common/components/GoodTooltip';
import { ellipsizeFront, ellipsizeMiddle } from '~/common/util/textUtils';
import type { Attachment, AttachmentConverterType, AttachmentId } from './store-attachments';
import type { LLMAttachment } from './useLLMAttachments';
// default attachment width
const ATTACHMENT_MIN_STYLE = {
height: '100%',
minHeight: '40px',
minWidth: '64px',
};
const ellipsizeLabel = (label?: string) => {
if (!label)
return '';
return ellipsizeMiddle((label || '')
.replace(/https?:\/\/(?:www\.)?/, ''), 30)
.replace(/\/$/, '')
.replace('…', '…\n…');
};
/**
* Displayed while a source is loading
*/
const LoadingIndicator = React.forwardRef((props: { label: string }, _ref) =>
<Sheet
color='success' variant='soft'
sx={{
border: '1px solid',
borderColor: 'success.solidBg',
borderRadius: 'sm',
display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 1,
...ATTACHMENT_MIN_STYLE,
boxSizing: 'border-box',
px: 1,
py: 0.5,
}}
>
<CircularProgress color='success' size='sm' />
<Typography level='title-sm' sx={{ whiteSpace: 'nowrap' }}>
{ellipsizeLabel(props.label)}
</Typography>
</Sheet>,
);
LoadingIndicator.displayName = 'LoadingIndicator';
const InputErrorIndicator = () =>
<WarningRoundedIcon sx={{ color: 'danger.solidBg' }} />;
const converterTypeToIconMap: { [key in AttachmentConverterType]: React.ComponentType<any> } = {
'text': TextFieldsIcon,
'rich-text': CodeIcon,
'rich-text-table': PivotTableChartIcon,
'pdf-text': PictureAsPdfIcon,
'pdf-images': PictureAsPdfIcon,
'image': ImageOutlinedIcon,
'image-ocr': AbcIcon,
'ego-message-md': TelegramIcon,
'unhandled': TextureIcon,
};
function attachmentConverterIcon(attachment: Attachment) {
const converter = attachment.converterIdx !== null ? attachment.converters[attachment.converterIdx] ?? null : null;
if (converter && converter.id) {
const Icon = converterTypeToIconMap[converter.id] ?? null;
if (Icon)
return <Icon sx={{ width: 24, height: 24 }} />;
}
return null;
}
function attachmentLabelText(attachment: Attachment): string {
const converter = attachment.converterIdx !== null ? attachment.converters[attachment.converterIdx] ?? null : null;
if (converter && attachment.label === 'Rich Text') {
if (converter.id === 'rich-text-table')
return 'Rich Table';
if (converter.id === 'rich-text')
return 'Rich HTML';
}
return ellipsizeFront(attachment.label, 24);
}
export function AttachmentItem(props: {
llmAttachment: LLMAttachment,
menuShown: boolean,
onItemMenuToggle: (attachmentId: AttachmentId, anchor: HTMLAnchorElement) => void,
}) {
// derived state
const { onItemMenuToggle } = props;
const {
attachment,
isUnconvertible,
isOutputMissing,
isOutputAttachable,
} = props.llmAttachment;
const {
inputError,
inputLoading: isInputLoading,
outputsConverting: isOutputLoading,
} = attachment;
const isInputError = !!inputError;
const showWarning = isUnconvertible || isOutputMissing || !isOutputAttachable;
const handleToggleMenu = React.useCallback((event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
onItemMenuToggle(attachment.id, event.currentTarget);
}, [attachment, onItemMenuToggle]);
// compose tooltip
let tooltip: string | null = '';
if (attachment.source.media !== 'text')
tooltip += attachment.source.media + ': ';
tooltip += attachment.label;
// if (hasInput)
// tooltip += `\n(${aInput.mimeType}: ${aInput.dataSize.toLocaleString()} bytes)`;
// if (aOutputs && aOutputs.length >= 1)
// tooltip += `\n\n${JSON.stringify(aOutputs)}`;
// choose variants and color
let color: ColorPaletteProp;
let variant: 'soft' | 'outlined' | 'contained' = 'soft';
if (isInputLoading || isOutputLoading) {
color = 'success';
} else if (isInputError) {
tooltip = `Issue loading the attachment: ${attachment.inputError}\n\n${tooltip}`;
color = 'danger';
} else if (showWarning) {
tooltip = props.menuShown
? null
: isUnconvertible
? `Attachments of type '${attachment.input?.mimeType}' are not supported yet. You can open a feature request on GitHub.\n\n${tooltip}`
: `Not compatible with the selected LLM or not supported. Please select another format.\n\n${tooltip}`;
color = 'warning';
} else {
// all good
tooltip = null;
color = /*props.menuShown ? 'primary' :*/ 'neutral';
variant = 'outlined';
}
return <Box>
<GoodTooltip
title={tooltip}
isError={isInputError}
isWarning={showWarning}
sx={{ p: 1, whiteSpace: 'break-spaces' }}
>
{isInputLoading
? <LoadingIndicator label={attachment.label} />
: (
<Button
size='sm'
variant={variant} color={color}
onClick={handleToggleMenu}
onContextMenu={handleToggleMenu}
sx={{
backgroundColor: props.menuShown ? `${color}.softActiveBg` : variant === 'outlined' ? 'background.popup' : undefined,
border: variant === 'soft' ? '1px solid' : undefined,
borderColor: variant === 'soft' ? `${color}.solidBg` : undefined,
borderRadius: 'sm',
...ATTACHMENT_MIN_STYLE,
px: 1, py: 0.5,
display: 'flex', flexDirection: 'row', gap: 1,
}}
>
{isInputError
? <InputErrorIndicator />
: <>
{attachmentConverterIcon(attachment)}
{isOutputLoading
? <>Converting <CircularProgress color='success' size='sm' /></>
: <Typography level='title-sm' sx={{ whiteSpace: 'nowrap' }}>
{attachmentLabelText(attachment)}
</Typography>}
</>}
</Button>
)}
</GoodTooltip>
</Box>;
}
@@ -1,190 +0,0 @@
import * as React from 'react';
import { Box, ListDivider, ListItemDecorator, MenuItem, Radio, Typography } from '@mui/joy';
import ClearIcon from '@mui/icons-material/Clear';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import VerticalAlignBottomIcon from '@mui/icons-material/VerticalAlignBottom';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { copyToClipboard } from '~/common/util/clipboardUtils';
import type { LLMAttachment } from './useLLMAttachments';
import { useAttachmentsStore } from './store-attachments';
// enable for debugging
export const DEBUG_ATTACHMENTS = true;
export function AttachmentMenu(props: {
llmAttachment: LLMAttachment,
menuAnchor: HTMLAnchorElement,
isPositionFirst: boolean,
isPositionLast: boolean,
onAttachmentInlineText: (attachmentId: string) => void,
onClose: () => void,
}) {
// derived state
const isPositionFixed = props.isPositionFirst && props.isPositionLast;
const {
attachment,
attachmentOutputs,
isUnconvertible,
isOutputMissing,
isOutputTextInlineable,
tokenCountApprox,
} = props.llmAttachment;
const {
id: aId,
input: aInput,
converters: aConverters,
converterIdx: aConverterIdx,
outputs: aOutputs,
} = attachment;
// operations
const { onClose, onAttachmentInlineText } = props;
const handleInlineText = React.useCallback(() => {
onClose();
onAttachmentInlineText(aId);
}, [aId, onAttachmentInlineText, onClose]);
const handleMoveUp = React.useCallback(() => {
useAttachmentsStore.getState().moveAttachment(aId, -1);
}, [aId]);
const handleMoveDown = React.useCallback(() => {
useAttachmentsStore.getState().moveAttachment(aId, 1);
}, [aId]);
const handleRemove = React.useCallback(() => {
onClose();
useAttachmentsStore.getState().removeAttachment(aId);
}, [aId, onClose]);
const handleSetConverterIdx = React.useCallback(async (converterIdx: number | null) => {
return useAttachmentsStore.getState().setConverterIdx(aId, converterIdx);
}, [aId]);
// const handleSummarizeText = React.useCallback(() => {
// onAttachmentSummarizeText(aId);
// }, [aId, onAttachmentSummarizeText]);
const handleCopyOutputToClipboard = React.useCallback(() => {
if (attachmentOutputs.length >= 1) {
const concat = attachmentOutputs.map(output => {
if (output.type === 'text-block')
return output.text;
else if (output.type === 'image-part')
return output.base64Url;
else
return null;
}).join('\n\n---\n\n');
copyToClipboard(concat.trim(), 'Converted attachment');
}
}, [attachmentOutputs]);
return (
<CloseableMenu
dense placement='top'
open anchorEl={props.menuAnchor} onClose={props.onClose}
sx={{ minWidth: 200 }}
>
{/* Move Arrows */}
{!isPositionFixed && <Box sx={{ display: 'flex', alignItems: 'center' }}>
<MenuItem
disabled={props.isPositionFirst}
onClick={handleMoveUp}
sx={{ flex: 1, display: 'flex', justifyContent: 'center' }}
>
<KeyboardArrowLeftIcon />
</MenuItem>
<MenuItem
disabled={props.isPositionLast}
onClick={handleMoveDown}
sx={{ flex: 1, display: 'flex', justifyContent: 'center' }}
>
<KeyboardArrowRightIcon />
</MenuItem>
</Box>}
{!isPositionFixed && <ListDivider sx={{ mt: 0 }} />}
{/* Render Converters as menu items */}
{/*{!isUnconvertible && <ListItem>*/}
{/* <Typography level='body-md'>*/}
{/* Attach as:*/}
{/* </Typography>*/}
{/*</ListItem>}*/}
{!isUnconvertible && aConverters.map((c, idx) =>
<MenuItem
disabled={c.disabled}
key={'c-' + c.id}
onClick={async () => idx !== aConverterIdx && await handleSetConverterIdx(idx)}
>
<ListItemDecorator>
<Radio checked={idx === aConverterIdx} />
</ListItemDecorator>
{c.unsupported
? <Box>Unsupported 🤔 <Typography level='body-xs'>{c.name}</Typography></Box>
: c.name}
</MenuItem>,
)}
{!isUnconvertible && <ListDivider />}
{DEBUG_ATTACHMENTS && !!aInput && (
<MenuItem onClick={handleCopyOutputToClipboard} disabled={!isOutputTextInlineable}>
<ListItemDecorator><ContentCopyIcon /></ListItemDecorator>
<Box>
{!!aInput && <Typography level='body-xs'>
🡐 {aInput.mimeType}, {aInput.dataSize.toLocaleString()} bytes
</Typography>}
{/*<Typography level='body-xs'>*/}
{/* Converters: {aConverters.map(((converter, idx) => ` ${converter.id}${(idx === aConverterIdx) ? '*' : ''}`)).join(', ')}*/}
{/*</Typography>*/}
<Typography level='body-xs'>
🡒 {isOutputMissing ? 'empty' : aOutputs.map(output => `${output.type}, ${output.type === 'text-block'
? output.text.length.toLocaleString()
: output.type === 'image-part'
? output.base64Url.length.toLocaleString()
: '(other)'} bytes`).join(' · ')}
</Typography>
{!!tokenCountApprox && <Typography level='body-xs'>
🡒 {tokenCountApprox.toLocaleString()} tokens
</Typography>}
</Box>
</MenuItem>
)}
{DEBUG_ATTACHMENTS && !!aInput && <ListDivider />}
{/* Destructive Operations */}
{/*<MenuItem onClick={handleCopyOutputToClipboard} disabled={!isOutputTextInlineable}>*/}
{/* <ListItemDecorator><ContentCopyIcon /></ListItemDecorator>*/}
{/* Copy*/}
{/*</MenuItem>*/}
{/*<MenuItem onClick={handleSummarizeText} disabled={!isOutputTextInlineable}>*/}
{/* <ListItemDecorator><CompressIcon color='success' /></ListItemDecorator>*/}
{/* Shrink*/}
{/*</MenuItem>*/}
<MenuItem onClick={handleInlineText} disabled={!isOutputTextInlineable}>
<ListItemDecorator><VerticalAlignBottomIcon /></ListItemDecorator>
Inline text
</MenuItem>
<MenuItem onClick={handleRemove}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
Remove
</MenuItem>
</CloseableMenu>
);
}
@@ -1,172 +0,0 @@
import * as React from 'react';
import { Box, IconButton, ListItemDecorator, MenuItem } from '@mui/joy';
import ClearIcon from '@mui/icons-material/Clear';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import VerticalAlignBottomIcon from '@mui/icons-material/VerticalAlignBottom';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { ConfirmationModal } from '~/common/components/ConfirmationModal';
import type { AttachmentId } from './store-attachments';
import type { LLMAttachments } from './useLLMAttachments';
import { AttachmentItem } from './AttachmentItem';
import { AttachmentMenu } from './AttachmentMenu';
/**
* Renderer of attachments, with menus, etc.
*/
export function Attachments(props: {
llmAttachments: LLMAttachments,
onAttachmentInlineText: (attachmentId: AttachmentId) => void,
onAttachmentsClear: () => void,
onAttachmentsInlineText: () => void,
}) {
// state
const [confirmClearAttachments, setConfirmClearAttachments] = React.useState<boolean>(false);
const [itemMenu, setItemMenu] = React.useState<{ anchor: HTMLAnchorElement, attachmentId: AttachmentId } | null>(null);
const [overallMenuAnchor, setOverallMenuAnchor] = React.useState<HTMLAnchorElement | null>(null);
// derived state
const { llmAttachments, onAttachmentsClear, onAttachmentInlineText, onAttachmentsInlineText } = props;
const { attachments, isOutputTextInlineable } = llmAttachments;
const hasAttachments = attachments.length >= 1;
// derived item menu state
const itemMenuAnchor = itemMenu?.anchor;
const itemMenuAttachmentId = itemMenu?.attachmentId;
const itemMenuAttachment = itemMenuAttachmentId ? attachments.find(la => la.attachment.id === itemMenu.attachmentId) : undefined;
const itemMenuIndex = itemMenuAttachment ? attachments.indexOf(itemMenuAttachment) : -1;
// item menu
const handleItemMenuToggle = React.useCallback((attachmentId: AttachmentId, anchor: HTMLAnchorElement) => {
handleOverallMenuHide();
setItemMenu(prev => prev?.attachmentId === attachmentId ? null : { anchor, attachmentId });
}, []);
const handleItemMenuHide = React.useCallback(() => {
setItemMenu(null);
}, []);
// item menu operations
const handleAttachmentInlineText = React.useCallback((attachmentId: string) => {
handleItemMenuHide();
onAttachmentInlineText(attachmentId);
}, [handleItemMenuHide, onAttachmentInlineText]);
// menu
const handleOverallMenuHide = () => setOverallMenuAnchor(null);
const handleOverallMenuToggle = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
setOverallMenuAnchor(anchor => anchor ? null : event.currentTarget);
};
// overall operations
const handleAttachmentsInlineText = React.useCallback(() => {
handleOverallMenuHide();
onAttachmentsInlineText();
}, [onAttachmentsInlineText]);
const handleClearAttachments = () => setConfirmClearAttachments(true);
const handleClearAttachmentsConfirmed = React.useCallback(() => {
handleOverallMenuHide();
setConfirmClearAttachments(false);
onAttachmentsClear();
}, [onAttachmentsClear]);
// no components without attachments
if (!hasAttachments)
return null;
return <>
{/* Attachments bar */}
<Box sx={{ position: 'relative' }}>
{/* Horizontally scrollable Attachments */}
<Box sx={{ display: 'flex', overflowX: 'auto', gap: 1, height: '100%', pr: 5 }}>
{attachments.map((llmAttachment) =>
<AttachmentItem
key={llmAttachment.attachment.id}
llmAttachment={llmAttachment}
menuShown={llmAttachment.attachment.id === itemMenuAttachmentId}
onItemMenuToggle={handleItemMenuToggle}
/>,
)}
</Box>
{/* Overall Menu button */}
<IconButton
onClick={handleOverallMenuToggle}
onContextMenu={handleOverallMenuToggle}
sx={{
// borderRadius: 'sm',
borderRadius: 0,
position: 'absolute', right: 0, top: 0,
backgroundColor: 'neutral.softDisabledBg',
}}
>
<ExpandLessIcon />
</IconButton>
</Box>
{/* Attachment Menu */}
{!!itemMenuAnchor && !!itemMenuAttachment && (
<AttachmentMenu
llmAttachment={itemMenuAttachment}
menuAnchor={itemMenuAnchor}
isPositionFirst={itemMenuIndex === 0}
isPositionLast={itemMenuIndex === attachments.length - 1}
onAttachmentInlineText={handleAttachmentInlineText}
onClose={handleItemMenuHide}
/>
)}
{/* Overall Menu */}
{!!overallMenuAnchor && (
<CloseableMenu
dense placement='top-start'
open anchorEl={overallMenuAnchor} onClose={handleOverallMenuHide}
>
<MenuItem onClick={handleAttachmentsInlineText} disabled={!isOutputTextInlineable}>
<ListItemDecorator><VerticalAlignBottomIcon /></ListItemDecorator>
Inline <span style={{ opacity: 0.5 }}>text attachments</span>
</MenuItem>
<MenuItem onClick={handleClearAttachments}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
Clear{attachments.length > 5 ? <span style={{ opacity: 0.5 }}> {attachments.length} attachments</span> : null}
</MenuItem>
</CloseableMenu>
)}
{/* 'Clear' Confirmation */}
{confirmClearAttachments && (
<ConfirmationModal
open onClose={() => setConfirmClearAttachments(false)} onPositive={handleClearAttachmentsConfirmed}
title='Confirm Removal'
positiveActionText='Remove All'
confirmationText={`This action will remove all (${attachments.length}) attachments. Do you want to proceed?`}
/>
)}
</>;
}
@@ -1,390 +0,0 @@
import { callBrowseFetchPage } from '~/modules/browse/browse.client';
import { createBase36Uid } from '~/common/util/textUtils';
import { htmlTableToMarkdown } from '~/common/util/htmlTableToMarkdown';
import { pdfToImageDataURLs, pdfToText } from '~/common/util/pdfUtils';
import type { Attachment, AttachmentConverter, AttachmentId, AttachmentInput, AttachmentSource } from './store-attachments';
import type { ComposerOutputMultiPart } from '../composer.types';
// extensions to treat as plain text
const PLAIN_TEXT_EXTENSIONS: string[] = ['.ts', '.tsx'];
// mimetypes to treat as plain text
const PLAIN_TEXT_MIMETYPES: string[] = [
'text/plain',
'text/html',
'text/markdown',
'text/csv',
'text/css',
'text/javascript',
'application/json',
];
/**
* Creates a new Attachment object.
*/
export function attachmentCreate(source: AttachmentSource, checkDuplicates: AttachmentId[]): Attachment {
return {
id: createBase36Uid(checkDuplicates),
source: source,
label: 'Loading...',
ref: '',
inputLoading: false,
inputError: null,
input: undefined,
converters: [],
converterIdx: null,
outputsConverting: false,
outputs: [],
// metadata: {},
};
}
/**
* Asynchronously loads the input for an Attachment object.
*
* @param {Readonly<AttachmentSource>} source - The source of the attachment.
* @param {(changes: Partial<Attachment>) => void} edit - A function to edit the Attachment object.
*/
export async function attachmentLoadInputAsync(source: Readonly<AttachmentSource>, edit: (changes: Partial<Attachment>) => void) {
edit({ inputLoading: true });
switch (source.media) {
// Download URL (page, file, ..) and attach as input
case 'url':
edit({ label: source.refUrl, ref: source.refUrl });
try {
const page = await callBrowseFetchPage(source.url);
edit(
page.content.markdown ? { input: { mimeType: 'text/markdown', data: page.content.markdown, dataSize: page.content.markdown.length } }
: page.content.text ? { input: { mimeType: 'text/plain', data: page.content.text, dataSize: page.content.text.length } }
: page.content.html ? { input: { mimeType: 'text/html', data: page.content.html, dataSize: page.content.html.length } }
: { inputError: 'No content found at this link' },
);
} catch (error: any) {
edit({ inputError: `Issue downloading page: ${error?.message || (typeof error === 'string' ? error : JSON.stringify(error))}` });
}
break;
// Attach file as input
case 'file':
edit({ label: source.refPath, ref: source.refPath });
// fix missing/wrong mimetypes
let mimeType = source.fileWithHandle.type;
if (!mimeType) {
// see note on 'attachAppendDataTransfer'; this is a fallback for drag/drop missing Mimes sometimes
console.warn('Assuming the attachment is text/plain. From:', source.origin, ', name:', source.refPath);
mimeType = 'text/plain';
} else {
// possibly fix wrongly assigned mimetypes (from the extension alone)
if (!mimeType.startsWith('text/') && PLAIN_TEXT_EXTENSIONS.some(ext => source.refPath.endsWith(ext)))
mimeType = 'text/plain';
}
// UX: just a hint of a loading state
await new Promise(resolve => setTimeout(resolve, 100));
try {
const fileArrayBuffer = await source.fileWithHandle.arrayBuffer();
edit({
input: {
mimeType,
data: fileArrayBuffer,
dataSize: fileArrayBuffer.byteLength,
},
});
} catch (error: any) {
edit({ inputError: `Issue loading file: ${error?.message || (typeof error === 'string' ? error : JSON.stringify(error))}` });
}
break;
case 'text':
if (source.textHtml && source.textPlain) {
edit({
label: 'Rich Text',
ref: '',
input: {
mimeType: 'text/plain',
data: source.textPlain,
dataSize: source.textPlain!.length,
altMimeType: 'text/html',
altData: source.textHtml,
},
});
} else {
const text = source.textHtml || source.textPlain || '';
edit({
label: 'Text',
ref: '',
input: {
mimeType: 'text/plain',
data: text,
dataSize: text.length,
},
});
}
break;
case 'ego':
edit({
label: source.label,
ref: source.blockTitle,
input: {
mimeType: 'ego/message',
data: source.textPlain,
dataSize: source.textPlain.length,
},
});
break;
}
edit({ inputLoading: false });
}
/**
* Defines the possible converters for an Attachment object based on its input type.
*
* @param {AttachmentSource['media']} sourceType - The media type of the attachment source.
* @param {Readonly<AttachmentInput>} input - The input of the attachment.
* @param {(changes: Partial<Attachment>) => void} edit - A function to edit the Attachment object.
*/
export function attachmentDefineConverters(sourceType: AttachmentSource['media'], input: Readonly<AttachmentInput>, edit: (changes: Partial<Attachment>) => void) {
// return all the possible converters for the input
const converters: AttachmentConverter[] = [];
switch (true) {
// plain text types
case PLAIN_TEXT_MIMETYPES.includes(input.mimeType):
// handle a secondary layer of HTML 'text' origins: drop, paste, and clipboard-read
const textOriginHtml = sourceType === 'text' && input.altMimeType === 'text/html' && !!input.altData;
const isHtmlTable = !!input.altData?.startsWith('<table');
// p1: Tables
if (textOriginHtml && isHtmlTable) {
converters.push({
id: 'rich-text-table',
name: 'Markdown Table',
});
}
// p2: Text
converters.push({
id: 'text',
name: 'Text',
});
// p3: Html
if (textOriginHtml) {
converters.push({
id: 'rich-text',
name: 'HTML',
});
}
break;
// PDF
case ['application/pdf', 'application/x-pdf', 'application/acrobat'].includes(input.mimeType):
converters.push({ id: 'pdf-text', name: `PDF To Text` });
converters.push({ id: 'pdf-images', name: `PDF To Images`, disabled: true });
break;
// images
case input.mimeType.startsWith('image/'):
converters.push({ id: 'image', name: `Image (coming soon)` });
converters.push({ id: 'image-ocr', name: 'As Text (OCR)' });
break;
// EGO
case input.mimeType === 'ego/message':
converters.push({ id: 'ego-message-md', name: 'Message' });
break;
// catch-all
default:
converters.push({ id: 'unhandled', name: `${input.mimeType}`, unsupported: true });
converters.push({ id: 'text', name: 'As Text' });
break;
}
edit({ converters });
}
/**
* Converts the input of an Attachment object based on the selected converter.
*
* @param {Readonly<Attachment>} attachment - The Attachment object to convert.
* @param {number | null} converterIdx - The index of the selected conversion in the Attachment object's converters array.
* @param {(changes: Partial<Attachment>) => void} edit - A function to edit the Attachment object.
*/
export async function attachmentPerformConversion(attachment: Readonly<Attachment>, converterIdx: number | null, edit: (changes: Partial<Attachment>) => void) {
// set converter index
converterIdx = (converterIdx !== null && converterIdx >= 0 && converterIdx < attachment.converters.length) ? converterIdx : null;
edit({
converterIdx: converterIdx,
outputs: [],
});
// get converter
const { ref, input } = attachment;
const converter = converterIdx !== null ? attachment.converters[converterIdx] : null;
if (!converter || !input)
return;
edit({
outputsConverting: true,
});
// input datacould be a string or an ArrayBuffer
function inputDataToString(data: string | ArrayBuffer | null | undefined): string {
if (typeof data === 'string')
return data;
if (data instanceof ArrayBuffer)
return new TextDecoder().decode(data);
return '';
}
// apply converter to the input
const outputs: ComposerOutputMultiPart = [];
switch (converter.id) {
// text as-is
case 'text':
outputs.push({
type: 'text-block',
text: inputDataToString(input.data),
title: ref,
collapsible: true,
});
break;
// html as-is
case 'rich-text':
outputs.push({
type: 'text-block',
text: input.altData!,
title: ref || '\n<!DOCTYPE html>',
collapsible: true,
});
break;
// html to markdown table
case 'rich-text-table':
let mdTable: string;
try {
mdTable = htmlTableToMarkdown(input.altData!, false);
} catch (error) {
// fallback to text/plain
mdTable = inputDataToString(input.data);
}
outputs.push({
type: 'text-block',
text: mdTable,
title: ref,
collapsible: true,
});
break;
case 'pdf-text':
if (!(input.data instanceof ArrayBuffer)) {
console.log('Expected ArrayBuffer for PDF text converter, got:', typeof input.data);
break;
}
// duplicate the ArrayBuffer to avoid mutation
const pdfData = new Uint8Array(input.data.slice(0));
const pdfText = await pdfToText(pdfData);
outputs.push({
type: 'text-block',
text: pdfText,
title: ref,
collapsible: true,
});
break;
case 'pdf-images':
if (!(input.data instanceof ArrayBuffer)) {
console.log('Expected ArrayBuffer for PDF images converter, got:', typeof input.data);
break;
}
// duplicate the ArrayBuffer to avoid mutation
const pdfData2 = new Uint8Array(input.data.slice(0));
try {
const imageDataURLs = await pdfToImageDataURLs(pdfData2);
imageDataURLs.forEach((pdfImg, index) => {
outputs.push({
type: 'image-part',
base64Url: pdfImg.base64Url,
metadata: {
title: `Page ${index + 1}`,
width: pdfImg.width,
height: pdfImg.height,
},
collapsible: false,
});
});
} catch (error) {
console.error('Error converting PDF to images:', error);
}
break;
case 'image':
// TODO: continue here
/*outputs.push({
type: 'image-part',
base64Url: `data:notImplemented.yet:)`,
collapsible: false,
});*/
break;
case 'image-ocr':
if (!(input.data instanceof ArrayBuffer)) {
console.log('Expected ArrayBuffer for Image OCR converter, got:', typeof input.data);
break;
}
try {
const { recognize } = await import('tesseract.js');
const buffer = Buffer.from(input.data);
const result = await recognize(buffer, undefined, {
errorHandler: e => console.error(e),
logger: (message) => {
if (message.status === 'recognizing text')
console.log('OCR progress:', message.progress);
},
});
outputs.push({
type: 'text-block',
text: result.data.text,
title: ref,
collapsible: true,
});
} catch (error) {
console.error(error);
}
break;
case 'ego-message-md':
outputs.push({
type: 'text-block',
text: inputDataToString(input.data),
title: ref,
collapsible: true,
});
break;
case 'unhandled':
// force the user to explicitly select 'as text' if they want to proceed
break;
}
// update
edit({
outputsConverting: false,
outputs,
});
}
@@ -1,42 +0,0 @@
/*
/// REDUCER
import { ContentReducer } from '~/modules/aifn/summarize/ContentReducer';
const [reducerText, setReducerText] = React.useState('');
const [reducerTextTokens, setReducerTextTokens] = React.useState(0);
{reducerText?.length >= 1 &&
<ContentReducer
initialText={reducerText} initialTokens={reducerTextTokens} tokenLimit={remainingTokens}
onReducedText={handleReducedText} onClose={handleReducerClose}
/>
}
const handleReducerClose = () => setReducerText('');
const handleReducedText = (text: string) => {
handleReducerClose();
setComposeText(_t => _t + text);
};
const handleAttachFiles = async (files: FileList, overrideFileNames?: string[]): Promise<void> => {
// see how we fare on budget
if (chatLLMId) {
const newTextTokens = countModelTokens(newText, chatLLMId, 'reducer trigger') ?? 0;
// simple trigger for the reduction dialog
if (newTextTokens > remainingTokens) {
setReducerTextTokens(newTextTokens);
setReducerText(newText);
return;
}
}
// within the budget, so just append
setComposeText(text => expandPromptTemplate(PromptTemplates.Concatenate, { text: newText })(text));
*/
@@ -1,208 +0,0 @@
import { create } from 'zustand';
import type { FileWithHandle } from 'browser-fs-access';
import type { ComposerOutputMultiPart } from '../composer.types';
import { attachmentCreate, attachmentDefineConverters, attachmentLoadInputAsync, attachmentPerformConversion } from './pipeline';
// Attachment Types
export type AttachmentSourceOriginDTO = 'drop' | 'paste';
export type AttachmentSourceOriginFile = 'camera' | 'screencapture' | 'file-open' | 'clipboard-read' | AttachmentSourceOriginDTO;
export type AttachmentSource = {
media: 'url';
url: string;
refUrl: string;
} | {
media: 'file';
origin: AttachmentSourceOriginFile,
fileWithHandle: FileWithHandle;
refPath: string;
} | {
media: 'text';
method: 'clipboard-read' | AttachmentSourceOriginDTO;
textPlain?: string;
textHtml?: string;
} | {
media: 'ego';
method: 'ego-message';
label: string;
blockTitle: string;
textPlain: string;
};
export type AttachmentInput = {
mimeType: string; // Original MIME type of the file
data: string | ArrayBuffer; // The original data of the attachment
dataSize: number; // Size of the original data in bytes
altMimeType?: string; // Alternative MIME type for the input
altData?: string; // Alternative data for the input
// preview?: AttachmentPreview; // Preview of the input
};
export type AttachmentConverterType =
| 'text' | 'rich-text' | 'rich-text-table'
| 'pdf-text' | 'pdf-images'
| 'image' | 'image-ocr'
| 'ego-message-md'
| 'unhandled';
export type AttachmentConverter = {
id: AttachmentConverterType;
name: string;
disabled?: boolean;
unsupported?: boolean;
// outputType: ComposerOutputPartType; // The type of the output after conversion
// isAutonomous: boolean; // Whether the conversion does not require user input
// isAsync: boolean; // Whether the conversion is asynchronous
// progress: number; // Conversion progress percentage (0..1)
// errorMessage?: string; // Error message if the conversion failed
}
export type AttachmentId = string;
export type Attachment = {
readonly id: AttachmentId;
readonly source: AttachmentSource,
label: string;
ref: string; // will be used in ```ref\n...``` for instance
inputLoading: boolean;
inputError: string | null;
input?: AttachmentInput;
// options to convert the input
converters: AttachmentConverter[]; // List of available converters for this attachment
converterIdx: number | null; // Index of the selected converter
outputsConverting: boolean;
outputs: ComposerOutputMultiPart; // undefined: not yet converted, []: conversion failed, [ {}+ ]: conversion succeeded
// metadata: {
// size?: number; // Size of the attachment in bytes
// creationDate?: Date; // Creation date of the file
// modifiedDate?: Date; // Last modified date of the file
// altText?: string; // Alternative text for images for screen readers
// };
};
/*export type AttachmentPreview = {
renderer: 'noPreview',
title: string; // A title for the preview
} | {
renderer: 'textPreview'
fileName: string; // The name of the file
snippet: string; // A text snippet for documents
tooltip?: string; // A tooltip for the preview
} | {
renderer: 'imagePreview'
thumbnail: string; // A thumbnail preview for images, videos, etc.
tooltip?: string; // A tooltip for the preview
};*/
/// Store
interface AttachmentsStore {
attachments: Attachment[];
createAttachment: (source: AttachmentSource) => Promise<void>;
clearAttachments: () => void;
removeAttachment: (attachmentId: AttachmentId) => void;
moveAttachment: (attachmentId: AttachmentId, delta: 1 | -1) => void;
setConverterIdx: (attachmentId: AttachmentId, converterIdx: number | null) => Promise<void>;
_editAttachment: (attachmentId: AttachmentId, update: Partial<Attachment> | ((attachment: Attachment) => Partial<Attachment>)) => void;
_getAttachment: (attachmentId: AttachmentId) => Attachment | undefined;
}
export const useAttachmentsStore = create<AttachmentsStore>()(
(_set, _get) => ({
attachments: [],
createAttachment: async (source: AttachmentSource) => {
const { attachments, _getAttachment, _editAttachment, setConverterIdx } = _get();
const attachment = attachmentCreate(source, attachments.map(a => a.id));
_set({
attachments: [...attachments, attachment],
});
const editFn = (changes: Partial<Attachment>) => _editAttachment(attachment.id, changes);
// 1.Resolve the Input
await attachmentLoadInputAsync(source, editFn);
const loaded = _getAttachment(attachment.id);
if (!loaded || !loaded.input)
return;
// 2. Define the I->O Converters
attachmentDefineConverters(source.media, loaded.input, editFn);
const defined = _getAttachment(attachment.id);
if (!defined || !defined.converters.length || defined.converterIdx !== null)
return;
// 3. Select the first Converter
const firstEnabledIndex = defined.converters.findIndex(_c => !_c.disabled);
await setConverterIdx(attachment.id, firstEnabledIndex > -1 ? firstEnabledIndex : 0);
},
clearAttachments: () => _set({
attachments: [],
}),
removeAttachment: (attachmentId: AttachmentId) =>
_set(state => ({
attachments: state.attachments.filter(attachment => attachment.id !== attachmentId),
})),
moveAttachment: (attachmentId: AttachmentId, delta: 1 | -1) =>
_set(state => {
const attachments = [...state.attachments];
const currentIdx = attachments.findIndex(a => a.id === attachmentId);
// If the attachment is not found, or if trying to move beyond the array boundaries, no move is needed
if (currentIdx === -1 || (currentIdx === 0 && delta === -1) || (currentIdx === attachments.length - 1 && delta === 1))
return state;
// Swap the attachment with the adjacent one in the direction of delta
const targetIdx = currentIdx + delta;
[attachments[currentIdx], attachments[targetIdx]] = [attachments[targetIdx], attachments[currentIdx]];
return { attachments };
}),
setConverterIdx: async (attachmentId: AttachmentId, converterIdx: number | null) => {
const { _getAttachment, _editAttachment } = _get();
const attachment = _getAttachment(attachmentId);
if (!attachment || attachment.converterIdx === converterIdx)
return;
const editFn = (changes: Partial<Attachment>) => _editAttachment(attachmentId, changes);
await attachmentPerformConversion(attachment, converterIdx, editFn);
},
_editAttachment: (attachmentId: AttachmentId, update: Partial<Attachment> | ((attachment: Attachment) => Partial<Attachment>)) =>
_set(state => ({
attachments: state.attachments.map((attachment: Attachment): Attachment =>
attachment.id === attachmentId
? { ...attachment, ...(typeof update === 'function' ? update(attachment) : update) }
: attachment,
),
})),
_getAttachment: (attachmentId: AttachmentId) =>
_get().attachments.find(a => a.id === attachmentId),
}),
);
@@ -1,198 +0,0 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import type { FileWithHandle } from 'browser-fs-access';
import { addSnackbar } from '~/common/components/useSnackbarsStore';
import { asValidURL } from '~/common/util/urlUtils';
import { extractFilePathsWithCommonRadix } from '~/common/util/dropTextUtils';
import { getClipboardItems } from '~/common/util/clipboardUtils';
import { AttachmentSourceOriginDTO, AttachmentSourceOriginFile, useAttachmentsStore } from './store-attachments';
// enable to debug attachment operations
const ATTACHMENTS_DEBUG_INTAKE = false;
export const useAttachments = (enableLoadURLs: boolean) => {
// state
const { attachments, clearAttachments, createAttachment, removeAttachment } = useAttachmentsStore(state => ({
attachments: state.attachments,
clearAttachments: state.clearAttachments,
createAttachment: state.createAttachment,
removeAttachment: state.removeAttachment,
}), shallow);
// Creation helpers
const attachAppendFile = React.useCallback((origin: AttachmentSourceOriginFile, fileWithHandle: FileWithHandle, overrideFileName?: string) => {
if (ATTACHMENTS_DEBUG_INTAKE)
console.log('attachAppendFile', origin, fileWithHandle, overrideFileName);
return createAttachment({
media: 'file', origin, fileWithHandle, refPath: overrideFileName || fileWithHandle.name,
});
}, [createAttachment]);
const attachAppendDataTransfer = React.useCallback((dt: DataTransfer, method: AttachmentSourceOriginDTO, attachText: boolean): 'as_files' | 'as_url' | 'as_text' | false => {
// https://github.com/enricoros/big-AGI/issues/286
const textHtml = dt.getData('text/html') || '';
const heuristicIsExcel = textHtml.includes('"urn:schemas-microsoft-com:office:excel"');
// noinspection HttpUrlsUsage
const heuristicIsPowerPoint = textHtml.includes('xmlns:m="http://schemas.microsoft.com/office/20') && textHtml.includes('<meta name=Generator content="Microsoft PowerPoint');
const heuristicBypassImage = heuristicIsExcel || heuristicIsPowerPoint;
if (ATTACHMENTS_DEBUG_INTAKE)
console.log('attachAppendDataTransfer', dt.types, dt.items, dt.files, textHtml);
// attach File(s)
if (dt.files.length >= 1 && !heuristicBypassImage /* special case: ignore images from Microsoft Office pastes (prioritize the HTML paste) */) {
// rename files from a common prefix, to better relate them (if the transfer contains a list of paths)
let overrideFileNames: string[] = [];
if (dt.types.includes('text/plain')) {
const plainText = dt.getData('text/plain');
overrideFileNames = extractFilePathsWithCommonRadix(plainText);
}
const overrideNames = overrideFileNames.length === dt.files.length;
// attach as Files (paste and drop keep the original filename)
for (let i = 0; i < dt.files.length; i++) {
const file = dt.files[i];
// drag/drop of folders (or .tsx from IntelliJ) will have no type
if (!file.type) {
// NOTE: we are fixing it in attachmentLoadInputAsync, but would be better to do it here
}
void attachAppendFile(method, file, overrideNames ? overrideFileNames[i] || undefined : undefined);
}
return 'as_files';
}
// attach as URL
const textPlain = dt.getData('text/plain') || '';
if (textPlain && enableLoadURLs) {
const textPlainUrl = asValidURL(textPlain);
if (textPlainUrl && textPlainUrl) {
void createAttachment({
media: 'url', url: textPlainUrl, refUrl: textPlain,
});
return 'as_url';
}
}
// attach as Text/Html (further conversion, e.g. to markdown is done later)
if (attachText && (textHtml || textPlain)) {
void createAttachment({
media: 'text', method, textPlain, textHtml,
});
return 'as_text';
}
if (attachText)
console.warn(`Unhandled '${method}' attachment: `, dt.types?.map(t => `${t}: ${dt.getData(t)}`));
// did not attach anything from this data transfer
return false;
}, [attachAppendFile, createAttachment, enableLoadURLs]);
const attachAppendEgoMessage = React.useCallback((blockTitle: string, textPlain: string, attachmentLabel: string) => {
if (ATTACHMENTS_DEBUG_INTAKE)
console.log('attachAppendEgo', { blockTitle, textPlain, attachmentLabel });
return createAttachment({
media: 'ego', method: 'ego-message', label: attachmentLabel, blockTitle: blockTitle, textPlain: textPlain,
});
}, [createAttachment]);
const attachAppendClipboardItems = React.useCallback(async () => {
// if there's an issue accessing the clipboard, show it passively
const clipboardItems = await getClipboardItems();
if (clipboardItems === null) {
addSnackbar({
key: 'clipboard-issue',
type: 'issue',
message: 'Clipboard empty or access denied',
overrides: {
autoHideDuration: 2000,
},
});
return;
}
// loop on all the clipboard items
for (const clipboardItem of clipboardItems) {
// https://github.com/enricoros/big-AGI/issues/286
const textHtml = clipboardItem.types.includes('text/html') ? await clipboardItem.getType('text/html').then(blob => blob.text()) : '';
const heuristicBypassImage = textHtml.startsWith('<table ');
if (ATTACHMENTS_DEBUG_INTAKE)
console.log(' - attachAppendClipboardItems.item:', clipboardItem, textHtml, heuristicBypassImage);
// attach as image
let imageAttached = false;
for (const mimeType of clipboardItem.types) {
if (mimeType.startsWith('image/') && !heuristicBypassImage) {
try {
const imageBlob = await clipboardItem.getType(mimeType);
const imageName = mimeType.replace('image/', 'clipboard.').replaceAll('/', '.') || 'clipboard.png';
const imageFile = new File([imageBlob], imageName, { type: mimeType });
void attachAppendFile('clipboard-read', imageFile);
imageAttached = true;
} catch (error) {
// ignore getType error..
}
}
}
if (imageAttached)
continue;
// get the Plain text
const textPlain = clipboardItem.types.includes('text/plain') ? await clipboardItem.getType('text/plain').then(blob => blob.text()) : '';
// attach as URL
if (textPlain && enableLoadURLs) {
const textPlainUrl = asValidURL(textPlain);
if (textPlainUrl && textPlainUrl.trim()) {
void createAttachment({
media: 'url', url: textPlainUrl.trim(), refUrl: textPlain,
});
continue;
}
}
// attach as Text
if (textHtml || textPlain) {
void createAttachment({
media: 'text', method: 'clipboard-read', textPlain, textHtml,
});
continue;
}
console.warn('Clipboard item has no text/html or text/plain item.', clipboardItem.types, clipboardItem);
}
}, [attachAppendFile, createAttachment, enableLoadURLs]);
return {
// state
attachments,
// create attachments
attachAppendClipboardItems,
attachAppendDataTransfer,
attachAppendEgoMessage,
attachAppendFile,
// manage attachments
clearAttachments,
removeAttachment,
};
};
@@ -1,149 +0,0 @@
import * as React from 'react';
import type { DLLMId } from '~/modules/llms/store-llms';
import { countModelTokens } from '~/common/util/token-counter';
import type { Attachment, AttachmentId } from './store-attachments';
import type { ComposerOutputMultiPart, ComposerOutputPartType } from '../composer.types';
export interface LLMAttachments {
attachments: LLMAttachment[];
collapseWithAttachment: (initialTextBlockText: string | null, attachmentId: AttachmentId) => ComposerOutputMultiPart;
collapseWithAttachments: (initialTextBlockText: string | null) => ComposerOutputMultiPart;
isOutputAttacheable: boolean;
isOutputTextInlineable: boolean;
tokenCountApprox: number;
}
export interface LLMAttachment {
attachment: Attachment;
attachmentOutputs: ComposerOutputMultiPart;
isUnconvertible: boolean;
isOutputMissing: boolean;
isOutputAttachable: boolean;
isOutputTextInlineable: boolean;
tokenCountApprox: number | null;
}
export function useLLMAttachments(attachments: Attachment[], chatLLMId: DLLMId | null): LLMAttachments {
return React.useMemo(() => {
// HACK: in the future, switch to LLM capabilities (LLM_IF_OAI_Chat, LLM_IF_OAI_Vision, etc.)
const supportsImages = !!chatLLMId?.endsWith('-vision-preview');
const supportedOutputPartTypes: ComposerOutputPartType[] = supportsImages ? ['text-block', 'image-part'] : ['text-block'];
const llmAttachments = attachments.map(attachment => toLLMAttachment(attachment, supportedOutputPartTypes, chatLLMId));
const collapseWithAttachment = (initialTextBlockText: string | null, attachmentId: AttachmentId): ComposerOutputMultiPart => {
// get outputs of a specific attachment
const outputs = attachments.find(a => a.id === attachmentId)?.outputs || [];
return attachmentCollapseOutputs(initialTextBlockText, outputs);
};
const collapseWithAttachments = (initialTextBlockText: string | null): ComposerOutputMultiPart => {
// accumulate all outputs of all attachments
const allOutputs = llmAttachments.reduce((acc, a) => acc.concat(a.attachment.outputs), [] as ComposerOutputMultiPart);
return attachmentCollapseOutputs(initialTextBlockText, allOutputs);
};
return {
attachments: llmAttachments,
collapseWithAttachment,
collapseWithAttachments,
isOutputAttacheable: llmAttachments.every(a => a.isOutputAttachable),
isOutputTextInlineable: llmAttachments.every(a => a.isOutputTextInlineable),
tokenCountApprox: llmAttachments.reduce((acc, a) => acc + (a.tokenCountApprox || 0), 0),
};
}, [attachments, chatLLMId]);
}
export function getSingleTextBlockText(outputs: ComposerOutputMultiPart): string | null {
const textOutputs = outputs.filter(part => part.type === 'text-block');
return (textOutputs.length === 1 && textOutputs[0].type === 'text-block') ? textOutputs[0].text : null;
}
function toLLMAttachment(attachment: Attachment, supportedOutputPartTypes: ComposerOutputPartType[], llmForTokenCount: DLLMId | null): LLMAttachment {
const { converters, outputs } = attachment;
const isUnconvertible = converters.length === 0;
const isOutputMissing = outputs.length === 0;
const isOutputAttachable = areAllOutputsSupported(outputs, supportedOutputPartTypes);
const isOutputTextInlineable = areAllOutputsSupported(outputs, supportedOutputPartTypes.filter(pt => pt === 'text-block'));
const attachmentOutputs = attachmentCollapseOutputs(null, outputs);
const tokenCountApprox = llmForTokenCount
? attachmentOutputs.reduce((acc, output) => {
if (output.type === 'text-block')
return acc + (countModelTokens(output.text, llmForTokenCount, 'attachments tokens count') ?? 0);
console.warn('Unhandled token preview for output type:', output.type);
return acc;
}, 0)
: null;
return {
attachment,
attachmentOutputs,
isUnconvertible,
isOutputMissing,
isOutputAttachable,
isOutputTextInlineable,
tokenCountApprox,
};
}
function areAllOutputsSupported(outputs: ComposerOutputMultiPart, supportedOutputPartTypes: ComposerOutputPartType[]) {
return outputs.length
? outputs.every(output => supportedOutputPartTypes.includes(output.type))
: false;
}
function attachmentCollapseOutputs(initialTextBlockText: string | null, outputs: ComposerOutputMultiPart): ComposerOutputMultiPart {
const accumulatedOutputs: ComposerOutputMultiPart = [];
// if there's initial text, make it a collapsible default (unquited) text block
if (initialTextBlockText !== null) {
accumulatedOutputs.push({
type: 'text-block',
text: initialTextBlockText,
title: null,
collapsible: true,
});
}
// Accumulate attachment outputs of the same type and 'collapsible' into a single object of that type.
for (const output of outputs) {
const last = accumulatedOutputs[accumulatedOutputs.length - 1];
// accumulationg over an existing part of the same type
if (last && last.type === output.type && output.collapsible) {
switch (last.type) {
case 'text-block':
last.text += `\n\n\`\`\`${output.title}\n${output.text}\n\`\`\``;
break;
default:
console.warn('Unhandled collapsing for output type:', output.type);
}
}
// start a new part
else {
if (output.type === 'text-block') {
// THIS IS NOT CORRECT - we seem to be doing it just for downstream token counting - FIX IT
// Do not serialize here
accumulatedOutputs.push({
type: 'text-block',
text: `\n\n\`\`\`${output.title}\n${output.text}\n\`\`\``,
title: null,
collapsible: false, // Wrong
});
} else {
accumulatedOutputs.push(output);
}
}
}
return accumulatedOutputs;
}
@@ -2,35 +2,49 @@ import * as React from 'react';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import AddAPhotoIcon from '@mui/icons-material/AddAPhoto';
import CameraAltOutlinedIcon from '@mui/icons-material/CameraAltOutlined';
import { buttonAttachSx } from '~/common/components/ButtonAttachFiles';
import { CameraCaptureModal } from '../CameraCaptureModal';
const attachCameraLegend = (isMobile: boolean) =>
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
<b>Attach photo</b><br />
{isMobile ? 'Auto-OCR to read text' : 'See the world, on the go'}
</Box>;
export const ButtonAttachCameraMemo = React.memo(ButtonAttachCamera);
function ButtonAttachCamera(props: { isMobile?: boolean, onOpenCamera: () => void }) {
function ButtonAttachCamera(props: {
isMobile?: boolean,
disabled?: boolean,
fullWidth?: boolean,
noToolTip?: boolean,
onOpenCamera: () => void,
}) {
return props.isMobile ? (
<IconButton onClick={props.onOpenCamera}>
<IconButton disabled={props.disabled} onClick={props.onOpenCamera}>
<AddAPhotoIcon />
</IconButton>
) : (
<Tooltip disableInteractive variant='solid' placement='top-start' title={attachCameraLegend(!!props.isMobile)}>
<Button fullWidth variant='plain' color='neutral' onClick={props.onOpenCamera} startDecorator={<AddAPhotoIcon />}
sx={{ justifyContent: 'flex-start' }}>
<Tooltip arrow disableInteractive placement='top-start' title={props.noToolTip ? null : (
<Box sx={buttonAttachSx.tooltip}>
<b>Attach photo</b><br />
{!!props.isMobile ? 'Auto-OCR to read text' : 'See the world, on the go'}
</Box>
)}>
<Button
variant='plain'
color='neutral'
disabled={props.disabled}
fullWidth={props.fullWidth}
startDecorator={<CameraAltOutlinedIcon />}
onClick={props.onOpenCamera}
sx={buttonAttachSx.desktop}
>
Camera
</Button>
</Tooltip>
);
}
export function useCameraCaptureModal(onAttachImage: (file: File) => void) {
export function useCameraCaptureModalDialog(onAttachImageStable: (file: File) => void) {
// state
const [open, setOpen] = React.useState(false);
@@ -40,9 +54,9 @@ export function useCameraCaptureModal(onAttachImage: (file: File) => void) {
const cameraCaptureComponent = React.useMemo(() => open && (
<CameraCaptureModal
onCloseModal={() => setOpen(false)}
onAttachImage={onAttachImage}
onAttachImage={onAttachImageStable}
/>
), [open, onAttachImage]);
), [open, onAttachImageStable]);
return {
openCamera,
@@ -4,29 +4,41 @@ import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import ContentPasteGoIcon from '@mui/icons-material/ContentPasteGo';
import { KeyStroke } from '~/common/components/KeyStroke';
const pasteClipboardLegend =
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
<b>Attach clipboard 📚</b><br />
Auto-converts to the best types<br />
<KeyStroke combo='Ctrl + Shift + V' sx={{ mt: 1, mb: 0.5 }} />
</Box>;
import { buttonAttachSx } from '~/common/components/ButtonAttachFiles';
export const ButtonAttachClipboardMemo = React.memo(ButtonAttachClipboard);
function ButtonAttachClipboard(props: { isMobile?: boolean, onClick: () => void }) {
function ButtonAttachClipboard(props: {
isMobile?: boolean,
disabled?: boolean,
fullWidth?: boolean,
noToolTip?: boolean,
onAttachClipboard: () => void,
}) {
return props.isMobile ? (
<IconButton onClick={props.onClick}>
<IconButton disabled={props.disabled} onClick={props.onAttachClipboard}>
<ContentPasteGoIcon />
</IconButton>
) : (
<Tooltip disableInteractive variant='solid' placement='top-start' title={pasteClipboardLegend}>
<Button fullWidth variant='plain' color='neutral' startDecorator={<ContentPasteGoIcon />} onClick={props.onClick}
sx={{ justifyContent: 'flex-start' }}>
<Tooltip arrow disableInteractive placement='top-start' title={props.noToolTip ? null : (
<Box sx={buttonAttachSx.tooltip}>
<b>Attach clipboard 📚</b><br />
Auto-converts to the best types<br />
<KeyStroke combo='Ctrl + Shift + V' sx={{ mt: 1, mb: 0.5 }} />
</Box>
)}>
<Button
variant='plain'
color='neutral'
disabled={props.disabled}
fullWidth={props.fullWidth}
startDecorator={<ContentPasteGoIcon />}
onClick={props.onAttachClipboard}
sx={buttonAttachSx.desktop}
>
Paste
</Button>
</Tooltip>
);
}
}
@@ -1,29 +0,0 @@
import * as React from 'react';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import AttachFileOutlinedIcon from '@mui/icons-material/AttachFileOutlined';
const attachFileLegend =
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
<b>Attach files</b><br />
Drag & drop in chat for faster loads
</Box>;
export const ButtonAttachFileMemo = React.memo(ButtonAttachFile);
function ButtonAttachFile(props: { isMobile?: boolean, onAttachFilePicker: () => void }) {
return props.isMobile ? (
<IconButton onClick={props.onAttachFilePicker}>
<AttachFileOutlinedIcon />
</IconButton>
) : (
<Tooltip disableInteractive variant='solid' placement='top-start' title={attachFileLegend}>
<Button fullWidth variant='plain' color='neutral' onClick={props.onAttachFilePicker} startDecorator={<AttachFileOutlinedIcon />}
sx={{ justifyContent: 'flex-start' }}>
File
</Button>
</Tooltip>
);
}
@@ -0,0 +1,44 @@
import * as React from 'react';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import AddRoundedIcon from '@mui/icons-material/AddRounded';
import { buttonAttachSx } from '~/common/components/ButtonAttachFiles';
export const ButtonAttachNewMemo = React.memo(ButtonAttachNew);
function ButtonAttachNew(props: {
isMobile?: boolean,
disabled?: boolean,
fullWidth?: boolean,
noToolTip?: boolean,
onAttachNew: () => void,
}) {
return props.isMobile ? (
<IconButton disabled={props.disabled} onClick={props.onAttachNew}>
<AddRoundedIcon />
</IconButton>
) : (
<Tooltip arrow disableInteractive placement='top-start' title={props.noToolTip ? null : (
<Box sx={buttonAttachSx.tooltip}>
<b>Create new document</b><br />
Edit your own empty document
{/*<br />*/}
{/*<KeyStroke combo='Ctrl + Alt + N' sx={{ mt: 1, mb: 0.5 }} />*/}
</Box>
)}>
<Button
variant='plain'
color='neutral'
disabled={props.disabled}
fullWidth={props.fullWidth}
startDecorator={<AddRoundedIcon />}
onClick={props.onAttachNew}
sx={buttonAttachSx.desktop}
>
New
</Button>
</Tooltip>
);
}
@@ -3,12 +3,20 @@ import * as React from 'react';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import ScreenshotMonitorIcon from '@mui/icons-material/ScreenshotMonitor';
import { Is } from '~/common/util/pwaUtils';
import { buttonAttachSx } from '~/common/components/ButtonAttachFiles';
import { takeScreenCapture } from '~/common/util/screenCaptureUtils';
export const ButtonAttachScreenCaptureMemo = React.memo(ButtonAttachScreenCapture);
function ButtonAttachScreenCapture(props: { isMobile?: boolean, onAttachScreenCapture: (file: File) => void }) {
function ButtonAttachScreenCapture(props: {
isMobile?: boolean,
disabled?: boolean,
fullWidth?: boolean,
noToolTip?: boolean,
onAttachScreenCapture: (file: File) => void
}) {
// state
const [capturing, setCapturing] = React.useState(false);
@@ -26,34 +34,36 @@ function ButtonAttachScreenCapture(props: { isMobile?: boolean, onAttachScreenCa
file && onAttachScreenCapture(file);
} catch (error: any) {
const message = error instanceof Error ? error.message : String(error);
setError(`Screen capture issue: ${message}`);
setError(`Issue: ${message}`);
}
setCapturing(false);
}, [onAttachScreenCapture]);
return props.isMobile ? (
<IconButton onClick={handleTakeScreenCapture}>
<IconButton disabled={props.disabled} onClick={handleTakeScreenCapture}>
<ScreenshotMonitorIcon />
</IconButton>
) : (
<Tooltip
arrow disableInteractive variant='solid' placement='top-start'
title={
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
<b>Attach screen capture</b><br />
{error || 'Attach the image of a window, a browser tab, or a screen'}
</Box>
}
>
<Tooltip arrow disableInteractive placement='top-start' title={props.noToolTip ? null : (
<Box sx={buttonAttachSx.tooltip}>
<b>Attach screen capture</b><br />
{error || 'Attach the image of a window, a browser tab, or a screen'}
{!error && Is.OS.MacOS && Is.Browser.Safari && (
<Box sx={{ mt: 1 }}><b>Safari</b>: canceling the window selection may cause a 60-second delay.</Box>
)}
</Box>
)}>
<Button
fullWidth
variant={capturing ? 'solid' : 'plain'}
color={!!error ? 'danger' : 'neutral'}
onClick={handleTakeScreenCapture}
disabled={props.disabled}
fullWidth={props.fullWidth}
loading={capturing}
loadingPosition={capturing ? 'start' : 'center'}
startDecorator={<ScreenshotMonitorIcon />}
sx={{ justifyContent: 'flex-start' }}
onClick={handleTakeScreenCapture}
sx={buttonAttachSx.desktop}
>
Screen
</Button>
@@ -0,0 +1,47 @@
import * as React from 'react';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import LanguageRoundedIcon from '@mui/icons-material/LanguageRounded';
import { buttonAttachSx } from '~/common/components/ButtonAttachFiles';
export const ButtonAttachWebMemo = React.memo(ButtonAttachWeb);
function ButtonAttachWeb(props: {
isMobile?: boolean,
disabled?: boolean,
fullWidth?: boolean,
noToolTip?: boolean,
onOpenWebInput: () => void,
}) {
const button = props.isMobile ? (
<IconButton disabled={props.disabled} onClick={props.onOpenWebInput}>
<LanguageRoundedIcon />
</IconButton>
) : (
<Button
variant='plain'
color='neutral'
disabled={props.disabled}
fullWidth={props.fullWidth}
startDecorator={<LanguageRoundedIcon />}
onClick={props.onOpenWebInput}
sx={buttonAttachSx.desktop}
>
Web
</Button>
);
return (props.noToolTip || props.isMobile) ? button : (
<Tooltip arrow disableInteractive placement='top-start' title={(
<Box sx={buttonAttachSx.tooltip}>
<b>Add Web Content 🌐</b><br />
Import from websites and YouTube
</Box>
)}>
{button}
</Tooltip>
);
}
@@ -1,6 +1,6 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import type { ColorPaletteProp, SxProps } from '@mui/joy/styles/types';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import { ChatBeamIcon } from '~/common/components/icons/ChatBeamIcon';
@@ -35,14 +35,20 @@ const desktopSx: SxProps = {
export const ButtonBeamMemo = React.memo(ButtonBeam);
function ButtonBeam(props: { isMobile?: boolean, disabled?: boolean, hasContent?: boolean, onClick: () => void }) {
function ButtonBeam(props: {
isMobile?: boolean,
color?: ColorPaletteProp,
disabled?: boolean,
hasContent?: boolean,
onClick: () => void,
}) {
return props.isMobile ? (
<IconButton variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} sx={mobileSx}>
<IconButton variant='soft' color={props.color ?? 'primary'} disabled={props.disabled} onClick={props.onClick} sx={mobileSx}>
<ChatBeamIcon />
</IconButton>
) : (
<Tooltip disableInteractive variant='solid' arrow placement='right' title={props.hasContent ? desktopLegend : desktopLegendNoContent}>
<Button variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} endDecorator={<ChatBeamIcon />} sx={desktopSx}>
<Button variant='soft' color={props.color ?? 'primary'} disabled={props.disabled} onClick={props.onClick} endDecorator={<ChatBeamIcon />} sx={desktopSx}>
Beam
</Button>
</Tooltip>
@@ -1,26 +1,52 @@
import * as React from 'react';
import { Box, IconButton } from '@mui/joy';
import { Alert, Box, IconButton } from '@mui/joy';
import { ColorPaletteProp, VariantProp } from '@mui/joy/styles/types';
import MicIcon from '@mui/icons-material/Mic';
import { ExternalDocsLink } from '~/common/components/ExternalDocsLink';
import { GoodTooltip } from '~/common/components/GoodTooltip';
import { KeyStroke } from '~/common/components/KeyStroke';
const micLegend =
const micLegend = (errorMessage: string | null) =>
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
Voice input<br />
<KeyStroke combo='Ctrl + M' sx={{ mt: 1, mb: 0.5 }} />
{errorMessage && (
<Alert variant='soft' color='danger' sx={{ mt: 2, mb: 0.5, flexDirection: 'column', alignItems: 'flex-start' }}>
{errorMessage}
<ExternalDocsLink color='danger' level='body-sm' docPage='help-feature-microphone'>
How to fix...
</ExternalDocsLink>
</Alert>
)}
</Box>;
export const ButtonMicMemo = React.memo(ButtonMic);
function ButtonMic(props: { variant: VariantProp, color: ColorPaletteProp, noBackground?: boolean, onClick: () => void }) {
return <GoodTooltip placement='top' title={micLegend}>
<IconButton variant={props.variant} color={props.color} onClick={props.onClick} sx={props.noBackground ? { background: 'none' } : {}}>
<MicIcon />
</IconButton>
</GoodTooltip>;
function ButtonMic(props: {
variant: VariantProp,
color: ColorPaletteProp,
errorMessage: string | null,
noBackground?: boolean,
onClick: () => void,
}) {
// Mobile: don't blur the textarea when clicking the mic button
const handleDontBlurTextArea = React.useCallback((event: React.MouseEvent) => {
const isTextAreaFocused = document.activeElement?.tagName === 'TEXTAREA';
// If a textarea is focused, prevent the default blur behavior
if (isTextAreaFocused)
event.preventDefault();
}, []);
return (
<GoodTooltip placement='top' arrow enableInteractive title={micLegend(props.errorMessage)}>
<IconButton variant={props.variant} color={props.color} onMouseDown={handleDontBlurTextArea} onClick={props.onClick} sx={props.noBackground ? { background: 'none' } : {}}>
<MicIcon />
</IconButton>
</GoodTooltip>
);
}
@@ -2,8 +2,8 @@ import * as React from 'react';
import { Box, IconButton, Tooltip } from '@mui/joy';
import { ColorPaletteProp, SxProps, VariantProp } from '@mui/joy/styles/types';
import AutoModeIcon from '@mui/icons-material/AutoMode';
import RepeatIcon from '@mui/icons-material/Repeat';
import RepeatOnIcon from '@mui/icons-material/RepeatOn';
const micContinuationLegend =
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
@@ -13,10 +13,10 @@ const micContinuationLegend =
export const ButtonMicContinuationMemo = React.memo(ButtonMicContinuation);
function ButtonMicContinuation(props: { variant: VariantProp, color: ColorPaletteProp, onClick: () => void, sx?: SxProps }) {
function ButtonMicContinuation(props: { isActive: boolean, variant: VariantProp, color: ColorPaletteProp, onClick: () => void, sx?: SxProps }) {
return <Tooltip placement='bottom' title={micContinuationLegend}>
<IconButton variant={props.variant} color={props.color} onClick={props.onClick} sx={props.sx}>
<AutoModeIcon />
{props.isActive ? <RepeatOnIcon /> : <RepeatIcon />}
</IconButton>
</Tooltip>;
}

Some files were not shown because too many files have changed in this diff Show More