Compare commits

..

943 Commits

Author SHA1 Message Date
Enrico Ros 1744b5b9d0 Throw if function calling on a model that doesn't support it 2024-06-07 12:15:25 -07:00
Enrico Ros 0c15476dd2 1.16.2: release 2024-06-06 22:10:27 -07:00
Enrico Ros 94ef76c67e Gemini: update
(cherry picked from commit 3050b546ac)
2024-06-06 21:42:47 -07:00
Enrico Ros bd5bf6f94f Gemini: update
(cherry picked from commit 1429726ba6)
2024-06-06 21:42:47 -07:00
Enrico Ros 1fbf454c3c Add Codestral - Fixes #558
(cherry picked from commit 4075581acd)
2024-06-06 21:42:47 -07:00
Enrico Ros 07b62fe5c1 Streaming uplink: index sources for unification. 2024-06-06 21:42:47 -07:00
Enrico Ros 7fbf6ee2e8 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
(cherry picked from commit baad3ae1c3)
2024-06-06 21:41:04 -07:00
Enrico Ros ba66fc30c5 Fix TimeoutError issue
(cherry picked from commit 7c099cab94)
2024-06-06 21:41:04 -07:00
Enrico Ros 45b7ed3220 Mistral: update pricing
(cherry picked from commit 05aa4b547f)
2024-06-06 21:41:04 -07:00
Enrico Ros 20f1c4c0ae Mistral: update
#518

(cherry picked from commit 6afb61d25d)
2024-06-06 21:41:04 -07:00
Enrico Ros 97b6fc5e2b Already Set
(cherry picked from commit a7ce5c1ca6)
2024-06-06 21:41:04 -07:00
Enrico Ros 44d8c30187 Start opened
(cherry picked from commit 952bd2bd93)
2024-06-06 21:41:04 -07:00
Enrico Ros e3957bf08b Page download: improve
(cherry picked from commit f9d33d4888)
2024-06-06 21:41:03 -07:00
Enrico Ros acfe0aba21 Beam: bits
(cherry picked from commit 81d99f19d4)
2024-06-06 21:41:03 -07:00
Enrico Ros 6247b5411b Beam: recall importing rays
(cherry picked from commit 454a4257da)
2024-06-06 21:41:03 -07:00
Enrico Ros 5cc0b0a011 Beam: fix reactive bug
(cherry picked from commit e513b42786)
2024-06-06 21:41:03 -07:00
Enrico Ros 1fed2fb18c Beam: if auto-start, give the chance to change merge model
(cherry picked from commit b607e3c034)
2024-06-06 21:41:03 -07:00
Enrico Ros 8a0e7a4e3d Tiktoken: in the future, show tokens
(cherry picked from commit d5c3f5012b)
2024-06-06 21:41:03 -07:00
Enrico Ros 29a784c6c6 Update TikToken for perfect token computation on 'o' models.
(cherry picked from commit 21d045be59)
2024-06-06 21:41:03 -07:00
Enrico Ros 409a3ee194 DChat: remove IDB migration
(cherry picked from commit 44ab0483b6)
2024-06-06 21:41:03 -07:00
Enrico Ros 54caa3e01a Gemini: improve support (incl. interfaces, cost, visibility)
(cherry picked from commit 9eb0cc0b62)
2024-06-06 21:41:03 -07:00
Enrico Ros e1a723a39f (bits)
(cherry picked from commit 2db74867f5)
2024-06-06 21:41:03 -07:00
Enrico Ros 463ea35d7c Default to the full context window
(cherry picked from commit fd30baafb8)
2024-06-06 21:41:03 -07:00
Enrico Ros f751c91c68 Browse: improve markdown transform
(cherry picked from commit 3623eef47f)
2024-06-06 21:41:03 -07:00
Enrico Ros ad24c8771a Browse: full support for markdown transform
(cherry picked from commit 7b07bb7884)
2024-06-06 21:41:03 -07:00
Enrico Ros 6f82e2c3ed Browse: markdown transform as default
(cherry picked from commit 7946cd6614)
2024-06-06 21:41:03 -07:00
Enrico Ros f4b39071f0 Browse: support transform (skel)
(cherry picked from commit 51b6e30986)
2024-06-06 21:41:03 -07:00
Enrico Ros 621c968f3f Hold Shift to delete without confirmation: fixes #537
(cherry picked from commit 002df7b0f9)
2024-06-06 21:41:03 -07:00
Enrico Ros 564cf0fed0 1.16.1: default:hidden on the first Turbo 2024-05-13 12:04:31 -07:00
Enrico Ros dee9492d4c 1.16.0: update 2024-05-13 12:02:02 -07:00
Enrico Ros 6ae026f7c5 OpenAI: un-star Turbo 2024-05-13 11:49:10 -07:00
Enrico Ros 6bcbe286f3 OpenAI: add support for 'o' models 2024-05-13 11:47:55 -07:00
Enrico Ros 6f35f72607 Beam: auto-merge 2024-05-12 23:39:06 -07:00
Enrico Ros 3a7aa75538 Soft-wrap as a global preference. Fixes #517 2024-05-10 04:05:50 -07:00
Enrico Ros e4e7ac260a pdfjs: image generation (just in case) 2024-05-10 02:46:28 -07:00
Enrico Ros b8aaa4bb42 pdfjs: better parsing (for humans) 2024-05-10 02:19:45 -07:00
Enrico Ros 7793e2694b pdfjs: roll 2024-05-10 02:19:32 -07:00
Enrico Ros 83f2c72f29 Roll packages 2024-05-10 01:38:56 -07:00
Enrico Ros 1caeaee7f0 1.16.0: update News 2024-05-09 01:00:53 -07:00
Enrico Ros f354134234 Update README 2024-05-09 00:56:50 -07:00
Enrico Ros 66219d30e0 ReplyTo: fix bubble 2024-05-09 00:48:24 -07:00
Enrico Ros b9e3942ed8 ChatMessage: fix broken overflow 2024-05-09 00:18:29 -07:00
Enrico Ros 2354cdc1d1 ReplyTo: render in ChatMessage 2024-05-09 00:18:21 -07:00
Enrico Ros d929438df9 ReplyTo: extract 2024-05-09 00:09:17 -07:00
Enrico Ros 1acaed1de7 ReplyTo: Move Bubble 2024-05-09 00:03:22 -07:00
Enrico Ros 16195f8a55 ReplyTo: works 100 for OpenAI, ok for Anthropic, exposes Chat sequencing issues for a couple 2024-05-09 00:00:37 -07:00
Enrico Ros d7fc8c178f 1.16.0: enable cost by default 2024-05-08 15:39:03 -07:00
Enrico Ros 2894e16706 Merge branch 'release-1.16.0' 2024-05-08 15:11:10 -07:00
Enrico Ros c2340f3432 1.16.0: README 2024-05-08 15:03:32 -07:00
Enrico Ros 3b7b3106db Misc 2024-05-08 14:37:31 -07:00
Enrico Ros cff92819f9 1.16.0: News 2024-05-08 14:13:01 -07:00
Enrico Ros 2f981d852b Show message costs (option) 2024-05-08 13:11:21 -07:00
Enrico Ros 8eef74d776 1.16.0: version 2024-05-08 11:53:56 -07:00
Enrico Ros 60e46204dc Update default contextWindow to 8192
And override as per https://github.com/enricoros/big-AGI/pull/518#issuecomment-2090736347
2024-05-07 04:44:38 -07:00
Enrico Ros 6a5d783435 Show Costs on Hover. #480, #341 2024-05-07 04:33:39 -07:00
Enrico Ros 0223e076c4 LLM Options: improve 2024-05-07 03:54:28 -07:00
Enrico Ros ce80c78319 1.16.0: disable Reply-To (note: full in a different branch) 2024-05-07 02:55:14 -07:00
Enrico Ros cc0085ae61 Group vendors (disabled) 2024-05-07 02:46:41 -07:00
Enrico Ros f28e243b9d Chat: perfect execution error reporting, Fixes #523 2024-05-07 02:19:54 -07:00
Enrico Ros 2e4532593f Toggle JSON mode, Fixes #515 2024-05-07 00:58:02 -07:00
Enrico Ros 1f10905a03 Fix model temperaturs 2024-05-07 00:47:11 -07:00
Enrico Ros 88762db484 Anthropic: more precise usage link to show the token usage. Fixes #524 2024-05-06 23:48:41 -07:00
Enrico Ros 3b5ab0ac70 Beam: fix relaxed parsing. Fixes #528 2024-05-06 23:45:34 -07:00
Enrico Ros 8903c9296b OpenRouter: update parser 2024-05-06 22:56:09 -07:00
Enrico Ros 97858a3c94 docs/installation: mention optionality 2024-05-06 22:26:40 -07:00
Enrico Ros 0ec3e83518 Merge pull request #521 from dandv/patch-1
Docs: fix command to run local build
2024-05-06 22:25:51 -07:00
Enrico Ros 8c007b5bf7 Merge pull request #522 from dandv/patch-2
E: grammar in OpenAISourceSetup.tsx
2024-05-06 22:21:46 -07:00
Enrico Ros 768236b0e2 Merge pull request #525 from PrivTEC/patch-1
Correct typo in config-feature-browse.md
2024-05-06 22:20:18 -07:00
Enrico Ros 495d78b885 Perplexity: update models, with the ne online models 2024-05-06 21:20:02 -07:00
Enrico Ros 34b1e515fe Figure out unused model vendors 2024-05-06 21:04:02 -07:00
PrivTEC 79edbd3fa5 Correct typo in config-feature-browse.md
Corrected the typo from "proyy" to "proxy" in the file `config-feature-browse.md`. This change addresses a small, but significant error in the configuration documentation.
2024-05-06 03:51:04 +02:00
Dan Dascalescu f50d9994e2 E: grammar in OpenAISourceSetup.tsx 2024-05-04 22:22:34 +03:00
Dan Dascalescu 1603d3085f Docs: fix command to run local build 2024-05-04 22:16:12 +03:00
Enrico Ros ccf7036f33 Longer timeouts 2024-05-02 00:43:10 -07:00
Enrico Ros a0a1a5e3c1 Update the proxy desc 2024-05-02 00:09:17 -07:00
Enrico Ros fbf9120859 Default to llama3 2024-05-01 23:59:09 -07:00
Enrico Ros 8a770beec3 Update Ollama models 2024-05-01 23:05:30 -07:00
Enrico Ros 6b31669765 Fix diagrams in Dark mode. Fixes #520 2024-05-01 22:54:53 -07:00
Enrico Ros 26d72fc2d8 DMesage: add metadata 2024-04-25 22:17:36 -07:00
Enrico Ros 5eb56d0994 Move Diff'er. 2024-04-25 22:16:14 -07:00
Enrico Ros dbc4a922d5 Message Toolbar: good looking too. 2024-04-25 22:15:20 -07:00
Enrico Ros 141f423842 Diagrams: auto-switch 2024-04-25 22:15:00 -07:00
Enrico Ros 667f2433ab Diagrams: enter 2024-04-25 22:14:59 -07:00
Enrico Ros fd930ef548 Message Toolbar: fix disappearance 2024-04-25 22:14:49 -07:00
Enrico Ros 7eadfb1a63 E: PageDrawerHeader style 2024-04-25 22:11:28 -07:00
Enrico Ros 67cb07ac92 E: Style 2024-04-25 21:53:10 -07:00
Enrico Ros 96d28c43fc Manifest: update 2024-04-25 18:38:56 -07:00
Enrico Ros e57e3f5f0a Code: soft wrap. Closes #517 2024-04-25 11:41:34 -07:00
Enrico Ros 7b99bd71da Update overlay buttons 2024-04-25 11:36:58 -07:00
Enrico Ros 861a037321 Tweaks 2024-04-24 18:51:40 -07:00
Enrico Ros 84cbe6c434 RenderCode: title looks 2024-04-24 18:33:45 -07:00
Enrico Ros 2cbb811523 RenderCode: fix titles 2024-04-24 12:32:17 -07:00
Enrico Ros 8ef4faa10f Llms: update 'latest' 2024-04-24 12:25:34 -07:00
Enrico Ros f6a1c9bf52 Diagrams: fix centering 2024-04-24 03:42:50 -07:00
Enrico Ros 5d9f6fb4f5 Code blocks: undo the removal of ? 2024-04-24 03:31:00 -07:00
Enrico Ros 66840a8ecd Diagrams: center Mermaid and PlantUML diagrams 2024-04-24 03:30:28 -07:00
Enrico Ros a8ee6b255a Diagrams: improve hotfixes for Haiku and 3.5 2024-04-24 03:30:16 -07:00
Enrico Ros bd73d1c533 Diagrams: improve prompts 2024-04-24 03:30:05 -07:00
Enrico Ros e33c0ebc42 Fix code block separation in case of nested blocks. 2024-04-24 02:42:43 -07:00
Enrico Ros 57e4a35fee AppChat: extract chat executor (1st step) 2024-04-24 01:59:49 -07:00
Enrico Ros d490b57410 Diagrams: improve instructions 2024-04-24 01:59:08 -07:00
Enrico Ros 0416602e5f Diagrams: improve dialog 2024-04-24 01:59:01 -07:00
Enrico Ros ddc27b2eb9 BlockCode: improve looks 2024-04-24 01:36:32 -07:00
Enrico Ros 374deb147b Composer: improve ReplyTo integration 2024-04-24 00:03:30 -07:00
Enrico Ros d2eabd1ad0 Composer: correctness of activation 2024-04-24 00:02:42 -07:00
Enrico Ros efbc625cc3 Composer: onAction callback 2024-04-23 23:52:09 -07:00
Enrico Ros 91ae0b8cb0 Codeblocks: broader inclusion of filenames 2024-04-23 23:46:20 -07:00
Enrico Ros ddc5741b00 Attachments: getCollapsedAttachments 2024-04-23 23:18:39 -07:00
Enrico Ros 4729aca6b0 ReplyTo: improve bubble 2024-04-23 22:56:05 -07:00
Enrico Ros bb4fc3a70c Anthropic: relax key validation on custom deployments. Closes #511 2024-04-23 20:32:08 -07:00
Enrico Ros 5d8084b650 Llms: streaming: cleanups 2024-04-23 05:07:55 -07:00
Enrico Ros f316b892f5 Revert "Llms: fix Streaming timeouts (2)"
This reverts commit cbda1d7cd0.
2024-04-23 03:15:07 -07:00
Enrico Ros cbda1d7cd0 Llms: fix Streaming timeouts (2) 2024-04-23 02:07:20 -07:00
Enrico Ros 2f8e879976 Llms: fix Streaming timeouts 2024-04-23 01:45:27 -07:00
Enrico Ros cc0ac5ae3c React: fix llm naming 2024-04-22 23:59:30 -07:00
Enrico Ros 0185d24fb3 Beam: improve Merge disablement 2024-04-22 23:59:08 -07:00
Enrico Ros 97dbdc9c31 Beam: improve inlining (not ready yet) 2024-04-22 23:58:26 -07:00
Enrico Ros a07c66c9a3 Beam: lay down some inlining code 2024-04-22 21:49:14 -07:00
Enrico Ros 308bd25bc0 Beam: improve Tutorial 2024-04-22 21:48:00 -07:00
Enrico Ros 70066a03b6 Explainer Carousel: improvements 2024-04-22 21:44:17 -07:00
Enrico Ros a7f3872af3 Beam: update bar icons 2024-04-22 16:38:26 -07:00
Enrico Ros 22e10e675a RMB on Chat Avatar brings up the menu 2024-04-22 16:31:30 -07:00
Enrico Ros 89679e946d Beam: remove optionality (/beam, chat mode, composer button & shortcut, message beam from) 2024-04-22 16:12:09 -07:00
Enrico Ros 1d1bb9d3df Beam: explain a possible missing user message 2024-04-22 15:58:39 -07:00
Enrico Ros 8faf2b2595 Beam: move scroll button to the Gather pane 2024-04-22 15:58:18 -07:00
Enrico Ros e47ad9700e Anthropic: workaround for history[0] being assistant 2024-04-22 15:40:48 -07:00
Enrico Ros 372b19a057 Formulas: fix rendering for OpenAI-style inline '\(' and block '\[' latex. Fixes #508 2024-04-22 04:39:12 -07:00
Enrico Ros cbe156a868 Merge branch 'refs/heads/main-stable' 2024-04-22 02:57:08 -07:00
Enrico Ros 181a3881e2 Groq: update models
(cherry picked from commit 3eef03b303)
2024-04-22 02:56:47 -07:00
Enrico Ros 3eef03b303 Groq: update models 2024-04-22 02:52:19 -07:00
Enrico Ros ad56e3165c Beam: fix pixel-bound loading of presets 2024-04-22 02:27:07 -07:00
Enrico Ros b1a96b6e75 Beam: clear heuristics for llm selection 2024-04-22 02:26:48 -07:00
Enrico Ros 56419b1b4e Beam: persist the last configuration 2024-04-22 02:19:17 -07:00
Enrico Ros 372f14a9c5 Beam: auto-configure from Elo 2024-04-22 01:01:43 -07:00
Enrico Ros e1ec56a120 Beam: remove fallbackLlmId 2024-04-22 01:01:33 -07:00
Enrico Ros 5bb11249d6 Beam: remove reactive (view-based) ray conf 2024-04-22 01:01:17 -07:00
Enrico Ros 9fbcca1ff2 Llms: avoid name clash 2024-04-22 00:54:41 -07:00
Enrico Ros 323f2b2c3e Llms: cleaner 2024-04-22 00:52:56 -07:00
Enrico Ros b971d38dd5 Llms: heuristic to auto-pick the best diverse LLMs 2024-04-22 00:49:06 -07:00
Enrico Ros 278f479a3a Beam: rename terminate 2024-04-22 00:48:36 -07:00
Enrico Ros 03aea5678d Llms: misc 2024-04-22 00:17:49 -07:00
Enrico Ros b62b8ee7e6 Beam: App: fix state 2024-04-22 00:12:49 -07:00
Enrico Ros 63f55551e5 Beam: gather show all prompts 2024-04-21 23:30:41 -07:00
Enrico Ros b185fbc57d Beam: fallback llm Id 2024-04-21 23:24:52 -07:00
Enrico Ros ceb9d58e72 Beam: fix import rays 2024-04-21 23:10:47 -07:00
Enrico Ros a0bb515a4f Beam: minor bits 2024-04-21 22:28:36 -07:00
Enrico Ros 2cfac2f18b Beam: combine two menus into one 2024-04-21 22:05:08 -07:00
Enrico Ros d412f538b2 Make it more explicit we're only not rolling this one. 2024-04-21 21:30:26 -07:00
Enrico Ros 94f90ad861 Roll packages, but hold Next back. 2024-04-21 21:22:47 -07:00
Enrico Ros 4a402e7937 Roll pdfjs 2024-04-21 21:19:30 -07:00
Enrico Ros c226d6c391 Lock Next to 14.1, as 14.2 introduces the async/await messages when running/building, and we don't know what it means yet.
"The generated code contains 'async/await' because this module is using "topLevelAwait"."

See: https://github.com/vercel/next.js/issues/64792
2024-04-21 21:17:24 -07:00
Enrico Ros 67410e6c59 Revert "Roll packages." - Next v14.2.2 shows some async/await messages.
See https://github.com/vercel/next.js/issues/64792

This reverts commit 419c361147.
2024-04-21 21:12:32 -07:00
Enrico Ros 419c361147 Roll packages. 2024-04-21 20:39:56 -07:00
Enrico Ros 3769a53ffa Merge pull request #507 from mludvig/arm-build-1
Build multi-arch docker image for x64-64 and ARM64
2024-04-15 22:04:07 -07:00
Michael Ludvig ec4aaa3bfb Cleanup 2024-04-16 16:51:57 +12:00
Michael Ludvig be52680fcd Put back hashes and comments 2024-04-16 16:20:48 +12:00
Michael Ludvig 9d41ab9339 Merge branch 'enricoros:main' into arm-build-1 2024-04-16 12:36:23 +12:00
Michael Ludvig f126fc3087 Cleanup 2024-04-16 11:52:58 +12:00
Michael Ludvig 764377037c Disabled arm 32 again (not supported by Prisma) 2024-04-16 11:22:15 +12:00
Michael Ludvig 8e09eaab45 Add sha tag 2024-04-16 11:10:32 +12:00
Michael Ludvig 6523da186c Update versions, add arm32 2024-04-16 10:29:18 +12:00
Michael Ludvig 6471fd8b6f Enable action 2024-04-16 10:01:41 +12:00
Michael Ludvig 247a74881a Added buildx support 2024-04-15 11:34:42 +12:00
Enrico Ros 3ef09f0a5f Models: upgrade data structure to v2 - auto-pick 2024-04-12 05:50:46 -07:00
Enrico Ros b924d331f9 Models: upgrade data structure to v2 2024-04-12 05:36:18 -07:00
Enrico Ros 14041b6012 Beam: simplify a bit 2024-04-12 03:44:54 -07:00
Enrico Ros 2c6cc5ecec Cleanup models update logic 2024-04-12 02:44:14 -07:00
Enrico Ros ac022b1df0 Models: adding prices and benchmarks for a few models 2024-04-12 02:09:14 -07:00
Enrico Ros 0a2081de08 Better Beam Hint 2024-04-12 01:06:25 -07:00
Enrico Ros 64a8e554c7 Designer update 2024-04-12 00:46:58 -07:00
Enrico Ros 082d29fd2f Improve style 2024-04-12 00:45:00 -07:00
Enrico Ros ba5cf9d002 Composer: show the bubble 2024-04-12 00:22:55 -07:00
Enrico Ros 57a55318df Stabilize 2024-04-12 00:07:40 -07:00
Enrico Ros e70f4f7a59 ChatMessageList: this side is probably done 2024-04-11 21:10:56 -07:00
Enrico Ros 1d217fad67 Warning 2024-04-11 21:10:39 -07:00
Enrico Ros e95d46f085 ConversationHandler: prepare chat overlays 2024-04-11 21:08:04 -07:00
Enrico Ros f4577878e1 ChatMessage: Reply on 2024-04-11 20:36:32 -07:00
Enrico Ros 1bd1e5c8e3 ChatMessage: Toolbar complete 2024-04-11 20:19:30 -07:00
Enrico Ros c975dee965 ChatMessageList: remove menu items if t2i off 2024-04-11 19:22:03 -07:00
Enrico Ros 9d690f4219 ChatMessage: fix double-closure 2024-04-11 18:22:12 -07:00
Enrico Ros 29ddb3f58d ChatMessage: improve menu 2024-04-11 18:12:44 -07:00
Enrico Ros 8626bc0b1c BlocksRenderer: selection color 2024-04-11 18:12:37 -07:00
Enrico Ros c362cf6596 Propagate information on whether this can be spoken 2024-04-11 17:52:50 -07:00
Enrico Ros 97264fc5ff ChatMessage: toolbar framework 2024-04-11 17:04:44 -07:00
Enrico Ros 494c4409c1 BlocksRenderer: more v-padding for an improved mouse-up behavior 2024-04-11 16:40:47 -07:00
Enrico Ros d46e366c81 Blocks Renderer: use refs 2024-04-11 13:16:13 -07:00
Enrico Ros 6afe33ee9c decolor 2024-04-11 10:13:54 -07:00
Enrico Ros 903c9e1cc3 Improve options 2024-04-11 10:12:03 -07:00
Enrico Ros 3ef43fc3f5 Merge branch 'joriskalz-chat-with-youtube' 2024-04-11 09:58:56 -07:00
Enrico Ros b1c3be05dd Integrate YouTube transcriber (hidden by default) 2024-04-11 09:58:45 -07:00
Enrico Ros efee23b4a7 Update shadows 2024-04-11 09:49:13 -07:00
Enrico Ros 06b67a7586 Merge branch 'chat-with-youtube' of https://github.com/joriskalz/big-AGI-dev into joriskalz-chat-with-youtube 2024-04-11 09:33:56 -07:00
Joris Kalz 889a2dbf9d Remvoved unwanted new line. 2024-04-11 11:45:03 +01:00
Joris Kalz 2f80fcc888 Removed comments 2024-04-11 11:43:54 +01:00
Joris Kalz f7ee479c1d Removed comments 2024-04-11 11:36:27 +01:00
Joris Kalz 94fa0981fe Update YouTube Transcriber voiceId in data.ts 2024-04-11 11:33:55 +01:00
Joris Kalz 4c74afe438 Update YouTube Transcriber system message in data.ts 2024-04-11 11:33:42 +01:00
Joris Kalz f76cea22de Fix YouTube Transcriber activation bug in PersonaSelector component 2024-04-10 22:18:35 +01:00
Joris Kalz 3d49110808 Implement handleAddMessage function in PersonaSelector component 2024-04-10 22:14:15 +01:00
Joris Kalz 88a4579f7a Refactor PersonaSelector component to handle YouTube Transcriber tile click 2024-04-10 22:00:29 +01:00
Joris Kalz 241bde0333 Update YouTubeURLInput component to handle YouTube video transcripts 2024-04-10 21:48:20 +01:00
Joris Kalz 73c7867cd6 Add YouTube Transcriber persona and handle YouTube Transcriber tile click 2024-04-10 11:53:48 +01:00
Enrico Ros b35254f7ad Qol 2024-04-10 03:14:15 -07:00
Enrico Ros 213e78c956 Beam: save the merge model, and shrink rays when loading a smaller preset 2024-04-10 03:01:18 -07:00
Enrico Ros 7bf552c491 1.15.1 2024-04-10 01:09:25 -07:00
Enrico Ros 3bf9923f86 Update README 2024-04-10 01:03:06 -07:00
Enrico Ros a6a8a28f59 Update models pricing 2024-04-10 00:33:16 -07:00
Enrico Ros 56a8e452bf OpenAI: 2024-04-09 models 2024-04-10 00:17:08 -07:00
Enrico Ros 6bec0bf70d Models: precise id matching 2024-04-09 23:15:17 -07:00
Enrico Ros 5dc9c8f90e Gemini: support Pro 1.5 2024-04-09 22:41:05 -07:00
Enrico Ros e3290e12b1 Fix mic layout 2024-04-09 22:37:47 -07:00
Enrico Ros 9f37ce9e42 Warn if clipboard access is prevented 2024-04-09 19:49:52 -07:00
Enrico Ros 8904c0c811 E: Consistent file names, shortcuts. 2024-04-09 19:40:56 -07:00
Enrico Ros b0d021b7f2 E: Ctrl+O opens chat file 2024-04-09 17:41:53 -07:00
Enrico Ros 0175f3b8a1 E: Manifest File Handlers 2024-04-09 17:04:48 -07:00
Enrico Ros 0fa9d5bf62 E: Save conversations. Closes #466 2024-04-09 16:44:40 -07:00
Enrico Ros 4919e38e3e OpenAI-derivatives: Remove UI validation - never helped. Fixes #446 2024-04-09 16:28:09 -07:00
Enrico Ros 2e99533f96 Fit on mobile 2024-04-09 16:21:05 -07:00
Enrico Ros f095645d89 Merge pull request #498 from dogmatic69/trailing-whitespace
chore: remove trailing whitespace
2024-04-09 01:48:19 -07:00
Enrico Ros 757c83142e Merge pull request #497 from dogmatic69/env-docs
chore: link to env docs
2024-04-09 01:47:50 -07:00
Carl Sutton 36d274ca9f chore: remove trailing whitespace 2024-04-09 10:13:35 +02:00
Carl Sutton ec11b61f67 chore: link to env docs 2024-04-09 10:09:37 +02:00
Enrico Ros 7765271d63 PPLX: fix alternation 2024-04-09 00:55:04 -07:00
Enrico Ros 7c2464bba7 PPLX: fix models 2024-04-09 00:32:27 -07:00
Enrico Ros 17e010f93c Anthropic: fix empty messages 2024-04-09 00:19:48 -07:00
Enrico Ros 452d630a2a Tryfix for the Autocomplete 2024-04-08 23:39:06 -07:00
Enrico Ros f317a3e38f Test client-side fetch (no cors) 2024-04-08 22:15:15 -07:00
Enrico Ros f56195058e Fix ssr issue 2024-04-08 22:13:46 -07:00
Enrico Ros 2e93dbb10c Improve Error reporting 2024-04-08 21:01:57 -07:00
Enrico Ros f862456d73 Decrease errors 2024-04-08 18:52:11 -07:00
Enrico Ros d99b0b2137 Reduce errors 2024-04-08 18:43:01 -07:00
Enrico Ros 1d390f9aa7 3,000 2024-04-07 16:18:45 -07:00
Enrico Ros 514beb7940 Merge pull request #492 from enricoros/main
Update BeamFusionGrid.tsx
2024-04-06 16:48:46 -07:00
Enrico Ros c7bdfce734 Update BeamFusionGrid.tsx 2024-04-06 16:47:36 -07:00
Enrico Ros e5fe4b06ad Show warning for non-US merges 2024-04-06 15:58:38 -07:00
Enrico Ros 89b7c265d3 show URL attachments as well 2024-04-06 15:41:35 -07:00
Enrico Ros 698c31943e Centralize Lang 2024-04-06 14:27:21 -07:00
Enrico Ros b70060d46e Beam: understand tutorial usage 2024-04-06 14:27:10 -07:00
Enrico Ros 6ddc5ef53e Roll packages 2024-04-06 13:57:57 -07:00
Enrico Ros 212023c7e4 Merge pull request #484
Update README.md (Added Midori AI subsystem to the readme)
2024-04-05 18:30:32 -07:00
Enrico Ros b687f23c95 Anthropic: server status. #485 2024-04-05 14:07:13 -07:00
Luna Midori 7a05d01554 Update README.md 2024-04-03 15:17:43 -07:00
Enrico Ros 78e3a57857 parsing of HTML code blocks 2024-04-02 21:07:35 -07:00
Enrico Ros 79d0c96b20 Gemini: call out RECITATIONS 2024-04-02 20:53:26 -07:00
Enrico Ros 21ed38a20e DuoTonal for AI functions 2024-04-02 19:20:35 -07:00
Enrico Ros d8b1f99114 Divider 2024-04-02 18:42:33 -07:00
Enrico Ros b0fb1b9890 Fix build 2024-04-02 01:48:11 -07:00
Enrico Ros a63932cff2 Show HTML code when beaming, by default 2024-04-02 01:42:06 -07:00
Enrico Ros 0b22165d2a Beam: remove link 2024-04-02 01:29:23 -07:00
Enrico Ros 41b1951abe Merge pull request #481 from aj47/patch-1
Update README.md typo
2024-04-01 23:41:37 -07:00
AJ (@techfren) 353431e54c Update README.md 2024-04-02 17:41:08 +11:00
Enrico Ros 7b232dd7d8 Renamed vercel.json to vercel_PRODUCTION.json to get it out of the way and fix #468
Fix #468 once and for all. Documentation on the env
2024-04-01 18:05:27 -07:00
Enrico Ros d32adf9dbf 1.15.0: Add hackernews callout 2024-04-01 17:17:33 -07:00
Enrico Ros 940d490217 1.15.0: Beam News improved copy 2024-04-01 15:29:08 -07:00
Enrico Ros 46e41e38cf 1.15.0: Beam News callout 2024-04-01 15:15:52 -07:00
Enrico Ros 276ff8f995 Merge branch 'release-1.15.0' 2024-04-01 15:05:10 -07:00
Enrico Ros 030837fccf 1.15.0: Readme and Changelog 2024-04-01 15:04:15 -07:00
Enrico Ros a7d38aefb1 1.15.0: Update News 2024-04-01 14:42:07 -07:00
Enrico Ros 230a0d7caf Beam: update intro. 2024-04-01 14:21:12 -07:00
Enrico Ros 6e14e43c78 Beam: update in-app explainer. 2024-04-01 14:07:33 -07:00
Enrico Ros e6389f08be Branch before delete 2024-03-30 23:19:48 -07:00
Enrico Ros a4edeb098e 1.15.0: news placeholder 2024-03-30 20:14:30 -07:00
Enrico Ros 093c536415 1.15.0: version number 2024-03-30 19:04:37 -07:00
Enrico Ros 7479b50fea 1.15.0: Disable Title Bar Setting (2 people got confused) 2024-03-30 19:03:45 -07:00
Enrico Ros ebce36d043 1.15.0: Package Version 2024-03-30 18:57:46 -07:00
Enrico Ros 77bab1aa74 Beam: earlyaccess: edit the Custom merges 2024-03-30 01:52:01 -07:00
Enrico Ros ebcac3405c Beam: custom: improve icon 2024-03-30 00:56:15 -07:00
Enrico Ros d2781a6f87 Beam: custom: do not auto-start Custom 2024-03-30 00:40:23 -07:00
Enrico Ros f5954f5bb3 Beam: Gather: change some prop names 2024-03-30 00:40:08 -07:00
Enrico Ros 6baf694d6f Beam: earlyaccess: remove Show Dev Methods 2024-03-30 00:20:08 -07:00
Enrico Ros cb3b586d4d Beam: custom: improve hardcoding 2024-03-30 00:16:41 -07:00
Enrico Ros f68789ab20 Beam: earlyaccess: add Menu Option for response identification 2024-03-30 00:13:33 -07:00
Enrico Ros 0c6a3f1917 Beam: earlyaccess: Fix the "checklist issue" with the mentioned "unicode bullet" 2024-03-29 23:45:53 -07:00
Enrico Ros 05fccaf982 Beam: earlyaccess: Improve popup menu to hint at saving/loading model combos 2024-03-29 23:42:47 -07:00
Enrico Ros 7340b9ecc2 Beam: earlyaccess: Address the UI problem where the menu option does not open when the screen is maximized 2024-03-29 23:15:57 -07:00
Enrico Ros 78eb4ebe0b Beam: earlyaccess: Correct the "Synthesizing" typo. 2024-03-29 23:07:03 -07:00
Enrico Ros b1453a34ec Beam: fix issue with older installs 2024-03-29 21:48:28 -07:00
Enrico Ros c357e9e2f5 Beam: ensure non-empty gather messages 2024-03-29 21:48:28 -07:00
Enrico Ros 98717bf8a9 Beam: scroller: smaller 2024-03-29 21:48:28 -07:00
Enrico Ros d7077ada0e Beam: scroll the instruciton gen too 2024-03-29 21:48:28 -07:00
Enrico Ros 64f63ed1d3 Beam: score to 100 2024-03-29 21:48:28 -07:00
Enrico Ros 2a27f6c30d Beam: fusion zone 2024-03-29 21:48:28 -07:00
Enrico Ros 9fdddeaba8 Beam: Checklist -> Guided 2024-03-29 21:48:28 -07:00
Enrico Ros 2cfa5e93e4 Beam: improve prompts 2024-03-29 21:48:28 -07:00
Enrico Ros 778ac14344 Beam: enhance checklist quality 2024-03-29 21:48:28 -07:00
Enrico Ros 85fcf8be61 Beam: re-merge will not change the model 2024-03-29 21:48:28 -07:00
Enrico Ros b31eb09015 Beam: no green shade 2024-03-29 21:48:28 -07:00
Enrico Ros 5154dd1740 Beam: improve Fusion layout 2024-03-29 21:48:27 -07:00
Enrico Ros 274f11ef1d Beam: change the Fusion model 2024-03-29 21:48:27 -07:00
Enrico Ros aeb1acf458 Beam: bits 2024-03-29 21:48:27 -07:00
Enrico Ros a204f4a58e Beam: Ray grid: bits 2024-03-29 21:48:27 -07:00
Enrico Ros 8e4a57aa01 Beam: auto-fit 2024-03-29 21:48:27 -07:00
Enrico Ros 797ed0a553 Beam: shorter scroll on mobile beams 2024-03-29 21:48:27 -07:00
Enrico Ros 663bc0d471 Beam: shadow on mobile scatter 2024-03-29 21:48:27 -07:00
Enrico Ros 8d7e2d2c46 Beam: remove lastScatterLlmId 2024-03-29 21:48:27 -07:00
Enrico Ros 19d96bb30b Beam: remove llm Linkage 2024-03-29 21:48:27 -07:00
Enrico Ros 47f2f20d9c Beam: relax checklist parsing 2024-03-29 21:48:27 -07:00
Enrico Ros 12c7c634c0 Beam: improve LLM usage 2024-03-29 21:48:27 -07:00
Enrico Ros 9a322c150a Beam: reduce space 2024-03-29 21:48:27 -07:00
Enrico Ros 1a3bc4f666 Beam: move instructions 2024-03-29 21:48:27 -07:00
Enrico Ros d4881b1ce5 Beam: move to modules 2024-03-29 21:48:27 -07:00
Enrico Ros a2ad2df473 Beam: prompt update 2024-03-29 21:48:27 -07:00
Enrico Ros 541c5bd1c3 Beam: prompt update 2024-03-29 21:48:27 -07:00
Enrico Ros b744e9673b Beam: Checklist done 2024-03-29 21:48:27 -07:00
Enrico Ros bb94b7c5c6 Beam: prompt updates 2024-03-29 21:48:27 -07:00
Enrico Ros e9ff57d5e1 Beam: Gather: User Input 2024-03-29 21:48:27 -07:00
Enrico Ros 179245457c Beam: Gather: extract instructions 2024-03-29 21:48:27 -07:00
Enrico Ros 1493f74691 Beam: Gather: render 2024-03-29 21:48:27 -07:00
Enrico Ros 4857503ed3 Beam: Gather: intermediate components 2024-03-29 21:48:27 -07:00
Enrico Ros a0e38b4f0c Beam: Gather: begin ui production 2024-03-29 21:48:27 -07:00
Enrico Ros 1d62cad9e9 Beam: Gather: large state redux 2024-03-29 21:48:27 -07:00
Enrico Ros 855761020c Beam: Instructions: interrupt the fake user op 2024-03-29 21:48:27 -07:00
Enrico Ros 0950d06dfb Beam: Instructions: improve state machinery much 2024-03-29 21:48:27 -07:00
Enrico Ros 1496402325 Beam: layout seems ok 2024-03-29 21:48:27 -07:00
Enrico Ros 77e2c4babb Beam: stop this madness 2024-03-29 21:48:27 -07:00
Enrico Ros a465082984 Beam: Dev methods by default 2024-03-29 21:48:27 -07:00
Enrico Ros 025fdac686 Beam: Iconoclastic 2024-03-29 21:48:27 -07:00
Enrico Ros 6bde5ec64c Beam: Gather: Fin of Fin 2024-03-29 21:48:27 -07:00
Enrico Ros f099a9ec39 Beam: Gather Cleanups galore 2024-03-29 21:48:27 -07:00
Enrico Ros 5bfcef92ee Beam: Persist (and get off the way) more state 2024-03-29 21:48:27 -07:00
Enrico Ros 79a8fbd881 Beam: Extract the Module Beam Store 2024-03-29 21:48:27 -07:00
Enrico Ros 7f96a14cf6 Beam: Debug: swap properties 2024-03-29 21:48:27 -07:00
Enrico Ros 5fe6d70713 Beam: App: more clearer debug 2024-03-29 21:48:27 -07:00
Enrico Ros dcba4dd4bc Beam: App: clearer debug 2024-03-29 21:48:27 -07:00
Enrico Ros ccbe77913b Beam: Gather: beginning of output 2024-03-29 21:48:27 -07:00
Enrico Ros 2844cb81c2 Beam: Gather: wait indicator 2024-03-29 21:48:27 -07:00
Enrico Ros d86e8e5920 Beam: bits 2024-03-29 21:48:27 -07:00
Enrico Ros 9665fa1eb4 Beam: good button on mobile 2024-03-29 21:48:27 -07:00
Enrico Ros 2788ef679b Beam: scroll-fix 2024-03-29 21:48:27 -07:00
Enrico Ros e1a88e1fd8 Beam: move gapper 2024-03-29 21:48:27 -07:00
Enrico Ros 32163c5302 Beam: bottom gapper 2024-03-29 21:48:26 -07:00
Enrico Ros 2d3d5efe87 Beam: fix merge dim when inactive 2024-03-29 21:48:26 -07:00
Enrico Ros e1bbba392c Beam: Scatter: save file rename 2024-03-29 21:48:26 -07:00
Enrico Ros ed642c856b Beam: Scatter: complete the dialog 2024-03-29 21:48:26 -07:00
Enrico Ros 927e462f7a Beam: Scatter: preset save (full) 2024-03-29 21:48:26 -07:00
Enrico Ros e250499a3b Beam: Scatter: preset save (part) 2024-03-29 21:48:26 -07:00
Enrico Ros 91d96a6639 Beam: bits 2024-03-29 21:48:26 -07:00
Enrico Ros 104ec4c87c Beam: improve Composer button 2024-03-29 21:48:26 -07:00
Enrico Ros 0a7e8436c3 Beam: Gather: starts to work like a charm 2024-03-29 21:48:26 -07:00
Enrico Ros 9e597e0a28 Beam: Gather: first response! 2024-03-29 21:48:26 -07:00
Enrico Ros 01fbb5d47c Beam: Gather: rename executor to instructions 2024-03-29 21:48:26 -07:00
Enrico Ros 6517d16337 Beam: Gather: Mega Pint of state cleanup 2024-03-29 21:48:26 -07:00
Enrico Ros 0e636adf28 Beam: Gather: more state cleanuppery 2024-03-29 21:48:26 -07:00
Enrico Ros 0bb281237b Beam: Gather: some customization 2024-03-29 21:48:26 -07:00
Enrico Ros 2b224376c2 Beam: Gather: further improvements 2024-03-29 21:48:26 -07:00
Enrico Ros e510b369d7 Beam: Gather: ui fix 2024-03-29 21:48:26 -07:00
Enrico Ros a0de1f7230 Beam: Gather: wire things up 2024-03-29 21:48:26 -07:00
Enrico Ros 4591132269 Beam: the ghost in the machine 2024-03-29 21:48:26 -07:00
Enrico Ros a03de8d490 Beam: Gather: And Here We Go (Again -final.r002.copy.goodone) 2024-03-29 21:48:26 -07:00
Enrico Ros 27bcfec17e Beam: Gather: And Here We Go (Again) 2024-03-29 21:48:26 -07:00
Enrico Ros f6dbec3e1d Beam: Gather: And Here We Go 2024-03-29 21:48:26 -07:00
Enrico Ros aebc45f705 Beam: Gather: messaging & lime 2024-03-29 21:48:26 -07:00
Enrico Ros 310c60b9d9 Beam: Gather: pre-fusion 2024-03-29 21:48:26 -07:00
Enrico Ros bcba67c209 Beam: 4->6px 2024-03-29 21:48:26 -07:00
Enrico Ros fc013aed52 Beam: Gather: icons 2024-03-29 21:48:26 -07:00
Enrico Ros 8ad41c059b Beam: Scatter: cleaner 2024-03-29 21:48:26 -07:00
Enrico Ros 8eaf8db850 Beam: Gather: cleaner 2024-03-29 21:48:26 -07:00
Enrico Ros 896883766c Beam: Gather: perfect styles 2024-03-29 21:48:26 -07:00
Enrico Ros 258dacf3ed Beam: Gather: higher contrast 2024-03-29 21:48:26 -07:00
Enrico Ros 242243f485 Beam: Gather: even better ux 2024-03-29 21:48:26 -07:00
Enrico Ros a18436dce1 Beam: Gather: real good ux 2024-03-29 21:48:26 -07:00
Enrico Ros 5323cbc00e Beam: Gather: simplify state 2024-03-29 21:48:26 -07:00
Enrico Ros ddd3b137ac Beam: Gather: convert to Fusion IDs 2024-03-29 21:48:26 -07:00
Enrico Ros 94550088e5 Beam: Gather: show/hide dev methods 2024-03-29 21:48:26 -07:00
Enrico Ros 1375ca6f5c Beam: Gather: style multiline 2024-03-29 21:48:26 -07:00
Enrico Ros e4c4fe0495 Beam: Gather: start from 0 2024-03-29 21:48:26 -07:00
Enrico Ros 2fa5277e56 Beam: Gather: add Eval 2024-03-29 21:48:26 -07:00
Enrico Ros b73ad8fdc1 Beam: Gather: icons 2024-03-29 21:48:26 -07:00
Enrico Ros 9cc281e65e Beam: redo optionality 2024-03-29 21:48:26 -07:00
Enrico Ros d62107d39b 1.15.0: Cover image 2024-03-29 21:47:33 -07:00
Enrico Ros 4a8d20ad72 News: raise the quality 75 -> 90 2024-03-29 21:47:33 -07:00
Enrico Ros 5acb72c39b T2I: max 4 columns 2024-03-29 21:47:33 -07:00
Enrico Ros 67e8236a60 Fix deprecation 2024-03-29 21:47:32 -07:00
Enrico Ros 18b8853f82 Merge branch 'main-stable' 2024-03-29 21:39:05 -07:00
Enrico Ros 65c7df7938 Backend: auto-configuration. Fixes #436 2024-03-29 05:07:37 -07:00
Enrico Ros 15678cdfa2 Backend: removed onSuccess callbacks! 2024-03-29 05:07:36 -07:00
Enrico Ros 6cd6c62046 Backend: migration to async fetch from Query. plus consistency of behaviors 2024-03-29 05:07:36 -07:00
Enrico Ros dbf92805a2 Backend: reprio 2024-03-29 05:07:35 -07:00
Enrico Ros 11fc9a7b85 Backend: capability variables 2024-03-29 05:07:35 -07:00
Enrico Ros 8bc970ff57 Backend: autoconf only on chat 2024-03-29 05:07:34 -07:00
Enrico Ros a16eefd97b react-query: disable refetch on focus by default 2024-03-29 05:07:34 -07:00
Enrico Ros ca5e5b820c Backend: autoconf base logic 2024-03-29 05:07:33 -07:00
Enrico Ros f73ad52441 Backend: ->getBackendCapabilities() 2024-03-29 05:07:33 -07:00
Enrico Ros 729ec1d1bf Backend: config hash, to detect backend config updates 2024-03-29 05:07:32 -07:00
Enrico Ros 4adb30b861 AppChat: use intent to navigate to it from the link importer 2024-03-29 05:07:32 -07:00
Enrico Ros 999f6de45f Serverless Functions timeout: set it in the Vercel functions as the conditional was not working. Fix (again) #468 2024-03-28 23:20:40 -07:00
Enrico Ros 70686502b4 Revert "Set the Vercel serverless max duration as env variable. Fixes #468"
This reverts commit d17a980151.
2024-03-28 23:16:11 -07:00
Enrico Ros d17a980151 Set the Vercel serverless max duration as env variable. Fixes #468 2024-03-28 23:12:25 -07:00
Enrico Ros 7fa5947030 Chat Nav Grouping: when unset, the search won't sort by frequency
TODO: needs a better UX pattern here.
2024-03-28 22:48:12 -07:00
Enrico Ros de8f120fd4 Update README.md 2024-03-28 17:01:11 -07:00
Enrico Ros 9b54603264 Update README.md 2024-03-28 17:00:10 -07:00
Enrico Ros 698c77d7ba Tease the upcoming Beam 2024-03-28 16:53:34 -07:00
Enrico Ros 18d83a4d18 PersonaSelector: better tiles 2024-03-27 22:11:52 -07:00
Enrico Ros 8e849d93b2 Style fixes 2024-03-27 21:59:49 -07:00
Enrico Ros 4ca42f028b SVG: parse alternatives 2024-03-27 21:23:19 -07:00
Enrico Ros 3118337879 Timeout on Vercel/Serverless raised to 25 (for Browsing/Browserless requests) 2024-03-27 21:22:47 -07:00
Enrico Ros db4490affb SVG: improve compat with Opus 2024-03-27 18:33:28 -07:00
Enrico Ros 51ab79384e SVG: more compatible 2024-03-27 18:33:28 -07:00
Enrico Ros 3ee30a252d Creator: fixes 2024-03-27 18:33:28 -07:00
Enrico Ros b883566ebb Shrink the Folders list when running out of space (at twice the Chat Titles rate) 2024-03-27 18:32:46 -07:00
Enrico Ros ac78fb85b8 Shadow 2024-03-27 18:32:46 -07:00
Enrico Ros 0d2b11d0c4 Fonts 2024-03-27 18:32:45 -07:00
Enrico Ros 5b610c88c1 Gemini: fix RECITATION 2024-03-27 18:32:45 -07:00
Enrico Ros bf444ce043 Attachments: support RMB 2024-03-27 18:32:45 -07:00
Enrico Ros c91c027dab Compress icons 2024-03-27 18:32:44 -07:00
Enrico Ros 81fd87c510 Reduced badges 2024-03-27 18:32:44 -07:00
Enrico Ros 9da174a962 Roll packages 2024-03-27 18:32:44 -07:00
Enrico Ros 84f54a7e65 PersonaSelector: improve examples 2024-03-27 18:25:41 -07:00
Enrico Ros baeecf1464 PersonaSelector: reshade 2024-03-27 18:25:34 -07:00
Enrico Ros f2fdd39c96 Persona Selector: smaller tiles 2024-03-27 18:25:18 -07:00
Enrico Ros 53b074d78e Personas: show enablement, not disablement 2024-03-27 18:22:38 -07:00
Enrico Ros f4fc1e6775 Persona: update example 2024-03-27 18:22:28 -07:00
Enrico Ros dba791b8db Personas: update Dev examples 2024-03-27 18:22:24 -07:00
Enrico Ros 750fa02621 Personas: update custom task 2024-03-27 18:22:20 -07:00
Enrico Ros 7a67816111 Update default prompt. 2024-03-27 18:22:14 -07:00
Enrico Ros 613625644e LocalAI T2I: integration skel 2024-03-23 04:16:59 -07:00
Enrico Ros 0e25071ef0 Prevent pull-to-refresh on mobile - would be triggered while scrolling up 2024-03-22 22:40:56 -07:00
Enrico Ros ed1932cd26 Link env vars 2024-03-20 23:08:47 -07:00
Enrico Ros 67b89213d0 Your input 2024-03-20 22:39:34 -07:00
Enrico Ros 814f142c5f Fix zIndex of the ScrollToBottomButton 2024-03-20 22:39:33 -07:00
Enrico Ros 16cd3e7d5a Desktop Nav: fix key 2024-03-20 04:55:30 -07:00
Enrico Ros c5dcb8faef Beam: Gather: disable for now 2024-03-20 04:54:53 -07:00
Enrico Ros 6b46c022f9 Beam: Gather: improve prompt definitions 2024-03-20 03:56:15 -07:00
Enrico Ros 88ef05fc72 Beam: Gather: baseline prompts 2024-03-20 03:13:48 -07:00
Enrico Ros 445ea367fc Beam: copy Ray to clipboard 2024-03-20 02:10:20 -07:00
Enrico Ros c819554f43 Prompt-mixin: custom filters 2024-03-20 02:08:01 -07:00
Enrico Ros bbc8a79ded Beam: inline edit the Custom 2024-03-20 01:25:25 -07:00
Enrico Ros 3d181bc10d Beam: optimize App 2024-03-20 00:40:49 -07:00
Enrico Ros ba5478f382 Beam: Fusion: improved Input 2024-03-20 00:25:52 -07:00
Enrico Ros 136c993c8d Beam: Fusion: show prompts option 2024-03-19 23:00:23 -07:00
Enrico Ros 6cf18ea4e8 fix tooltip missing on nav 2024-03-19 22:46:54 -07:00
Enrico Ros fe7f56c82e fix check icon 2024-03-19 22:46:45 -07:00
Enrico Ros 6c580f1e43 Beam: Gather: edit custom instructions 2024-03-19 19:51:30 -07:00
Enrico Ros f171cd4f03 Beam: Gather: enable customization 2024-03-19 18:12:38 -07:00
Enrico Ros ea109e6c30 EditRounded 2024-03-19 13:51:36 -07:00
Enrico Ros f514eed226 Beam: Gather: instruction definition 2024-03-19 13:47:49 -07:00
Enrico Ros 274ba80149 Beam: Gather: bits 2024-03-19 11:57:45 -07:00
Enrico Ros 46b4dfc458 Beam: Gather: reinit state 2024-03-19 11:52:24 -07:00
Enrico Ros 4af8f4ff6a [desktop] Improve overflow 2024-03-19 11:40:20 -07:00
Enrico Ros df5810d695 [desktop] Application Overflow menu 2024-03-19 11:32:25 -07:00
Enrico Ros d9ad96c374 Beam: 'from chat' 2024-03-19 02:21:43 -07:00
Enrico Ros 06cc93fd82 Beam: begin Fusion state 2024-03-19 02:16:50 -07:00
Enrico Ros 41da63765f Beam: state cleanup 2024-03-19 01:33:27 -07:00
Enrico Ros 3975411c78 Beam: slices pattern 2024-03-19 01:09:38 -07:00
Enrico Ros fc2e75ef61 Beam: separated gather and scatter, physically 2024-03-19 00:00:40 -07:00
Enrico Ros ef0f2dd3d0 Beam: bits 2024-03-18 23:44:40 -07:00
Enrico Ros 548c3c5d72 Beam: clean styles 2024-03-18 20:32:15 -07:00
Enrico Ros d2e3a0cb8e Beam: add gather config and fusion 2024-03-18 20:16:38 -07:00
Enrico Ros 9cdace6f81 Beam: rename Panes 2024-03-18 19:09:11 -07:00
Enrico Ros 12f020570e Beam: extract Scatter input 2024-03-18 19:07:55 -07:00
Enrico Ros bef2551eec Beam: Gather commands shall be ok 2024-03-18 18:49:05 -07:00
Enrico Ros 7e20f8c189 Beam: wire Gather 2024-03-18 18:30:31 -07:00
Enrico Ros 56e8390e55 Beam: Fusion rename 2024-03-18 17:52:32 -07:00
Enrico Ros 89fff16385 Beam: Gather style 2024-03-18 04:00:00 -07:00
Enrico Ros 2cf15a24eb Beam: Gather layout 2024-03-18 03:48:30 -07:00
Enrico Ros 512e867034 Beam: final style fixes on Beam 2024-03-18 02:44:37 -07:00
Enrico Ros ce8c55c3c7 Beam: the beam panel seems done 2024-03-18 02:24:56 -07:00
Enrico Ros 8e0d904d9a Beam: Style updates 2024-03-18 00:57:26 -07:00
Enrico Ros 6c846a8ae7 Beam: very large state update 2024-03-18 00:03:10 -07:00
Enrico Ros 5004469fe9 Beam: DRay -> BRay 2024-03-17 21:54:42 -07:00
Enrico Ros 14d0af74ed Beam: extract rays 2024-03-17 21:51:38 -07:00
Enrico Ros 5a76cf9486 Beam: move the pre-beam where it shall go 2024-03-17 21:34:06 -07:00
Enrico Ros 82901ccd02 Beam: desktop sticky controls for Scatter and Gather 2024-03-17 21:26:56 -07:00
Enrico Ros 1dc9d66673 Beam: unused callout 2024-03-17 21:20:51 -07:00
Enrico Ros a0cbfaf390 Beam: fix explainer layout 2024-03-17 21:14:35 -07:00
Enrico Ros 9a01ae61ef ChatDrawer (item groups): sticky 2024-03-17 17:01:22 -07:00
Enrico Ros 91837d5acd Optimize 2024-03-17 16:47:00 -07:00
Enrico Ros 1b9ebdda22 Beam: Maximized Mode(al) 2024-03-17 16:43:33 -07:00
Enrico Ros b6f6177af3 Beam: improve looks 2024-03-17 16:08:11 -07:00
Enrico Ros d35486196b Scroll/Beam: embeddable ScrollToBottomButton 2024-03-17 16:05:31 -07:00
Enrico Ros 1603637e3b Scroll/Beam: improve usage 2024-03-17 15:53:44 -07:00
Enrico Ros 8f20840169 Beam: optimize when in Chat 2024-03-17 15:28:49 -07:00
Enrico Ros 4fff2394de ScrollToBottom: centralize styles 2024-03-17 15:28:00 -07:00
Enrico Ros afb74e68ee ScrollToBottom: moved to shared components 2024-03-17 14:54:15 -07:00
Enrico Ros d5fa7844c5 ScrollToBottom: allow to disable auto-stick (button only) 2024-03-17 14:47:02 -07:00
Enrico Ros b8470cd640 ScrollToBottom: allow the button to be inline 2024-03-17 14:44:27 -07:00
Enrico Ros 9a23f573a6 Beam: remove badge (hat on a hat) 2024-03-16 21:17:38 -07:00
Enrico Ros efe8fa0fda Beam: remove Phase 2024-03-16 21:16:27 -07:00
Enrico Ros 2d16e8bb4f UserFlags: show on messages 2024-03-16 20:44:54 -07:00
Enrico Ros bbd95eebff Update Models Attraction icon 2024-03-15 22:52:26 -07:00
Enrico Ros ceb00b4e93 Roll packages 2024-03-15 20:21:51 -07:00
Enrico Ros cc60d26d1c Turn multicast blue 2024-03-15 19:57:17 -07:00
Enrico Ros ba3ff739f6 Improve icons 2024-03-15 19:56:59 -07:00
Enrico Ros 6062647705 App: remove graying out - gets in the way a lot 2024-03-15 18:22:39 -07:00
Enrico Ros 070c1c2de9 Composer: tutorial happiness preserver 2024-03-15 18:16:21 -07:00
Enrico Ros d3aaa69409 Composer: tutorialize 2024-03-15 18:09:46 -07:00
Enrico Ros 0ac7753e35 Beam: terminate on Conversation clear 2024-03-15 17:49:56 -07:00
Enrico Ros eba9d53d2e Reduce the usage of backendCapabilities() 2024-03-15 17:35:38 -07:00
Enrico Ros d04d4ec8e7 Reorder providers 2024-03-15 16:34:42 -07:00
Enrico Ros c7c3efcbe7 Progress with bootstrap logic 2024-03-15 15:51:41 -07:00
Enrico Ros 2b8d53a44c Update wrappers 2024-03-15 15:41:08 -07:00
Enrico Ros ef6b573e08 Update TRPC Query Settings 2024-03-15 15:39:38 -07:00
Enrico Ros 61eedd41df Bootstrapper cleanup 2024-03-15 15:27:34 -07:00
Enrico Ros b265bcda20 Start cleaning up Bootstrapper 2024-03-15 14:32:15 -07:00
Enrico Ros d703d32a1f Cleanup knowledge of backend capabilities 2024-03-15 14:15:59 -07:00
Enrico Ros aab9334404 Build fix 2024-03-15 04:47:57 -07:00
Enrico Ros c2570f6955 New: attach starred messages with @
Note: the marshalling shall be moved inside the pipeline, probably
with a converter of type `ego-message-frontmatter` or similar
2024-03-15 04:42:16 -07:00
Enrico Ros 8e936a6334 Prevent this 2024-03-15 04:02:16 -07:00
Enrico Ros 46bfc22869 Show error on misused /beam 2024-03-15 02:48:45 -07:00
Enrico Ros db1620dd56 Actile: improve logic 2024-03-15 02:40:47 -07:00
Enrico Ros e59f8a42a3 Improve TRPC errors 2024-03-15 02:38:36 -07:00
Enrico Ros 17d18bd85d Fix /commands parsing 2024-03-15 02:37:30 -07:00
Enrico Ros fb256cf578 Bits 2024-03-15 01:39:51 -07:00
Enrico Ros 1b6b5db76d Actiles: improve provider search 2024-03-15 01:39:42 -07:00
Enrico Ros 41647ca83a Proactively get the user out of trouble. 2024-03-15 01:16:59 -07:00
Enrico Ros 07d2a17a87 Filter by starred chats. #109 2024-03-15 01:12:19 -07:00
Enrico Ros 6d744dfb7e ScrolltoBottomButton: improve 2024-03-15 00:40:01 -07:00
Enrico Ros b9b946c35f Messages: add 'starring' #109 2024-03-15 00:32:56 -07:00
Enrico Ros 17adfe2117 DMessage: add flag list support 2024-03-15 00:04:17 -07:00
Enrico Ros 1e5e21102d DMessage: improve edit support 2024-03-15 00:03:49 -07:00
Enrico Ros 4af992222f Shortcuts work 2024-03-14 21:47:59 -07:00
Enrico Ros a9447c6a11 Beam: misc 2024-03-14 21:33:42 -07:00
Enrico Ros db71323313 Misc 2024-03-14 21:19:02 -07:00
Enrico Ros b9b2748e05 Improved Avatar menu looks 2024-03-14 21:00:27 -07:00
Enrico Ros 387231f743 Fix Avatar menus 2024-03-14 20:52:34 -07:00
Enrico Ros 2216a89aa3 Beam: messaging 2024-03-14 19:10:15 -07:00
Enrico Ros 4faa6326fa Explainer: shortcuts 2024-03-14 19:08:11 -07:00
Enrico Ros cb22b3d9a1 Beam: update images 2024-03-14 19:07:34 -07:00
Enrico Ros 152a3873bd Beam: update scatter image 2024-03-14 18:50:25 -07:00
Enrico Ros adc2760a89 Beam: gather image 2024-03-14 18:24:36 -07:00
Enrico Ros dde64acb06 Improve Streaming issue reporting. Fixes #457 2024-03-14 17:47:55 -07:00
Enrico Ros 008adbd8bc Fix #459 2024-03-14 16:50:45 -07:00
Enrico Ros 0e4866a5a2 Beam: tutorial complete x2 2024-03-14 15:11:51 -07:00
Enrico Ros 5cb96cae3a Beam: tutorial complete 2024-03-14 15:05:36 -07:00
Enrico Ros 8cbb82a67f Beam: BEAM image, transparent 2024-03-14 14:57:56 -07:00
Enrico Ros 848ddbe477 Beam: BEAM image 2024-03-14 14:53:47 -07:00
Enrico Ros 083c1cde8b Explainer: adj auto resize 2024-03-14 14:53:47 -07:00
Enrico Ros b792971062 Add Gemini icon 2024-03-14 14:16:49 -07:00
Enrico Ros 07dde8f4b1 Chat messages: sticky headers 2024-03-14 04:19:57 -07:00
Enrico Ros 01f94127dd Beam: vendor icons 2024-03-14 04:07:50 -07:00
Enrico Ros 4d457b4e9e Beam: re-show explainer, with double-click 2024-03-14 03:28:27 -07:00
Enrico Ros 8ac93ff2da Beam: update explainer, with an end 2024-03-14 03:28:08 -07:00
Enrico Ros ef33a4b08e Beam: link 2024-03-14 02:47:27 -07:00
Enrico Ros fdd3b25a27 Beam: add Explainers 2024-03-14 02:37:01 -07:00
Enrico Ros 4dc979da08 SquircleIcon: support an alt color 2024-03-14 01:28:53 -07:00
Enrico Ros 8f426e03c4 Uniformize Roundicons 2024-03-14 01:28:40 -07:00
Enrico Ros 40cd085bf8 ExploreCarousel: the new Wizard experience 2024-03-14 01:28:20 -07:00
Enrico Ros 6aa75fc5d1 Animutils: amazing animations (not) 2024-03-14 01:27:55 -07:00
Enrico Ros eae5920f9d Beam: initial Explainer support 2024-03-13 21:59:55 -07:00
Enrico Ros 2f6bfa37cc Beam: balance title 2024-03-13 21:55:08 -07:00
Enrico Ros 9d6fd9b9b8 Styles fix 2024-03-13 20:14:58 -07:00
Enrico Ros 260cd67c96 Beam: user message editing 2024-03-13 17:34:07 -07:00
Enrico Ros aff76e2d18 Beam: improve grid 2024-03-13 17:21:50 -07:00
Enrico Ros 52e4343045 Improve drawer sizing 2024-03-13 17:15:50 -07:00
Enrico Ros 1ffbb135c6 Anthropic: add Haiku
(cherry picked from commit c3ec522261)
2024-03-13 14:46:39 -07:00
Enrico Ros c3ec522261 Anthropic: add Haiku 2024-03-13 14:45:50 -07:00
Enrico Ros 4538839376 Beam: unify invocation logic, from 7 places 2024-03-13 14:41:39 -07:00
Enrico Ros 834edd3a71 Beam: improve chat message popup 2024-03-13 14:22:06 -07:00
Enrico Ros 581c3d9593 Beam: document shortcut 2024-03-13 14:21:50 -07:00
Enrico Ros 0c672fbaa5 Beam: add disabled support for letters 2024-03-13 14:15:41 -07:00
Enrico Ros 6d96b9a312 Beam: add badges on menu and chat mode menu 2024-03-13 14:02:20 -07:00
Enrico Ros 691791ccd0 Beam: improve user message 2024-03-13 14:01:54 -07:00
Enrico Ros f4299121d5 Beam: highlight in modes menu 2024-03-13 13:43:48 -07:00
Enrico Ros 1adfb7eedd Chat drawer: setting to show persona icons 2024-03-13 13:36:55 -07:00
Enrico Ros 33ad583d15 New chat: better button spacings 2024-03-13 13:30:58 -07:00
Enrico Ros a7e2fe2277 New chat: better button 2024-03-13 13:16:35 -07:00
Enrico Ros 5a479d5863 DesktopDrawer: perfect shadows 2024-03-13 13:05:57 -07:00
Enrico Ros 873ff034d2 DesktopDrawer: fix shadow 2024-03-13 04:18:10 -07:00
Enrico Ros 61d3537617 Composer: fix zIndex 2024-03-13 04:11:09 -07:00
Enrico Ros ae068a3f64 Beam: shortcuts 2024-03-13 03:47:56 -07:00
Enrico Ros f7402cd6f5 Beam: close dialog after using selected 2024-03-13 03:47:48 -07:00
Enrico Ros c53f9c8020 Beam: use selected 2024-03-13 03:28:42 -07:00
Enrico Ros 798b4d57f4 Beam: disable on system message 2024-03-13 03:12:05 -07:00
Enrico Ros 98d428fb34 Beam: enable high performance mode 2024-03-13 02:32:42 -07:00
Enrico Ros 3ac5ace216 Share stream text indicator 2024-03-13 02:32:29 -07:00
Enrico Ros 444a1a7ab9 Temp download gif 2024-03-13 02:32:19 -07:00
Enrico Ros 43ea4bd4b5 Large cleanups in execution logic 2024-03-13 02:32:09 -07:00
Enrico Ros 6a9272e40a Beam: fix 2024-03-13 02:23:32 -07:00
Enrico Ros 10589a11aa Beam: business logic to continue/replace messages, including import 2024-03-13 00:15:41 -07:00
Enrico Ros a88f898bc0 Chat/Message/List: improve Beam and related restart logic 2024-03-12 22:55:40 -07:00
Enrico Ros 7a84038b04 Beam: initialize/terminate instead of open/close 2024-03-12 19:56:11 -07:00
Enrico Ros 111c40732d Beam: slight text changes 2024-03-12 18:58:35 -07:00
Enrico Ros 69bb78c8be Beam: reduce direct open calls 2024-03-12 18:54:45 -07:00
Enrico Ros ad3b327d69 Beam: close confirmation: add callbacks 2024-03-12 18:36:23 -07:00
Enrico Ros dc27f38534 Beam: close confirmation 2024-03-12 18:33:24 -07:00
Enrico Ros 5b0816cb92 Beam: esc to close 2024-03-12 18:18:46 -07:00
Enrico Ros 57f6955303 Beam: alt bar improvement 2024-03-12 18:03:31 -07:00
Enrico Ros 78915f878d Beam: clean gather pane 2024-03-12 18:01:29 -07:00
Enrico Ros 6ced6d626b Beam: improve integration 2024-03-12 18:01:17 -07:00
Enrico Ros ee3cb819b4 Beam: back to dev 2024-03-12 18:01:09 -07:00
Enrico Ros cc17b1d19d Beam: Chat Title bar to close the pane 2024-03-12 17:50:16 -07:00
Enrico Ros 2c83240d47 Snacks: review state 2024-03-12 16:48:03 -07:00
Enrico Ros 54f18ff120 Chat: focused state review 2024-03-12 16:47:50 -07:00
Enrico Ros 5e1fe363c3 PanesManager: cleanups (shall be safe) 2024-03-12 15:42:25 -07:00
Enrico Ros 3d2ec507e1 Chat: clarify state 2024-03-12 13:54:40 -07:00
Enrico Ros 1dd7af3c8b Beam: gather test icons 2024-03-12 13:41:50 -07:00
Enrico Ros 06ec1fcebf Beam: improve messaging 2024-03-12 13:08:08 -07:00
Enrico Ros 86cb863fd4 Beam: explored the modal 2024-03-12 13:07:57 -07:00
Enrico Ros d5ef1288d8 Beam: unify layout again 2024-03-12 12:45:04 -07:00
Enrico Ros f3354c498d Beam: unify layout again 2024-03-12 12:44:59 -07:00
Enrico Ros 9557141b38 Beam: bits (drag-drop didn't work out, it's a grid layout) 2024-03-12 12:36:32 -07:00
Enrico Ros 3144b66e73 StrictModeDroppable: share 2024-03-12 11:55:20 -07:00
Enrico Ros 6dbefa3d2f Beam: bits 2024-03-12 11:55:08 -07:00
Enrico Ros c8f3b139e8 Beam: bits 2024-03-12 11:06:52 -07:00
Enrico Ros 288663325d Beam: rename Panes 2024-03-12 11:05:16 -07:00
Enrico Ros 49947ee01d Beam: extract the Grid 2024-03-12 11:03:55 -07:00
Enrico Ros fa7a45ebc7 bits 2024-03-12 10:54:03 -07:00
Enrico Ros 9a074c222f Beam: adjustments 2024-03-12 10:51:18 -07:00
Enrico Ros 4e0d7b6ed9 Beam: down to non-removable 1 2024-03-12 10:41:16 -07:00
Enrico Ros 1f3defb04c Beam: optimize ControlsRow 2024-03-12 02:43:59 -07:00
Enrico Ros 6c52c43460 Beam: auto-hide composer 2024-03-12 02:38:18 -07:00
Enrico Ros deae2879f1 Beam: improve hooks 2024-03-12 01:59:42 -07:00
Enrico Ros 5b255a7d8b LLMSelect: try stabilize 2024-03-12 01:58:54 -07:00
Enrico Ros 6e06c24b7a Beam: extract hooks 2024-03-12 01:58:28 -07:00
Enrico Ros 2fde1efdd3 Beam: begin wiring the Gatherer 2024-03-11 23:59:04 -07:00
Enrico Ros aeb29d983a FormLabelStart: optimize 2024-03-11 23:27:58 -07:00
Enrico Ros c8a7123da9 Beam: fix styles 2024-03-11 23:13:20 -07:00
Enrico Ros 5c22061415 Beam: state cleanup and sync 2024-03-11 16:32:25 -07:00
Enrico Ros 9a0fda8c02 Beam: scrollable main layout 2024-03-11 16:00:22 -07:00
Enrico Ros 2f9a17c44a Beam: fixes 2024-03-11 15:46:29 -07:00
Enrico Ros 50559015d8 Beam: fix scattering (empty) issue 2024-03-11 15:40:20 -07:00
Enrico Ros a8d4e143c2 Beam: selection (disable, does not look great) 2024-03-11 15:32:54 -07:00
Enrico Ros 2a6c69538d Beam: increase ray state consistency 2024-03-11 15:09:43 -07:00
Enrico Ros 0ba5d61353 Beam: Ray lifecycle tracking 2024-03-11 14:44:36 -07:00
Enrico Ros d436ec5790 chat-stream: streamAssistantMessage: add an outcome type 2024-03-11 14:01:30 -07:00
Enrico Ros 759b822b92 Beam: relayout with Gather Controls skel 2024-03-11 13:49:19 -07:00
Enrico Ros 9df45af698 Beam: rename Scatter Controls 2024-03-11 13:34:57 -07:00
Enrico Ros 3474e81446 Beam: show preceding messages count 2024-03-11 13:26:06 -07:00
Enrico Ros e1f07eb957 ChatMessage: support top decorator (4rem default size) 2024-03-11 13:16:52 -07:00
Enrico Ros 71ff1b98be Beam: extract Ray controls row 2024-03-11 12:41:01 -07:00
Enrico Ros 9b370dfa88 Remove warnings 2024-03-11 12:40:40 -07:00
Enrico Ros 0be0661750 ButtonGroup background 2024-03-11 12:40:33 -07:00
Enrico Ros eaa7230af7 Improve Expand/Collapse (position, length) 2024-03-11 12:40:07 -07:00
Enrico Ros 11cb000481 Beam: fix stops and deletes 2024-03-11 01:54:39 -07:00
Enrico Ros 8ae3554a58 Beam: start/stop Rays 2024-03-11 00:25:50 -07:00
Enrico Ros dfd4736386 LLMSelect: support disablement 2024-03-11 00:25:39 -07:00
Enrico Ros feb793c9fa Beam: improve controller 2024-03-10 22:50:46 -07:00
Enrico Ros ee962fde08 GoodTooltip: fix 2024-03-10 22:12:12 -07:00
Enrico Ros c08dd96de3 Beam: add Stop buttons 2024-03-10 21:39:57 -07:00
Enrico Ros b52f771133 BlocksRenderer: improve expand buttons 2024-03-10 21:39:28 -07:00
Enrico Ros 4631232551 Animations: centralize 2024-03-10 21:39:02 -07:00
Enrico Ros df7f5047aa Beam: first Wiring 2024-03-10 20:58:37 -07:00
Enrico Ros 467d14324d zIndices: cleanup 2024-03-10 20:53:09 -07:00
Enrico Ros cbdce08e96 Beam: improve rays 2024-03-10 17:50:46 -07:00
Enrico Ros d6bf8f8854 Beam: rename View again 2024-03-10 17:25:51 -07:00
Enrico Ros 4599da3ded Revert "Beam: remove optionality"
This reverts commit 6d50952b2e.
2024-03-10 17:24:42 -07:00
Enrico Ros 6d50952b2e Beam: remove optionality 2024-03-10 17:23:00 -07:00
Enrico Ros 7066947809 Beam: move files 2024-03-10 17:15:01 -07:00
Enrico Ros e2924aacab Beam: cleanups 2024-03-10 16:49:36 -07:00
Enrico Ros 1e86d2503f Beam: merged -> gather 2024-03-10 16:33:24 -07:00
Enrico Ros eb67eee53a Beam: improve Debug methods 2024-03-10 16:33:15 -07:00
Enrico Ros dfdad45963 Beam: improve Debug info 2024-03-10 16:21:04 -07:00
Enrico Ros 4735508d87 Beam: cleanups 2024-03-10 16:17:43 -07:00
Enrico Ros c43c47eab8 Beam: standalone debug app 2024-03-10 16:12:48 -07:00
Enrico Ros fafb2dc6b9 Dev Apps 2024-03-10 16:12:20 -07:00
Enrico Ros 140e99c465 Beam: start from neg scale 2024-03-10 15:59:43 -07:00
Enrico Ros 7ba1974390 Beam: Encapsulate and move logic to BeamStore 2024-03-10 15:34:34 -07:00
Enrico Ros 51b8510f17 Misc 2024-03-10 15:05:01 -07:00
Enrico Ros 5d6949d471 Force the hard work 2024-03-10 14:54:11 -07:00
Enrico Ros 8e9d0c1fd1 The Beauty and the Beam 2024-03-10 14:01:39 -07:00
Enrico Ros 3852a3b779 User Text: Collapse as well as Expand 2024-03-10 13:47:21 -07:00
Enrico Ros 8b4ba96936 Beam: rays increase button 2024-03-09 18:06:06 -08:00
Enrico Ros 0c17e18491 Beam: Rays close to gen 2024-03-09 17:57:30 -08:00
Enrico Ros 2bdbab3afc Messages: controllable Avatar sightings and content scaling offset 2024-03-09 17:54:27 -08:00
Enrico Ros b97499a95e Beam: renames 2024-03-09 17:39:36 -08:00
Enrico Ros a70ac57872 Beam: stored Rays 2024-03-09 17:01:16 -08:00
Enrico Ros a9cf457024 Beam: dynamic Rays 2024-03-09 13:07:22 -08:00
Enrico Ros e5c938ac37 Beam: optimize Ray 2024-03-09 12:44:50 -08:00
Enrico Ros edad54efa2 Beam: optimize View 2024-03-09 12:44:35 -08:00
Enrico Ros f88426758f Beam: ensure component recreation 2024-03-09 12:44:09 -08:00
Enrico Ros 77a28eb810 Optimize LLMSelect 2024-03-09 12:43:56 -08:00
Enrico Ros f834b27562 Optimize FormLabelStart 2024-03-09 12:43:49 -08:00
Enrico Ros 984e257cc5 Move to a better (more reactive?) BeamStore 2024-03-09 11:24:28 -08:00
Enrico Ros 729e7612bc Improve LLMSelect (fix dependency) 2024-03-09 11:23:59 -08:00
Enrico Ros 59fadeae57 Improve LLMSelect 2024-03-09 11:20:18 -08:00
Enrico Ros bfbf7a298a Beam: actor -> ray 2024-03-09 00:32:32 -08:00
Enrico Ros aad5d3bd65 Beam: improve style 2024-03-09 00:07:28 -08:00
Enrico Ros 504f19c445 Beam: cleanups 2024-03-08 23:34:05 -08:00
Enrico Ros 19c47eb442 Beam: improve state 2024-03-08 23:11:13 -08:00
Enrico Ros ab6043df60 Beam: rename 2024-03-08 21:58:32 -08:00
Enrico Ros 3305549a0f Fix customEvent helpers 2024-03-08 21:57:59 -08:00
Enrico Ros c24c3cb571 Beam: misc highlights 2024-03-08 18:55:38 -08:00
Enrico Ros 952999258b Beam: header: improve looks 2024-03-08 18:50:01 -08:00
Enrico Ros 0713eaa52c Beam: extract header 2024-03-08 18:43:35 -08:00
Enrico Ros 8fee689f60 Beam: update layout 2024-03-08 18:05:13 -08:00
Enrico Ros 75ddb17fed Beam: begin UI 2024-03-08 18:04:59 -08:00
Enrico Ros 0c6a74626c Beam: update store 2024-03-08 18:04:39 -08:00
Enrico Ros 41e3d0eaf9 Use customEventHelpers for creating and subscribing to custom events 2024-03-08 15:40:41 -08:00
Enrico Ros 8b9cfebd42 Beam: misc 2024-03-08 14:21:48 -08:00
Enrico Ros 16badee259 Beam: renames 2024-03-08 14:21:36 -08:00
Enrico Ros 9d5171dd36 Panes: bits 2024-03-08 13:43:56 -08:00
Enrico Ros e0c0e81b7d Panes: improve branching behavior 2024-03-08 13:42:13 -08:00
Enrico Ros fd4e8985fc Beam: 1.15 2024-03-08 12:16:58 -08:00
Enrico Ros 1d9b8503c0 Roll packages 2024-03-08 12:16:12 -08:00
Enrico Ros b3ef7b914d Beam: enable dev setting 2024-03-08 11:59:12 -08:00
Enrico Ros 2f59e12e20 Remove log 2024-03-06 22:20:40 -08:00
Enrico Ros 30e8652c2a 1.14.1: Release for Claude-3 2024-03-06 22:10:41 -08:00
Enrico Ros 5ee6aceb60 cleanups 2024-03-06 21:51:15 -08:00
Enrico Ros 6940b6a6d1 Anthropic: Full support for Claude-3 models. Closes #443, #450
Thanks to @slapglif in #450 for a reference implementation.
2024-03-06 21:50:24 -08:00
Enrico Ros 4e33ce9415 misc 2024-03-06 20:56:32 -08:00
Enrico Ros 944e22bde6 Anthropic: if there's a single system message, treat it as-if it was a user message 2024-03-06 20:49:59 -08:00
Enrico Ros 6054fa0a26 Anthropic: use the new Messages format (thanks @slapglif #450) 2024-03-06 20:42:33 -08:00
Enrico Ros 4db13cfed4 Anthropic: wire types (fully switch to the new Messages API) 2024-03-06 20:33:59 -08:00
Enrico Ros 6a6adda2e0 misc 2024-03-06 20:33:12 -08:00
Enrico Ros 4afa55c0db Anthropic: update models 2024-03-06 18:36:07 -08:00
Enrico Ros bc120bfb2b Merge branch 'release-1.14.0' 2024-03-05 22:41:40 -08:00
Enrico Ros 88966699e7 1.14.0: Changelog and README 2024-03-05 22:40:49 -08:00
Enrico Ros 9a5db3dcfb 1.14.0: release date 2024-03-05 22:38:56 -08:00
Enrico Ros 392aa1e654 1.14.0: README and Changelog 2024-03-05 22:16:02 -08:00
Enrico Ros f2b32e47ff 1.14.0: README and Changelog 2024-03-05 22:13:59 -08:00
Enrico Ros 58136d0181 maintainers: release name and cover 2024-03-05 21:58:04 -08:00
Enrico Ros 02733e55cb 1.14.0: News items 2024-03-05 21:55:44 -08:00
Enrico Ros 60df8456a7 1.14.0: Icons support 2024-03-05 21:54:48 -08:00
Enrico Ros 6d0ecc805c 1.14.0: Cover Image 2024-03-05 21:54:38 -08:00
Enrico Ros a0e9dd24a3 Explain the Debug page 2024-03-05 20:12:40 -08:00
Enrico Ros d1eb89057d Update flow 2024-03-05 14:51:00 -08:00
Enrico Ros 161c6dc83a 1.14.0: News Version 2024-03-05 14:50:51 -08:00
Enrico Ros 54848b8a7e 1.14.0: news: move around 2024-03-05 14:50:46 -08:00
Enrico Ros 990563c604 1.14.0: Version 2024-03-05 14:45:35 -08:00
Enrico Ros 8489ca8c8d Anthropic: add status update tracking #443 2024-03-05 14:40:43 -08:00
Enrico Ros b57e2c89e3 miniroll 2024-03-05 14:32:44 -08:00
Enrico Ros 66bedf78ac anthropic: cutoff dates 2024-03-04 22:30:09 -08:00
Enrico Ros 592c5cce60 roll packages 2024-03-04 22:01:19 -08:00
Enrico Ros 2ccf9a4e92 swap items 2024-03-04 21:38:30 -08:00
Enrico Ros ed333c0513 make 127.0.0.1 work on airgaped connections 2024-03-04 16:26:20 -08:00
Enrico Ros 89b65b7009 unbreak build #444 2024-03-04 15:20:08 -08:00
Enrico Ros 0cc2d346af Merge pull request #444 from jacksongoode/claude-3
Add Claude 3 models
2024-03-04 14:18:19 -08:00
Jackson 5f81e78bc4 Add Claude 2 to old models 2024-03-04 12:29:04 -08:00
Jackson 554b5fd4b5 Add Claude 3 models 2024-03-04 12:24:12 -08:00
Enrico Ros a58c3a6a52 Merge branch 'Penagwin-groq-provider' 2024-03-01 15:35:13 -08:00
Enrico Ros 6147f1131b Groq review: perfect. 2024-03-01 15:34:48 -08:00
Enrico Ros 26552aa996 Update Groq icon 2024-03-01 15:28:26 -08:00
Paul Lang 17cc31f376 Added support to fetch models for groq 2024-03-01 13:23:20 -05:00
Paul Lang 41f7a63392 Added Groq as an endpoint 2024-02-29 13:06:56 -05:00
Enrico Ros 70474ce517 Chat Drawer: improve view menu 2024-02-28 03:47:37 -08:00
Enrico Ros 365f144c57 System messages: improve menu 2024-02-28 03:07:22 -08:00
Enrico Ros ff1e1c249f System messages: differentiate looks 2024-02-28 03:02:41 -08:00
Enrico Ros e3ed6f802d Browse: disambiguate more 2024-02-27 00:48:06 -08:00
Enrico Ros b5ed078260 Stable: fix news disappearing 2024-02-27 00:46:23 -08:00
Enrico Ros 64310292da Browse: disambiguate 2024-02-27 00:43:21 -08:00
Enrico Ros 2656d0dfa5 GA: Infrastructure. Enables data analysis for product improvement. 2024-02-27 00:26:13 -08:00
Enrico Ros 70a7f0aaf4 GA: Build-time validation 2024-02-26 23:24:32 -08:00
Enrico Ros d405dcaa3a GA: Docs 2024-02-26 23:24:24 -08:00
Enrico Ros 5ecef67855 GA: Docker and GitHub actions support 2024-02-26 23:24:12 -08:00
Enrico Ros 8f6d9f8c31 Debug: add frontend variables (as a reminder, they're set at build time by next.js) 2024-02-26 23:22:36 -08:00
Enrico Ros 8662437b1a Bring back Dev mode settings 2024-02-26 14:34:16 -08:00
Enrico Ros ce3e5629e7 Bits 2024-02-26 14:26:39 -08:00
Enrico Ros d4c487534d Optimize heavily: ChatMessages can finally be memoed 2024-02-26 14:25:35 -08:00
Enrico Ros 2b9577b87d Beam: subordinate to option 2024-02-26 13:28:48 -08:00
Enrico Ros 6a0f8564f3 Beam: as command 2024-02-26 13:12:28 -08:00
Enrico Ros e9f74946e3 Beam: cleanups 2024-02-26 13:00:10 -08:00
Enrico Ros e043ab8710 Temp: hide Draw and Workspaces 2024-02-26 12:45:43 -08:00
Enrico Ros 79dd2f5f6b Update #434: online models with a 🌐 2024-02-26 12:42:00 -08:00
Enrico Ros 76e6ca8f0c Update #434: deprecated as hidden, and new sort by capabilities, descending 2024-02-26 12:28:09 -08:00
Enrico Ros 0f310e866f Merge pull request #434
Added Perplexity's new models, updated context lengths, new deprecations
2024-02-26 12:15:21 -08:00
Enrico Ros 1f66221bbd Mistral: elegance. 2024-02-26 12:14:10 -08:00
Enrico Ros 635b70fb6c Roll packages 2024-02-26 12:14:00 -08:00
Enrico Ros d113801b18 Beam: begin 2024-02-26 12:05:45 -08:00
Enrico Ros ac74efed4a Cleanups 2024-02-26 12:05:43 -08:00
Enrico Ros 52e1dc2fb2 Mistral: support for Large models 2024-02-26 12:04:29 -08:00
Paul Lang 7564fd5e03 Added Perplexity's new models, updated context lengths, new deprecations
https://docs.perplexity.ai/changelog/api-updates-february-2024
2024-02-26 14:25:54 -05:00
Enrico Ros 96810328ee Remove Ephemerals from the Chat Store 2024-02-26 04:32:36 -08:00
Enrico Ros 5603a98df9 Reposition Ephemerals 2024-02-26 02:47:40 -08:00
Enrico Ros 5c800e35f2 Extract simil-controllers for the chat 2024-02-26 02:30:50 -08:00
Enrico Ros dd15eecdf1 Improve debug message 2024-02-26 02:26:51 -08:00
Enrico Ros b6cb68bfcf Fix: react to the change 2024-02-25 19:02:53 -08:00
Enrico Ros 07c5143f1e Fix: don't hide the persona of the current chat in the dropdown 2024-02-25 19:00:05 -08:00
Enrico Ros e8c0cf3306 LocalAI: user-configurable API Key. Fixes #432. Additionally, full server-side config is allowed. 2024-02-23 05:24:31 -08:00
Enrico Ros 5e86d16442 LocalAI: support for backend configuration env-vars. Part 1/2 of #432.
- LOCALAI_API_HOST: Sets the URL of the LocalAI server, or defaults to http://127.0.0.1:8080
 - LOCALAI_API_KEY: The (Optional) API key for LocalAI
2024-02-23 04:46:24 -08:00
Enrico Ros 5ff246a241 Gemini: detect max_tokens, and safer parsing 2024-02-23 04:20:48 -08:00
Enrico Ros 58d54682ab Tryfix #431 2024-02-23 03:02:11 -08:00
Enrico Ros 5ab547d434 Improve usability of the llm list dialog 2024-02-23 02:57:11 -08:00
Enrico Ros 96a5868543 Fonts: rationalize sizes 2024-02-23 02:18:31 -08:00
Enrico Ros 0422c03efe Comments 2024-02-22 23:22:56 -08:00
Enrico Ros 2745c7295e Fix the client variable destructuring 2024-02-22 23:06:54 -08:00
Enrico Ros 82f6ec5839 Bits 2024-02-22 22:56:52 -08:00
Enrico Ros 8e1a155cff Document the PlantUML Server variable, and improve error checking in the renderer. 2024-02-22 22:55:16 -08:00
Fred Liu 521578c4aa Enable custom PlantUML server, Fixes #415
(cherry picked from commit 49392acfd6ab55cc4ba8a951272e921b7e8ff64c, fredliubojin main)
2024-02-22 22:34:14 -08:00
Enrico Ros a04f5f8c94 Call: fix overflow on Telephone 2024-02-22 10:49:40 -08:00
Enrico Ros fb6f96689b Improve Image warning & style. Closes #419 2024-02-22 10:36:49 -08:00
Enrico Ros 69a12d45f3 Restore and improve calls on the main branch. Closes #424 2024-02-22 09:19:54 -08:00
Enrico Ros bf4dd37a1b Calls: improve message looks 2024-02-22 09:18:00 -08:00
Enrico Ros b1230a9758 Clarify isVercelFromBackendOrSSR 2024-02-22 08:55:46 -08:00
Enrico Ros 23621c57ed Fix Share title 2024-02-22 08:49:02 -08:00
Enrico Ros 5f49a9f8ef [bug] Hide personas from the dropdown if hidden in the selector. 2024-02-22 08:48:17 -08:00
Enrico Ros c5b31c3975 Fix -kebab-case 2024-02-22 08:47:39 -08:00
Enrico Ros 74dbe11d4a Improve gfx on split screen 2024-02-22 08:40:23 -08:00
Enrico Ros 64b18c0a0a Dev2: prefer tables 2024-02-22 08:30:50 -08:00
Enrico Ros 7c6cec8eea Persona selection: improve first time experience 2024-02-22 08:06:17 -08:00
Enrico Ros 2b1869e1b3 Bits 2024-02-22 07:54:16 -08:00
Enrico Ros 87e5a155ba Revert 2024-02-22 07:52:18 -08:00
Enrico Ros d5c7071f1b Default to ContentScaling: 'sm' 2024-02-22 07:45:49 -08:00
Enrico Ros 04eb2210e6 Use a less sharp edge 2024-02-22 07:42:53 -08:00
Enrico Ros 4748b00be1 Show a warning when the page is being translated. Closes #429 2024-02-22 07:33:11 -08:00
Enrico Ros 18968ba985 Button to unhide models. Closes #430 2024-02-22 06:50:45 -08:00
Enrico Ros 59b300b71e Merge remote-tracking branch 'opensource/main-stable' 2024-02-22 06:39:12 -08:00
Enrico Ros 5916ef74f9 Gemini: support for createTunedModel 2024-02-22 06:38:45 -08:00
Enrico Ros f5602723c7 Improve outputs 2024-02-21 16:34:13 -08:00
Enrico Ros 59795dcd22 Improve export scripts 2024-02-21 16:17:24 -08:00
Enrico Ros 127a5cbf96 LocalAI: update docs 2024-02-21 15:02:07 -08:00
Enrico Ros 2b040664cb Use /info/debug to export App and Browser info for debugging 2024-02-21 02:10:39 -08:00
Enrico Ros 4ffbdfd16c Improve Placeholder App 2024-02-21 01:25:11 -08:00
Enrico Ros e200cbf312 Update name 2024-02-21 01:24:57 -08:00
Enrico Ros f4edd192fd Package min chunks of 40kb 2024-02-21 00:34:30 -08:00
Enrico Ros dd07167087 Roll packages 2024-02-20 21:36:51 -08:00
Enrico Ros 81aa8468a7 Merge remote-tracking branch 'opensource/main-stable'
# Conflicts:
#	package-lock.json
#	package.json
2024-02-20 21:31:47 -08:00
Enrico Ros 871e72b655 Update Vercel packages 2024-02-20 21:30:25 -08:00
Enrico Ros 9825d8e2f3 Specialize React->Next 2024-02-20 21:09:05 -08:00
Enrico Ros 58c5569beb Bundle: min 50kb - optimization trial 2024-02-20 17:20:43 -08:00
Enrico Ros c975511c74 Merge remote-tracking branch 'opensource/main-stable' 2024-02-20 16:51:59 -08:00
Enrico Ros e3c52fb1f9 Flush 2024-02-20 16:51:49 -08:00
Enrico Ros 397517e666 Tryfix CLS with delayed attraction 2024-02-20 16:51:26 -08:00
Enrico Ros 09088febe8 Tryfix CLS with fast bootup routing 2024-02-20 16:50:48 -08:00
Enrico Ros bbf5dc078e Increase the sample rate
(cherry picked from commit ce0dca86ac)
2024-02-20 15:31:00 -08:00
Enrico Ros 14d57aa622 Use Vercel components only on Vercel deployments.
(cherry picked from commit 72bb31881a)
2024-02-20 15:31:00 -08:00
Enrico Ros bcfc4921ca Publish docs 2024-02-20 04:26:13 -08:00
Enrico Ros cff70ebadd Fix derived logo 2024-02-20 03:03:22 -08:00
Enrico Ros 4b9c958d65 Docs: cleanup - in preparation for web docs 2024-02-20 01:51:47 -08:00
Enrico Ros 7dc7116a2f Docs: cleanup and add index (README.md). 2024-02-20 01:32:05 -08:00
Enrico Ros 92a2c93644 Roll package 2024-02-19 05:25:11 -08:00
Enrico Ros 7be0d88794 Remove Experiment 2024-02-19 05:25:11 -08:00
Enrico Ros ff6ca01813 Flush changes 2024-02-19 05:25:11 -08:00
Enrico Ros ce0dca86ac Increase the sample rate 2024-02-19 00:32:50 -08:00
Enrico Ros 6c51a36dbc Prevent standalone builds from modifying the tsconfig.json. 2024-02-18 15:12:59 -08:00
Enrico Ros 72bb31881a Use Vercel components only on Vercel deployments. 2024-02-18 15:12:24 -08:00
Enrico Ros c6fcad03cd Add Sharp as suggested by Next 2024-02-18 14:57:36 -08:00
Enrico Ros 70de7133a9 Electron: skeleton 2024-02-18 02:20:04 -08:00
Enrico Ros ef36751eac Electron: structure 2024-02-18 02:19:44 -08:00
Enrico Ros dee1461b9c Draggable App Bar 2024-02-18 01:29:10 -08:00
Enrico Ros 3b775fc817 Export: automate static exports 2024-02-18 00:39:10 -08:00
Enrico Ros da52eff9d3 Try fixing the dockerfile again. 2024-02-17 20:49:19 -08:00
Enrico Ros a7efaa7720 Export Frontend: to the 'dist/' folder 2024-02-17 20:13:56 -08:00
Enrico Ros a42587c498 Fix Docker build after moving Prisma 2024-02-17 20:04:48 -08:00
Enrico Ros d29265f042 Relocate Prisma to src/server/prisma 2024-02-17 19:44:36 -08:00
Enrico Ros c305b44c41 Fix Chat interactivity on drag-to-collapse 2024-02-17 19:07:30 -08:00
Enrico Ros 32ff65be1c Roll packages 2024-02-17 18:33:11 -08:00
Enrico Ros b550cbdfc7 Pipeline, add support for .MJS 2024-02-17 18:09:54 -08:00
Enrico Ros f767ad81ce Export Frontend: work around NextJS aborting on the nodejs API.
This introduces a pre-build step on Next Build, which hides the files
in the app/api directory when the EXPORT_FRONTEND environment
variable is true-ish.

Hopefully there won't be disruption due to the post-processing step.

Also check https://github.com/vercel/next.js/issues/61213 for
upstream updates.
2024-02-17 18:03:21 -08:00
Enrico Ros 35d04055ac Update OpenAI models cutoff date, as OpenAI swapped it for existing models... Fixes #422. 2024-02-17 17:59:16 -08:00
Enrico Ros c7fe75829f Export Frontend: first steps
Note: needs deletion of app/api/trpc-node/[trpc]/route.ts due to
an upstream issue
2024-02-17 16:52:32 -08:00
Enrico Ros 8299b4c148 Clearly mark frontend fetches 2024-02-17 15:30:35 -08:00
Enrico Ros 5bb84f8930 Elevenlabs: mode handler to module 2024-02-17 15:17:07 -08:00
Enrico Ros 047c9a2f07 Backend -> Services fetchers 2024-02-17 15:06:59 -08:00
Enrico Ros 8c11925444 Delete also when searching. 2024-02-16 16:30:42 -08:00
Enrico Ros 1cbb4fd11a Update to parse more. #361 2024-02-16 10:14:02 -08:00
Enrico Ros 0a8d9ebd55 Render Latex when in \[..\] blocks. Requires newlines "\[\n ... \n\]\n". Fixes #361 2024-02-16 10:11:57 -08:00
Enrico Ros 386724655e Pre-select the last added Model Source (not the earliest) 2024-02-16 09:54:17 -08:00
Enrico Ros 7b37b9e204 Google Gemini: auto-detect symlink targets 2024-02-16 09:49:23 -08:00
Enrico Ros 3b02612124 Google Gemini: show symlink models 2024-02-16 09:45:23 -08:00
Enrico Ros 32b040cbcf Search results heading 2024-02-16 09:33:40 -08:00
Enrico Ros 75a15a12a6 Message when no chats in active folder/search. Fixes #394 2024-02-16 09:28:33 -08:00
Enrico Ros 0cb7be8381 Fix state 2024-02-16 09:10:44 -08:00
Enrico Ros 20d3c267a3 Persist user edited model settings. Fixes #398 2024-02-16 08:50:59 -08:00
Enrico Ros 84313ffa8c Inconclusive. #401 2024-02-16 08:37:06 -08:00
Enrico Ros be66ce0f32 Perplexity: full support. Fixes #407 2024-02-16 08:21:49 -08:00
Enrico Ros 12c1194009 Move Discord icon 2024-02-16 07:39:24 -08:00
Enrico Ros 82b83a39dd Import/Export All: save/restore folders (and folder presence state). Fixes #416 2024-02-16 07:11:07 -08:00
Enrico Ros ac617de4ae Update 2024-02-15 15:57:29 -08:00
Enrico Ros b6731c9afa Less is more 2024-02-14 05:30:58 -08:00
Enrico Ros 3a7ece6508 Improve 2024-02-14 05:27:28 -08:00
Enrico Ros 2c69d2805d While at it 2024-02-14 05:21:48 -08:00
Enrico Ros 87b03c67ec Expandable sections 2024-02-14 05:19:34 -08:00
Enrico Ros 569b08288e More moves 2024-02-14 05:12:05 -08:00
Enrico Ros 049fa90832 More moves 2024-02-14 05:06:42 -08:00
Enrico Ros f23347de7e Refer to CoolAGI 2024-02-14 05:02:09 -08:00
Enrico Ros 0272283f94 LocalAI: mention Voice Cloning after the chat with @mudler 2024-02-13 23:04:05 -08:00
Enrico Ros 64640c1331 Group by date by default 2024-02-13 19:28:53 -08:00
Enrico Ros ff1471cfe8 Call it like it is 2024-02-13 04:15:46 -08:00
Enrico Ros aae3783f67 LocalAI: Model Gallery Admin panel. Fixes #411 2024-02-13 04:12:14 -08:00
Enrico Ros 053aa12a91 Improve messages 2024-02-13 02:13:51 -08:00
Enrico Ros 17a006db8f LocalAI: status of integration 2024-02-13 01:41:41 -08:00
Enrico Ros 56d912da3d Add Sx and expandedVariant to ExpanderAccordion 2024-02-13 01:41:30 -08:00
Enrico Ros 3c60284e6e LocalAI: raise to 4 max instances 2024-02-13 00:02:58 -08:00
Enrico Ros 76ddff4820 Source Add Dialog: improvement, esp. icons and badges 2024-02-12 15:25:42 -08:00
Enrico Ros 1bd6dc0a1a LocalAI: update icon 2024-02-12 14:39:30 -08:00
Enrico Ros 5c7d289123 Placeholder 2024-02-12 13:56:45 -08:00
Enrico Ros 8f6d646a1f Perfect diagrams auto-resize on mobile 2024-02-12 13:48:59 -08:00
Enrico Ros c42123fe2a Fix mobile zIndex 2024-02-12 13:42:15 -08:00
Enrico Ros 58bd84b600 Grouping by Date or Persona 2024-02-12 03:50:18 -08:00
Enrico Ros 621eb4a54c Chat: filtered deletion + navigation Rendrer tree != chats list. Fixes #324
This is a good feature. The 'Delete All' will always operate on the current selection.

If a Folder restricts to 10 conversasions, and a search narrows it down to 3,
then the 3 will be deleted. This works really
well for quick cleanups.
2024-02-12 03:04:53 -08:00
Enrico Ros 9073cff1c1 AppChat: perfect filtered deletion 2024-02-12 02:59:55 -08:00
Enrico Ros d69516df5c Add a ProcessingQueue, fixes #409 2024-02-11 22:36:34 -08:00
Enrico Ros 7322280d3d Try a change for #408 2024-02-11 21:50:42 -08:00
Enrico Ros 5f79569ea9 Style fix 2024-02-11 13:26:54 -08:00
Enrico Ros fe8b8472b7 Share Blocks
Note: there's one dependency to ../../app/chat inside
2024-02-11 12:55:30 -08:00
Enrico Ros cb2b1a89b5 Draw: temp click to remove 2024-02-11 03:38:59 -08:00
Enrico Ros 6ece7b884a Draw: mobile/desktop grid seems fine 2024-02-11 03:37:18 -08:00
Enrico Ros 04fc9264cb Draw: draw xN images 2024-02-11 03:13:42 -08:00
Enrico Ros 016c2df942 Draw: show the first images 2024-02-11 02:57:10 -08:00
Enrico Ros bf6a2b60b9 Draw: improbetterment 2024-02-11 02:42:59 -08:00
Enrico Ros 5093e70552 ditto 2024-02-11 02:39:53 -08:00
Enrico Ros 3bd50e1b45 More targeted error message 2024-02-11 02:37:40 -08:00
Enrico Ros 793383f70d Slight change to the error format 2024-02-11 02:23:32 -08:00
Enrico Ros 3b84e42932 Draw: Begin rendering 2024-02-11 02:03:51 -08:00
Enrico Ros 09efc9b148 Draw: Designer: uids per each prompt coming out 2024-02-11 02:00:34 -08:00
Enrico Ros 90c2542486 Image Renderer: cleanups 2024-02-11 01:59:38 -08:00
Enrico Ros 9259fa3b6d Improved New Chat button - fits better 2024-02-11 00:54:30 -08:00
Enrico Ros 0c8f102830 Folders: dynamic scaling 2024-02-11 00:13:52 -08:00
Enrico Ros 02972a0fb6 Folders: move button in the pane 2024-02-11 00:12:41 -08:00
Enrico Ros 2a4a65f129 Improve Icon 2024-02-10 23:44:04 -08:00
Enrico Ros e16270e1ec Chat Drawer: Folder Toggle Icons 2024-02-10 23:40:55 -08:00
Enrico Ros 201a884828 Add dependency 2024-02-10 23:26:35 -08:00
Enrico Ros 2a32139be3 Text Scaling: scale the drawer contents 2024-02-10 23:26:14 -08:00
Enrico Ros 7955bf2b86 Show error messages - where they belong. 2024-02-10 21:57:47 -08:00
Enrico Ros a5d70e4ca3 Memory Optimization in ChatMessages: Memo the non-in-flux (and only the root), and within the in-flux'd memo only the baked parts (and not the on the fly) - massive GC savings 2024-02-10 21:10:01 -08:00
Enrico Ros 12eb08ee08 Optimized Composer down to 2.8ms: stable callbacks, stable const styles, memoed Buttons. 2024-02-10 21:07:36 -08:00
Enrico Ros fe74583bae Optimize Tooltip timeouts 2024-02-10 20:07:09 -08:00
Enrico Ros b8b1dd2cfb Optimize 2024-02-10 20:06:35 -08:00
Enrico Ros 9723b328c3 Chat Drawer Item: denser menu, with disappearing items on Delete Arming, for Focus 2024-02-10 19:48:28 -08:00
Enrico Ros edc3ab6d00 Branch Icon on the Chats 2024-02-10 19:47:35 -08:00
Enrico Ros 0e243cd167 Update {{LocaleNow}} and 'Generic' 2024-02-10 10:19:50 -08:00
Enrico Ros b8e0064381 Adding {{LocaleNow}} with enough info to get on the same page as the user 2024-02-10 10:18:24 -08:00
Enrico Ros 018c77901d Labs Setting: Performance Mode - Unlocks updates (otherwise visually capped at 12Hz) 2024-02-09 22:38:44 -08:00
Enrico Ros 5849fd9c94 Turning on revealing client-side debug messages. 2024-02-09 22:07:41 -08:00
Enrico Ros 6a5d1eb5c2 Write Scheduler for iDB 2024-02-09 21:37:21 -08:00
Enrico Ros fc70857fae Limit Assistant responses editMessages to 12Hz and decrease sqrt with the number of chats 2024-02-09 21:18:35 -08:00
Enrico Ros 5cd6fe23d8 Sharing: add the title on native shares 2024-02-09 21:13:05 -08:00
Enrico Ros beffcdcba9 Clenaups on the streaming client, to clarify incrementalness 2024-02-09 21:13:05 -08:00
Enrico Ros cdd39457ff Begin cleanup of the streaming client 2024-02-09 21:13:05 -08:00
Enrico Ros 937b2806ef roll packages 2024-02-09 01:29:41 -08:00
Enrico Ros 34552190c6 Merge placeholder - will remove the feature-promptFX branch 2024-02-09 00:36:10 -08:00
Enrico Ros 7e762d5ddc Alt Chat Title 2024-02-09 00:33:28 -08:00
Enrico Ros 8e78b21a5c AI Auto-Title: async 2024-02-09 00:32:21 -08:00
Enrico Ros ae85fdf59f Open Code only on complete blocks 2024-02-09 00:31:19 -08:00
Enrico Ros e39dc428cc Fix CSS 2024-02-09 00:31:07 -08:00
Enrico Ros cc178efacb Labs: toggle Chat title 2024-02-08 23:52:21 -08:00
Enrico Ros 8a7a3afc10 LinkChat: mark messages as mobile to auto-scale charts on mobile 2024-02-08 23:18:26 -08:00
Enrico Ros e0f1689125 LinkChat: move indications 2024-02-08 23:12:10 -08:00
Enrico Ros 3acdd75863 Update CodePen, add StackBlitz, JSFiddle 2024-02-08 22:58:53 -08:00
Enrico Ros 1ca5ff726c Remove Replit support - Replit does not support to be sent code anymore. Looking for alternatives. 2024-02-08 21:02:12 -08:00
Enrico Ros 464051c319 LinkChat: renames 2024-02-08 20:53:27 -08:00
Enrico Ros 548859fa65 Customize existing prompts into new 2024-02-08 20:50:44 -08:00
Enrico Ros f57c10508f Dev2: reduce annoyances 2024-02-08 20:50:06 -08:00
Enrico Ros b7f53d965f Merge remote-tracking branch 'opensource/main-stable' 2024-02-08 18:13:11 -08:00
Enrico Ros 28b1090fd7 Enable horizontally scrollable attachments. Fixes #406 2024-02-08 18:11:12 -08:00
Enrico Ros 566bf8d38e Share Link: font size setting 2024-02-08 15:16:35 -08:00
Enrico Ros 663306bd3b Improve spacings / list buttons sizes 2024-02-08 07:20:00 -08:00
Enrico Ros 165a5e60d3 Scaling: improve 2024-02-08 06:56:48 -08:00
Enrico Ros 3b01a26eed Scaling: clean 2024-02-08 06:21:52 -08:00
Enrico Ros 65f997a2ba Roll packages 2024-02-08 05:31:53 -08:00
Enrico Ros c1217ed8ed No tRPC fixes 2024-02-08 04:38:13 -08:00
Enrico Ros 6ae76c553f Improve DallE 1hr dialog. 2024-02-08 04:09:08 -08:00
Enrico Ros 141096eace Links: open them externally so big-AGI is not interrupted. 2024-02-08 03:11:00 -08:00
Enrico Ros c4003a888a Shortcuts for text size: ctrl + shift + '+' / '-' 2024-02-08 02:56:39 -08:00
Enrico Ros d1c22e12a7 Consolidate the 3 dynamic imports into 1 - faster, smaller. 2024-02-08 02:44:42 -08:00
Enrico Ros 9461cab182 Save 3kb from dynamically importing this module 2024-02-08 02:15:04 -08:00
Enrico Ros dcceead4ca Remove unused icon (~0.6kb bundle) 2024-02-08 02:02:04 -08:00
Enrico Ros ae8ac5111c Reduce total bundle size for React-Player (YouTube only) 2024-02-08 01:49:34 -08:00
Enrico Ros 1e35fceb61 Best-Of: custom icon 2024-02-08 01:35:11 -08:00
Enrico Ros 88d0ffd712 Best-Of: input wires 2024-02-08 01:35:11 -08:00
Enrico Ros 6cbc3fbf28 1.14: begin mentioning 2024-02-08 01:35:00 -08:00
Enrico Ros 4eb6f6da9d Re-open the 2 Dev Sections 2024-02-08 01:34:19 -08:00
Enrico Ros 5bc320385f Update README 2024-02-08 00:26:07 -08:00
381 changed files with 18938 additions and 5973 deletions
+5
View File
@@ -1,7 +1,12 @@
# big-AGI non-code files
/docs/
/dist/
README.md
# Ignore build and log files
Dockerfile
/.dockerignore
# Node build artifacts
/node_modules
/.pnp
+24 -2
View File
@@ -21,8 +21,9 @@ assignees: enricoros
- [ ] Create a temporary tag `git tag v1.2.3 && git push opensource --tags`
- [ ] Create a [New Draft GitHub Release](https://github.com/enricoros/big-agi/releases/new), and generate the automated changelog (for new contributors)
- [ ] Update the release version in package.json, and `npm i`
- [ ] Update in-app News [src/apps/news/news.data.tsx](/src/apps/news/news.data.tsx)
- [ ] Update the in-app News version number
- [ ] Update in-app News [src/apps/news/news.data.tsx](/src/apps/news/news.data.tsx)
- [ ] Update in-app Cover graphics
- [ ] Update the README.md with the new release
- [ ] Copy the highlights to the [docs/changelog.md](/docs/changelog.md)
- Release:
@@ -79,11 +80,32 @@ I need the following from you:
1. a table summarizing all the new features in 1.2.3 with the following columns: 4 words description (exactly what it is), short description, usefulness (what it does for the user), significance, link to the issue number (not the commit)), which will be used for the artifacts later
2. then double-check the git log to see if there are any features of significance that are not in the table
3. then score each feature in terms of importance for users (1-10), relative impact of the feature (1-10, where 10 applies to the broadest user base), and novelty and uniqueness (1-10, where 10 is truly unique and novel from what exists already)
3. then score each feature in terms of importance for users (1-10), relative impact of the feature (1-10, where 10 applies to the broadest user base), and novelty and uniqueness (1-10, where 10 is truly unique and novel from what exists already)
4. then improve the table, in decreasing order of importance for features, fixing any detail that's missing, in particular check if there are commits of significance from a user or developer point of view, which are not contained in the table
5. then I want you then to update the news.data.tsx for the new release
```
### release name
```markdown
please brainstorm 10 different names for this release. see the former names here: https://big-agi.com/blog
```
You can follow with 'What do you think of Modelmorphic?' or other selected name
### cover images
```markdown
Great, now I need to generate images for this. Before I used the following prompts (2 releases before).
// An image of a capybara sculpted entirely from black cotton candy, set against a minimalist backdrop with splashes of bright, contrasting sparkles. The capybara is using a computer with split screen made of origami, split keyboard and is wearing origami sunglasses with very different split reflections. Split halves are very contrasting. Close up photography, bokeh, white background.
import coverV113 from '../../../public/images/covers/release-cover-v1.13.0.png';
// An image of a capybara sculpted entirely from black cotton candy, set against a minimalist backdrop with splashes of bright, contrasting sparkles. The capybara is calling on a 3D origami old-school pink telephone and the camera is zooming on the telephone. Close up photography, bokeh, white background.
import coverV112 from '../../../public/images/covers/release-cover-v1.12.0.png';
What can I do now as far as images? Give me 4 prompt ideas with the same style as looks as the former, but different scene or action
```
### Readme (and Changelog)
```markdown
+10 -1
View File
@@ -32,6 +32,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
@@ -49,12 +55,15 @@ jobs:
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/main-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
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
build-args: NEXT_PUBLIC_GA4_MEASUREMENT_ID=${{ secrets.GA4_MEASUREMENT_ID }}
+4
View File
@@ -1,5 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Frontend Build: ignore API files disabled for this build
/app/**/*.backup
# dependencies
/node_modules
/.pnp
@@ -10,6 +13,7 @@
# next.js
/.next/
/dist/
/out/
# production
+12 -4
View File
@@ -2,22 +2,28 @@
FROM node:18-alpine AS base
ENV NEXT_TELEMETRY_DISABLED 1
# Dependencies
FROM base AS deps
WORKDIR /app
# Dependency files
COPY package*.json ./
COPY prisma ./prisma
COPY src/server/prisma ./src/server/prisma
# Install dependencies, including dev (release builds should use npm ci)
ENV NODE_ENV development
RUN npm ci
# Builder
FROM base AS builder
WORKDIR /app
# Optional argument to configure GA4 at build time (see: docs/deploy-analytics.md)
ARG NEXT_PUBLIC_GA4_MEASUREMENT_ID
ENV NEXT_PUBLIC_GA4_MEASUREMENT_ID=${NEXT_PUBLIC_GA4_MEASUREMENT_ID}
# Copy development deps and source
COPY --from=deps /app/node_modules ./node_modules
COPY . .
@@ -29,6 +35,7 @@ RUN npm run build
# Reduce installed packages to production-only
RUN npm prune --production
# Runner
FROM base AS runner
WORKDIR /app
@@ -38,9 +45,10 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy Built app
COPY --from=builder --chown=nextjs:nodejs /app/public public
COPY --from=builder --chown=nextjs:nodejs /app/.next .next
COPY --from=builder --chown=nextjs:nodejs /app/node_modules node_modules
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nextjs:nodejs /app/src/server/prisma ./src/server/prisma
# Minimal ENV for production
ENV NODE_ENV production
+162 -110
View File
@@ -1,39 +1,96 @@
# BIG-AGI 🧠✨
Welcome to big-AGI 👋, the GPT application for professionals that need function, form,
simplicity, and speed. Powered by the latest models from 11 vendors and
open-source model servers, `big-AGI` offers best-in-class Voice and Chat with AI Personas,
visualizations, coding, drawing, calling, and quite more -- all in a polished UX.
Welcome to big-AGI, the AI suite for professionals that need function, form,
simplicity, and speed. Powered by the latest models from 12 vendors and
open-source servers, `big-AGI` offers best-in-class Chats,
[Beams](https://github.com/enricoros/big-AGI/issues/470),
and [Calls](https://github.com/enricoros/big-AGI/issues/354) with AI personas,
visualizations, coding, drawing, side-by-side chatting, and more -- all wrapped in a polished UX.
Pros use big-AGI. 🚀 Developers love big-AGI. 🤖
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)
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)
[![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)
## 👉 [roadmap](https://github.com/users/enricoros/projects/4/views/2) 👉 [installation](docs/installation.md) 👉 [documentation](docs/README.md)
big-AGI is an open book; our **[public roadmap](https://github.com/users/enricoros/projects/4/views/2)**
shows the current developments and future ideas.
> Note: bigger better features (incl. Beam-2) are being cooked outside of `main`.
- Got a suggestion? [_Add your roadmap ideas_](https://github.com/enricoros/big-agi/issues/new?&template=roadmap-request.md)
- Want to contribute? [_Pick up a task!_](https://github.com/users/enricoros/projects/4/views/4) - _easy_ to _pro_
[//]: # (big-AGI is an open book; see the **[ready-to-ship and future ideas](https://github.com/users/enricoros/projects/4/views/2)** in our open roadmap)
### What's New in 1.13.0 · Feb 8, 2024 · Multi + Mind
### What's New in 1.16.2 · Jun 7, 2024 (minor release)
- Improve web downloads, as text, markdwon, or HTML
- Proper support for Gemini models
- Added the latest Mistral model
- Tokenizer support for gpt-4o
- Updates to Beam
### What's New in 1.16.1 · May 13, 2024 (minor release)
- Support for the new OpenAI GPT-4o 2024-05-13 model
### What's New in 1.16.0 · May 9, 2024 · Crystal Clear
- [Beam](https://big-agi.com/blog/beam-multi-model-ai-reasoning) core and UX improvements based on user feedback
- Chat cost estimation 💰 (enable it in Labs / hover the token counter)
- Save/load chat files with Ctrl+S / Ctrl+O on desktop
- Major enhancements to the Auto-Diagrams tool
- YouTube Transcriber Persona for chatting with video content, [#500](https://github.com/enricoros/big-AGI/pull/500)
- Improved formula rendering (LaTeX), and dark-mode diagrams, [#508](https://github.com/enricoros/big-AGI/issues/508), [#520](https://github.com/enricoros/big-AGI/issues/520)
- Models update: **Anthropic**, **Groq**, **Ollama**, **OpenAI**, **OpenRouter**, **Perplexity**
- Code soft-wrap, chat text selection toolbar, 3x faster on Apple silicon, and more [#517](https://github.com/enricoros/big-AGI/issues/517), [507](https://github.com/enricoros/big-AGI/pull/507)
#### 3,000 Commits Milestone · April 7, 2024
![big-AGI Milestone](https://github.com/enricoros/big-AGI/assets/32999/47fddbb1-9bd6-4b58-ace4-781dfcb80923)
- 🥇 Today we <b>celebrate commit 3000</b> in just over one year, and going stronger 🚀
- 📢️ Thanks everyone for your support and words of love for Big-AGI, we are committed to creating the best AI experiences for everyone.
### What's New in 1.15.0 · April 1, 2024 · Beam
- ⚠️ [**Beam**: the multi-model AI chat](https://big-agi.com/blog/beam-multi-model-ai-reasoning). find better answers, faster - a game-changer for brainstorming, decision-making, and creativity. [#443](https://github.com/enricoros/big-AGI/issues/443)
- Managed Deployments **Auto-Configuration**: simplify the UI models setup with backend-set models. [#436](https://github.com/enricoros/big-AGI/issues/436)
- Message **Starring ⭐**: star important messages within chats, to attach them later. [#476](https://github.com/enricoros/big-AGI/issues/476)
- Enhanced the default Persona
- Fixes to Gemini models and SVGs, improvements to UI and icons
- 1.15.1: Support for Gemini Pro 1.5 and OpenAI Turbo models
- Beast release, over 430 commits, 10,000+ lines changed: [release notes](https://github.com/enricoros/big-AGI/releases/tag/v1.15.0), and changes [v1.14.1...v1.15.0](https://github.com/enricoros/big-AGI/compare/v1.14.1...v1.15.0)
<details>
<summary>What's New in 1.14.1 · March 7, 2024 · Modelmorphic</summary>
- **Anthropic** [Claude-3](https://www.anthropic.com/news/claude-3-family) model family support. [#443](https://github.com/enricoros/big-AGI/issues/443)
- New **[Perplexity](https://www.perplexity.ai/)** and **[Groq](https://groq.com/)** integration (thanks @Penagwin). [#407](https://github.com/enricoros/big-AGI/issues/407), [#427](https://github.com/enricoros/big-AGI/issues/427)
- **[LocalAI](https://localai.io/models/)** deep integration, including support for [model galleries](https://github.com/enricoros/big-AGI/issues/411)
- **Mistral** Large and Google **Gemini 1.5** support
- Performance optimizations: runs [much faster](https://twitter.com/enricoros/status/1756553038293303434?utm_source=localhost:3000&utm_medium=big-agi), saves lots of power, reduces memory usage
- Enhanced UX with auto-sizing charts, refined search and folder functionalities, perfected scaling
- And with more UI improvements, documentation, bug fixes (20 tickets), and developer enhancements
</details>
<details>
<summary>What's New in 1.13.0 · Feb 8, 2024 · Multi + Mind</summary>
https://github.com/enricoros/big-AGI/assets/32999/01732528-730e-41dc-adc7-511385686b13
- **Side-by-Side Split Windows**: multitask with parallel conversations. [#208](https://github.com/enricoros/big-AGI/issues/208)
- **Multi-Chat Mode**: message everyone, all at once. [#388](https://github.com/enricoros/big-AGI/issues/388)
- **Export tables as CSV** - big thanks to @aj47. [#392](https://github.com/enricoros/big-AGI/pull/392)
- **Adjustable Text Size**: enjoy denser chats. [#399](https://github.com/enricoros/big-AGI/issues/399)
- **Export tables as CSV**: big thanks to @aj47. [#392](https://github.com/enricoros/big-AGI/pull/392)
- Adjustable text size: customize density. [#399](https://github.com/enricoros/big-AGI/issues/399)
- Dev2 Persona Technology Preview
- Better looking chats with improved spacing, fonts, and menus
- More: new video player, [LM Studio tutorial](https://github.com/enricoros/big-AGI/blob/main/docs/config-lmstudio.md), [MongoDB support](https://github.com/enricoros/big-AGI/blob/main/docs/config-database.md) (thanks @ranfysvalle02), and speedups
- More: new video player, [LM Studio tutorial](https://github.com/enricoros/big-AGI/blob/main/docs/config-local-lmstudio.md) (thanks @aj47), [MongoDB support](https://github.com/enricoros/big-AGI/blob/main/docs/deploy-database.md) (thanks @ranfysvalle02), and speedups
### What's New in 1.12.0 · Jan 26, 2024 · AGI Hotline
</details>
<details>
<summary>What's New in 1.12.0 · Jan 26, 2024 · AGI Hotline</summary>
https://github.com/enricoros/big-AGI/assets/32999/95ceb03c-945d-4fdd-9a9f-3317beb54f3f
@@ -46,7 +103,10 @@ https://github.com/enricoros/big-AGI/assets/32999/95ceb03c-945d-4fdd-9a9f-3317be
- Paste tables from Excel [#286](https://github.com/enricoros/big-AGI/issues/286)
- Ollama model updates and context window detection fixes [#309](https://github.com/enricoros/big-AGI/issues/309)
### What's New in 1.11.0 · Jan 16, 2024 · Singularity
</details>
<details>
<summary>What's New in 1.11.0 · Jan 16, 2024 · Singularity</summary>
https://github.com/enricoros/big-AGI/assets/1590910/a6b8e172-0726-4b03-a5e5-10cfcb110c68
@@ -57,114 +117,106 @@ https://github.com/enricoros/big-AGI/assets/1590910/a6b8e172-0726-4b03-a5e5-10cf
- Enable adding up to five custom OpenAI-compatible endpoints
- Developer enhancements: new 'Actiles' framework
</details>
<details>
<summary>What's New in 1.10.0 · Jan 6, 2024 · The Year of AGI</summary>
- **New UI**: for both desktop and mobile, sets the stage for future scale. [#201](https://github.com/enricoros/big-AGI/issues/201)
- **Conversation Folders**: enhanced conversation organization. [#321](https://github.com/enricoros/big-AGI/issues/321)
- **[LM Studio](https://lmstudio.ai/)** support and improved token management
- Resizable panes in split-screen conversations.
- Large performance optimizations
- Developer enhancements: new UI framework, updated documentation for proxy settings on browserless/docker
</details>
For full details and former releases, check out the [changelog](docs/changelog.md).
## Key Features 👊
## 👉 Key Features
| ![Advanced AI](https://img.shields.io/badge/Advanced%20AI-32383e?style=for-the-badge&logo=ai&logoColor=white) | ![100+ AI Models](https://img.shields.io/badge/100%2B%20AI%20Models-32383e?style=for-the-badge&logo=ai&logoColor=white) | ![Flow-state UX](https://img.shields.io/badge/Flow--state%20UX-32383e?style=for-the-badge&logo=flow&logoColor=white) | ![Privacy First](https://img.shields.io/badge/Privacy%20First-32383e?style=for-the-badge&logo=privacy&logoColor=white) | ![Advanced Tools](https://img.shields.io/badge/Fun%20To%20Use-f22a85?style=for-the-badge&logo=tools&logoColor=white) |
|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| **Chat**<br/>**Call**<br/>**Beam**<br/>**Draw**, ... | Local & Cloud<br/>Open & Closed<br/>Cheap & Heavy<br/>Google, Mistral, ... | Attachments<br/>Diagrams<br/>Multi-Chat<br/>Mobile-first UI | Stored Locally<br/>Easy self-Host<br/>Local actions<br/>Data = Gold | AI Personas<br/>Voice Modes<br/>Screen Capture<br/>Camera + OCR |
![big-AGI screenshot](docs/pixels/big-AGI-compo-20240201_small.png)
- **AI Personas**: Tailor your AI interactions with customizable personas
- **Sleek UI/UX**: A smooth, intuitive, and mobile-responsive interface
- **Efficient Interaction**: Voice commands, OCR, and drag-and-drop file uploads
- **Multiple AI Models**: Choose from a variety of leading AI providers
- **Privacy First**: Self-host and use your own API keys for full control
- **Advanced Tools**: Execute code, import PDFs, and summarize documents
- **Seamless Integrations**: Enhance functionality with various third-party services
- **Open Roadmap**: Contribute to the progress of big-AGI
You can easily configure 100s of AI models in big-AGI:
## 💖 Support
| **AI models** | _supported vendors_ |
|:--------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Opensource Servers | [LocalAI](https://localai.com) (multimodal) · [Ollama](https://ollama.com/) · [Oobabooga](https://github.com/oobabooga/text-generation-webui) |
| 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/) |
| Image services | [Prodia](https://prodia.com/) (SDXL) |
| Speech services | [ElevenLabs](https://elevenlabs.io) (Voice synthesis / cloning) |
Add extra functionality with these integrations:
| **More** | _integrations_ |
|:-------------|:---------------------------------------------------------------------------------------------------------------|
| Web Browse | [Browserless](https://www.browserless.io/) · [Puppeteer](https://pptr.dev/)-based |
| Web Search | [Google CSE](https://programmablesearchengine.google.com/) |
| Code Editors | [CodePen](https://codepen.io/pen/) · [StackBlitz](https://stackblitz.com/) · [JSFiddle](https://jsfiddle.net/) |
| Sharing | [Paste.gg](https://paste.gg/) (Paste chats) |
| Tracking | [Helicone](https://www.helicone.ai) (LLM Observability) |
[//]: # (- [x] **Flow-state UX** for uncompromised productivity)
[//]: # (- [x] **AI Personas**: Tailor your AI interactions with customizable personas)
[//]: # (- [x] **Sleek UI/UX**: A smooth, intuitive, and mobile-responsive interface)
[//]: # (- [x] **Efficient Interaction**: Voice commands, OCR, and drag-and-drop file uploads)
[//]: # (- [x] **Privacy First**: Self-host and use your own API keys for full control)
[//]: # (- [x] **Advanced Tools**: Execute code, import PDFs, and summarize documents)
[//]: # (- [x] **Seamless Integrations**: Enhance functionality with various third-party services)
[//]: # (- [x] **Open Roadmap**: Contribute to the progress of big-AGI)
<br/>
## 🚀 Installation
To get started with big-AGI, follow our comprehensive [Installation Guide](docs/installation.md).
The guide covers various installation options, whether you're spinning it up on
your local computer, deploying on Vercel, on Cloudflare, or rolling it out
through Docker.
Whether you're a developer, system integrator, or enterprise user, you'll find step-by-step instructions
to set up big-AGI quickly and easily.
[![Installation Guide](https://img.shields.io/badge/Installation%20Guide-blue?style=for-the-badge&logo=read-the-docs&logoColor=white)](docs/installation.md)
Or bring your API keys and jump straight into our free instance on [big-AGI.com](https://big-agi.com).
<br/>
# 🌟 Get Involved!
[//]: # ([![Official Discord]&#40;https://img.shields.io/discord/1098796266906980422?label=discord&logo=discord&logoColor=%23fff&style=for-the-badge&#41;]&#40;https://discord.gg/MkH4qj2Jp9&#41;)
[![Official Discord](https://discordapp.com/api/guilds/1098796266906980422/widget.png?style=banner2)](https://discord.gg/MkH4qj2Jp9)
* Enjoy the hosted open-source app on [big-AGI.com](https://big-agi.com)
* [Chat with us](https://discord.gg/MkH4qj2Jp9)
* Deploy your [fork](https://github.com/enricoros/big-agi/fork) for your friends and family
* send PRs! ...
🎭[Editing Personas](https://github.com/enricoros/big-agi/issues/35),
🧩[Reasoning Systems](https://github.com/enricoros/big-agi/issues/36),
🌐[Community Templates](https://github.com/enricoros/big-agi/issues/35),
and [your big-IDEAs](https://github.com/enricoros/big-agi/issues/new?labels=RFC&body=Describe+the+idea)
- [ ] 📢️ [**Chat with us** on Discord](https://discord.gg/MkH4qj2Jp9)
- [ ]**Give us a star** on GitHub 👆
- [ ] 🚀 **Do you like code**? You'll love this gem of a project! [_Pick up a task!_](https://github.com/users/enricoros/projects/4/views/4) - _easy_ to _pro_
- [ ] 💡 Got a feature suggestion? [_Add your roadmap ideas_](https://github.com/enricoros/big-agi/issues/new?&template=roadmap-request.md)
- [ ] ✨ [Deploy](docs/installation.md) your [fork](docs/customizations.md) for your friends and family, or [customize it for work](docs/customizations.md)
<br/>
## 🧩 Develop
[//]: # ([![GitHub stars]&#40;https://img.shields.io/github/stars/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/stargazers&#41;)
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=&logo=typescript&logoColor=white)
![React](https://img.shields.io/badge/React-61DAFB?style=&logo=react&logoColor=black)
![Next.js](https://img.shields.io/badge/Next.js-000000?style=&logo=vercel&logoColor=white)
[//]: # ([![GitHub forks]&#40;https://img.shields.io/github/forks/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/network&#41;)
Clone this repo, install the dependencies (all locally), and run the development server (which auto-watches the
files for changes):
[//]: # ([![GitHub pull requests]&#40;https://img.shields.io/github/issues-pr/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/pulls&#41;)
```bash
git clone https://github.com/enricoros/big-agi.git
cd big-agi
npm install
npm run dev
```
[//]: # ([![License]&#40;https://img.shields.io/github/license/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/LICENSE&#41;)
The development app will be running on `http://localhost:3000`. Development builds have the advantage of not requiring
a build step, but can be slower than production builds. Also, development builds won't have timeout on edge functions.
---
## 🌐 Deploy manually
The _production_ build of the application is optimized for performance and is performed by the `npm run build` command,
after installing the required dependencies.
```bash
# .. repeat the steps above up to `npm install`, then:
npm run build
next start --port 3000
```
The app will be running on the specified port, e.g. `http://localhost:3000`.
Want to deploy with username/password? See the [Authentication](docs/deploy-authentication.md) guide.
## 🐳 Deploy with Docker
For more detailed information on deploying with Docker, please refer to the [docker deployment documentation](docs/deploy-docker.md).
Build and run:
```bash
docker build -t big-agi .
docker run -d -p 3000:3000 big-agi
```
Or run the official container:
- manually: `docker run -d -p 3000:3000 ghcr.io/enricoros/big-agi`
- or, with docker-compose: `docker-compose up` or see [the documentation](docs/deploy-docker.md) for a composer file with integrated browsing
## ☁️ Deploy on Cloudflare Pages
Please refer to the [Cloudflare deployment documentation](docs/deploy-cloudflare.md).
## 🚀 Deploy on Vercel
Create your GitHub fork, create a Vercel project over that fork, and deploy it. Or press the button below for convenience.
[![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)
## Integrations:
* Local models: Ollama, Oobabooga, LocalAi, etc.
* [ElevenLabs](https://elevenlabs.io/) Voice Synthesis (bring your own voice too) - Settings > Text To Speech
* [Helicone](https://www.helicone.ai/) LLM Observability Platform - Models > OpenAI > Advanced > API Host: 'oai.hconeai.com'
* [Paste.gg](https://paste.gg/) Paste Sharing - Chat Menu > Share via paste.gg
* [Prodia](https://prodia.com/) Image Generation - Settings > Image Generation > Api Key & Model
<br/>
This project is licensed under the MIT License.
[![GitHub stars](https://img.shields.io/github/stars/enricoros/big-agi)](https://github.com/enricoros/big-agi/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/enricoros/big-agi)](https://github.com/enricoros/big-agi/network)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/enricoros/big-agi)](https://github.com/enricoros/big-agi/pulls)
[![License](https://img.shields.io/github/license/enricoros/big-agi)](https://github.com/enricoros/big-agi/LICENSE)
[//]: # ([![GitHub issues]&#40;https://img.shields.io/github/issues/enricoros/big-agi&#41;]&#40;https://github.com/enricoros/big-agi/issues&#41;)
Made with 💙
2023-2024 · Enrico Ros x [big-AGI](https://big-agi.com) · License: [MIT](LICENSE) · Made with 💙
+1 -51
View File
@@ -1,52 +1,2 @@
import { createEmptyReadableStream, safeErrorString, serverFetchOrThrow } from '~/server/wire';
import { elevenlabsAccess, elevenlabsVoiceId, ElevenlabsWire, speechInputSchema } from '~/modules/elevenlabs/elevenlabs.router';
/* NOTE: Why does this file even exist?
This file is a workaround for a limitation in tRPC; it does not support ArrayBuffer responses,
and that would force us to use base64 encoding for the audio data, which would be a waste of
bandwidth. So instead, we use this file to make the request to ElevenLabs, and then return the
response as an ArrayBuffer. Unfortunately this means duplicating the code in the server-side
and client-side vs. the tRPC implementation. So at lease we recycle the input structures.
*/
const handler = async (req: Request) => {
try {
// construct the upstream request
const {
elevenKey, text, voiceId, nonEnglish,
streaming, streamOptimization,
} = speechInputSchema.parse(await req.json());
const path = `/v1/text-to-speech/${elevenlabsVoiceId(voiceId)}` + (streaming ? `/stream?optimize_streaming_latency=${streamOptimization || 1}` : '');
const { headers, url } = elevenlabsAccess(elevenKey, path);
const body: ElevenlabsWire.TTSRequest = {
text: text,
...(nonEnglish && { model_id: 'eleven_multilingual_v1' }),
};
// elevenlabs POST
const upstreamResponse: Response = await serverFetchOrThrow(url, 'POST', headers, body);
// NOTE: this is disabled, as we pass-through what we get upstream for speed, as it is not worthy
// to wait for the entire audio to be downloaded before we send it to the client
// if (!streaming) {
// const audioArrayBuffer = await upstreamResponse.arrayBuffer();
// return new NextResponse(audioArrayBuffer, { status: 200, headers: { 'Content-Type': 'audio/mpeg' } });
// }
// stream the data to the client
const audioReadableStream = upstreamResponse.body || createEmptyReadableStream();
return new Response(audioReadableStream, { status: 200, headers: { 'Content-Type': 'audio/mpeg' } });
} catch (error: any) {
const fetchOrVendorError = safeErrorString(error) + (error?.cause ? ' · ' + error.cause : '');
console.log(`api/elevenlabs/speech: fetch issue: ${fetchOrVendorError}`);
return new Response(`[Issue] elevenlabs: ${fetchOrVendorError}`, { status: 500 });
}
};
export const runtime = 'edge';
export { handler as POST };
export { elevenLabsHandler as POST } from '~/modules/elevenlabs/elevenlabs.server';
+1 -1
View File
@@ -11,7 +11,7 @@ const handlerEdgeRoutes = (req: Request) =>
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-edge failed on ${path ?? '<no-path>'}:`, error)
? ({ path, error }) => console.error(`❌ tRPC-edge failed on ${path ?? "<no-path>"}: ${error.message}`)
: undefined,
});
+5 -1
View File
@@ -11,9 +11,13 @@ const handlerNodeRoutes = (req: Request) =>
createContext: createTRPCFetchContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => console.error(`❌ tRPC-node failed on ${path ?? '<no-path>'}:`, error)
? ({ 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 };
+59
View File
@@ -0,0 +1,59 @@
# big-AGI Documentation
Find all the information you need to get started, configure, and effectively use big-AGI.
[//]: # (## Quick Start)
[//]: # (- **[Introduction]&#40;big-agi.md&#41;**: Overview of big-AGI's features.)
## Configuration Guides
Detailed guides to configure your big-AGI interface and models.
👉 The following applies to the users of big-AGI.com, as the public instance is empty and to be configured by the user.
- **Cloud Model Services**:
- **[Azure OpenAI](config-azure-openai.md)**
- **[OpenRouter](config-openrouter.md)**
- easy API key: **Anthropic**, **Google AI**, **Groq**, **Mistral**, **OpenAI**, **Perplexity**, **TogetherAI**
- **Local Model Servers**:
- **[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
## Deployment
System integrators, administrators, whitelabelers: instead of using the public big-AGI instance on get.big-agi.com, you can deploy your own instance.
Step-by-step deployment and system configuration instructions.
- **[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
- **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
- **[Database Setup](deploy-database.md)**: Optional, enables "Chat Link Sharing"
- **[Environment Variables](environment-variables.md)**: 📌 Pre-configures models and services
## Support and Community
Join our community or get support:
- 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.
+60 -10
View File
@@ -5,24 +5,74 @@ by release.
- For the live roadmap, please see [the GitHub project](https://github.com/users/enricoros/projects/4/views/2)
### 1.13.0 - Feb 2024
### 1.17.0 - Jun 2024
- milestone: [1.13.0](https://github.com/enricoros/big-agi/milestone/13)
- 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.13.0 · Feb 8, 2024 · Multi + Mind
### What's New in 1.16.2 · Jun 7, 2024 (minor release)
- Improve web downloads, as text, markdwon, or HTML
- Proper support for Gemini models
- Added the latest Mistral model
- Tokenizer support for gpt-4o
- Updates to Beam
### What's New in 1.16.1 · May 13, 2024 (minor release)
- Support for the new OpenAI GPT-4o 2024-05-13 model
### What's New in 1.16.0 · May 9, 2024 · Crystal Clear
- [Beam](https://big-agi.com/blog/beam-multi-model-ai-reasoning) core and UX improvements based on user feedback
- Chat cost estimation 💰 (enable it in Labs / hover the token counter)
- Save/load chat files with Ctrl+S / Ctrl+O on desktop
- Major enhancements to the Auto-Diagrams tool
- YouTube Transcriber Persona for chatting with video content, [#500](https://github.com/enricoros/big-AGI/pull/500)
- Improved formula rendering (LaTeX), and dark-mode diagrams, [#508](https://github.com/enricoros/big-AGI/issues/508), [#520](https://github.com/enricoros/big-AGI/issues/520)
- Models update: **Anthropic**, **Groq**, **Ollama**, **OpenAI**, **OpenRouter**, **Perplexity**
- Code soft-wrap, chat text selection toolbar, 3x faster on Apple silicon, and more [#517](https://github.com/enricoros/big-AGI/issues/517), [507](https://github.com/enricoros/big-AGI/pull/507)
- Developers: update the LLMs data structures
### What's New in 1.15.1 · April 10, 2024 (minor release, models support)
- Support for the newly released Gemini Pro 1.5 models
- Support for the new OpenAI 2024-04-09 Turbo models
- Resilience fixes after the large success of 1.15.0
### What's New in 1.15.0 · April 1, 2024 · Beam
- ⚠️ [**Beam**: the multi-model AI chat](https://big-agi.com/blog/beam-multi-model-ai-reasoning). find better answers, faster - a game-changer for brainstorming, decision-making, and creativity. [#443](https://github.com/enricoros/big-AGI/issues/443)
- Managed Deployments **Auto-Configuration**: simplify the UI mdoels setup with backend-set models. [#436](https://github.com/enricoros/big-AGI/issues/436)
- Message **Starring ⭐**: star important messages within chats, to attach them later. [#476](https://github.com/enricoros/big-AGI/issues/476)
- Enhanced the default Persona
- Fixes to Gemini models and SVGs, improvements to UI and icons
- Beast release, over 430 commits, 10,000+ lines changed: [release notes](https://github.com/enricoros/big-AGI/releases/tag/v1.15.0), and changes [v1.14.1...v1.15.0](https://github.com/enricoros/big-AGI/compare/v1.14.1...v1.15.0)
### What's New in 1.14.1 · March 7, 2024 · Modelmorphic
- **Anthropic** [Claude-3](https://www.anthropic.com/news/claude-3-family) model family support. [#443](https://github.com/enricoros/big-AGI/issues/443)
- New **[Perplexity](https://www.perplexity.ai/)** and **[Groq](https://groq.com/)** integration (thanks @Penagwin). [#407](https://github.com/enricoros/big-AGI/issues/407), [#427](https://github.com/enricoros/big-AGI/issues/427)
- **[LocalAI](https://localai.io/models/)** deep integration, including support for [model galleries](https://github.com/enricoros/big-AGI/issues/411)
- **Mistral** Large and Google **Gemini 1.5** support
- Performance optimizations: runs [much faster](https://twitter.com/enricoros/status/1756553038293303434?utm_source=localhost:3000&utm_medium=big-agi), saves lots of power, reduces memory usage
- Enhanced UX with auto-sizing charts, refined search and folder functionalities, perfected scaling
- And with more UI improvements, documentation, bug fixes (20 tickets), and developer enhancements
- [Release notes](https://github.com/enricoros/big-AGI/releases/tag/v1.14.0), and changes [v1.13.1...v1.14.0](https://github.com/enricoros/big-AGI/compare/v1.13.1...v1.14.0) (233 commits, 8,000+ lines changed)
### What's New in 1.13.0 · Feb 8, 2024 · Multi + Mind
https://github.com/enricoros/big-AGI/assets/32999/01732528-730e-41dc-adc7-511385686b13
- **Side-by-Side Split Windows**: multitask with parallel conversations. [#208](https://github.com/enricoros/big-AGI/issues/208)
- **Multi-Chat Mode**: message everyone, all at once. [#388](https://github.com/enricoros/big-AGI/issues/388)
- **Export tables as CSV** - big thanks to @aj47. [#392](https://github.com/enricoros/big-AGI/pull/392)
- **Adjustable Text Size**: enjoy denser chats. [#399](https://github.com/enricoros/big-AGI/issues/399)
- **Export tables as CSV**: big thanks to @aj47. [#392](https://github.com/enricoros/big-AGI/pull/392)
- Adjustable text size: customize density. [#399](https://github.com/enricoros/big-AGI/issues/399)
- Dev2 Persona Technology Preview
- Better looking chats with improved spacing, fonts, and menus
- More: new video player, [LM Studio tutorial](https://github.com/enricoros/big-AGI/blob/main/docs/config-lmstudio.md), [MongoDB support](https://github.com/enricoros/big-AGI/blob/main/docs/config-database.md) (thanks @ranfysvalle02), and speedups
- More: new video player, [LM Studio tutorial](https://github.com/enricoros/big-AGI/blob/main/docs/config-local-lmstudio.md) (thanks @aj47), [MongoDB support](https://github.com/enricoros/big-AGI/blob/main/docs/deploy-database.md) (thanks @ranfysvalle02), and speedups
## What's New in 1.12.0 · Jan 26, 2024 · AGI Hotline
### What's New in 1.12.0 · Jan 26, 2024 · AGI Hotline
https://github.com/enricoros/big-AGI/assets/32999/95ceb03c-945d-4fdd-9a9f-3317beb54f3f
@@ -81,7 +131,7 @@ https://github.com/enricoros/big-AGI/assets/1590910/a6b8e172-0726-4b03-a5e5-10cf
- **Attachments System Overhaul**: Drag, paste, link, snap, text, images, PDFs and more. [#251](https://github.com/enricoros/big-agi/issues/251)
- **Desktop Webcam Capture**: Image capture now available as Labs feature. [#253](https://github.com/enricoros/big-agi/issues/253)
- **Independent Browsing**: Full browsing support with Browserless. [Learn More](https://github.com/enricoros/big-agi/blob/main/docs/config-browse.md)
- **Independent Browsing**: Full browsing support with Browserless. [Learn More](https://github.com/enricoros/big-agi/blob/main/docs/config-feature-browse.md)
- **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
@@ -90,7 +140,7 @@ https://github.com/enricoros/big-AGI/assets/1590910/a6b8e172-0726-4b03-a5e5-10cf
### What's New in 1.6.0 - Nov 28, 2023 · Surf's Up
- **Web Browsing**: Download web pages within chats - [browsing guide](https://github.com/enricoros/big-agi/blob/main/docs/config-browse.md)
- **Web Browsing**: Download web pages within chats - [browsing guide](https://github.com/enricoros/big-agi/blob/main/docs/config-feature-browse.md)
- **Branching Discussions**: Create new conversations from any message
- **Keyboard Navigation**: Swift chat navigation with new shortcuts (e.g. ctrl+alt+left/right)
- **Performance Boost**: Faster rendering for a smoother experience
@@ -164,7 +214,7 @@ For Developers:
- **[Install Mobile APP](../docs/pixels/feature_pwa.png)** 📲 looks like native (@harlanlewis)
- **[UI language](../docs/pixels/feature_language.png)** with auto-detect, and future app language! (@tbodyston)
- **PDF Summarization** 🧩🤯 - ask questions to a PDF! (@fredliubojin)
- **Code Execution: [Codepen](https://codepen.io/)/[Replit](https://replit.com/)** 💻 (@harlanlewis)
- **Code Execution: [Codepen](https://codepen.io/)** 💻 (@harlanlewis)
- **[SVG Drawing](../docs/pixels/feature_svg_drawing.png)** - draw with AI 🎨
- Chats: multiple chats, AI titles, Import/Export, Selection mode
- Rendering: Markdown, SVG, improved Code blocks
+3
View File
@@ -20,6 +20,9 @@ If you have an `API Endpoint` and `API Key`, you can configure big-AGI as follow
The deployed models are now available in the application. If you don't have a configured
Azure OpenAI service instance, continue with the next section.
In addition to using the UI, configuration can also be done using
[environment variables](environment-variables.md).
## Setting Up Azure
### Step 1: Azure Account & Subscription
@@ -3,11 +3,16 @@
Allows users to load web pages across various components of `big-AGI`. This feature is supported by Puppeteer-based
browsing services, which are the most common way to render web pages in a headless environment.
Once configured, the Browsing service provides this functionality:
Once configured, the Browsing service provides the following functionality:
- **Paste a URL**: Simply paste/drag a URL into the chat, and `big-AGI` will load and attach the page (very effective)
- **Use /browse**: Type `/browse [URL]` in the chat to command `big-AGI` to load the specified web page
- **ReAct**: ReAct will automatically use the `loadURL()` function whenever a URL is encountered
- **Paste a URL**: Simply paste/drag a URL into the chat, and `big-AGI` will load and attach the page (very effective)
- **Use /browse**: Type `/browse [URL]` in the chat to command `big-AGI` to load the specified web page
- **ReAct**: ReAct will automatically use the `loadURL()` function whenever a URL is encountered
It does not yet support the following functionality:
- ✖️ **Auto-browsing by LLMs**: if an LLM encounters a URL, it will NOT load the page and will likely respond
that it cannot browse the web - No technical limitation, just haven't gotten to implement this yet outside of `/react` yet
First of all, you need to procure a Puppteer web browsing service endpoint. `big-AGI` supports services like:
@@ -63,7 +68,7 @@ The chat agent won't be able to access the web sites if the browserless containe
- MAX_CONCURRENT_SESSIONS=10
```
You can then add the proyy lines to your `.env` file.
You can then add the proxy lines to your `.env` file.
```
https_proxy=http://PROXY-IP:PROXY-PORT
@@ -109,3 +114,5 @@ If you encounter any issues or have questions about configuring the browse funct
---
Enjoy the enhanced browsing experience within `big-AGI` and explore the web without ever leaving your chat!
Last updated on Feb 27, 2024 ([edit on GitHub](https://github.com/enricoros/big-AGI/edit/main/docs/config-feature-browse.md))
@@ -37,6 +37,9 @@ Check the URL and modify if different.
2. Enter the API URL: `http://localhost:1234` (modify if different)
3. Refresh by clicking on the `Models` button to load models from LM Studio
In addition to using the UI, configuration can also be done using
[environment variables](environment-variables.md).
## Troubleshooting
- **Missing @mui/material**: Execute `npm install @mui/material` or `yarn add @mui/material`
+52 -22
View File
@@ -1,34 +1,64 @@
# Local LLM integration with `localai`
# Run your models with `LocalAI` x `big-AGI`
Integrate local Large Language Models (LLMs) with [LocalAI](https://localai.io).
[LocalAI](https://localai.io) lets you run your AI models locally, or in the cloud. It supports text, image, asr, speech, and more models.
_Last updated Nov 7, 2023_
We are deepening the integration between the two products. As of the time of writing, we integrate the following features:
## Instructions
- ✅ [Text generation](https://localai.io/features/text-generation/) with GPTs
- ✅ [Function calling](https://localai.io/features/openai-functions/) by GPTs 🆕
- ✅ [Model Gallery](https://localai.io/models/) to list and install models
- ✖️ [Vision API](https://localai.io/features/gpt-vision/) for image chats
- ✖️ [Image generation](https://localai.io/features/image-generation) with stable diffusion
- ✖️ [Audio to Text](https://localai.io/features/audio-to-text/)
- ✖️ [Text to Audio](https://localai.io/features/text-to-audio/)
- ✖️ [Embeddings generation](https://localai.io/features/embeddings/)
- ✖️ [Constrained grammars](https://localai.io/features/constrained_grammars/) (JSON output)
- ✖️ Voice cloning 🆕
_Last updated Feb 21, 2024_
## Guide
### LocalAI installation and configuration
Follow the guide at: https://localai.io/basics/getting_started/
For instance with [Use luna-ai-llama2 with docker compose](https://localai.io/basics/getting_started/#example-use-luna-ai-llama2-model-with-docker-compose):
- verify it works by browsing to [http://localhost:8080/v1/models](http://localhost:8080/v1/models)
(or the IP:Port of the machine, if running remotely) and seeing listed the model(s) you downloaded
listed in the JSON response.
- clone LocalAI
- get the model
- copy the prompt template
- start docker
- -> the server will be listening on `localhost:8080`
- verify it works by going to [http://localhost:8080/v1/models](http://localhost:8080/v1/models) on
your browser and seeing listed the model you downloaded
### Integrating LocalAI with big-AGI
### Integration: chat with LocalAI
- Go to Models > Add a model source of type: **LocalAI**
- Enter the address: `http://localhost:8080` (default)
- If running remotely, replace localhost with the IP of the machine. Make sure to use the **IP:Port** format
- Load the models
- Select model & Chat
- Enter the default address: `http://localhost:8080`, or the address of your localAI cloud instance
![configure models](pixels/config-localai-1-models.png)
- If running remotely, replace localhost with the IP of the machine. Make sure to use the **IP:Port** format
- Load the models (click on `Models 🔄`)
- Select the model and chat
> NOTE: LocalAI does not list details about the mdoels. 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)
> file with the mapping information between LocalAI model IDs and names/descriptions/tokens, etc.
In addition to using the UI, configuration can also be done using
[environment variables](environment-variables.md).
### Integration: Models Gallery
If the running LocalAI instance is configured with a [Model Gallery](https://localai.io/models/):
- Go to Models > LocalAI
- Click on `Gallery Admin`
- Select the models to install, and view installation progress
![img.png](pixels/config-localai-2-gallery.png)
## Troubleshooting
##### Unknown Context Window Size
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)
file with the mapping information between LocalAI model IDs and names/descriptions/tokens, etc.
# 🤝 Support
- Hop into the [LocalAI Discord](https://discord.gg/uJAeKSAGDy) for support and questions
- Hop into the [big-AGI Discord](https://discord.gg/MkH4qj2Jp9) for questions
- For big-AGI support, please open an issue in our [big-AGI issue tracker](https://bit.ly/agi-request)
@@ -13,7 +13,7 @@ _Last updated Dec 16, 2023_
1. **Ensure Ollama API Server is Running**: Follow the official instructions to get Ollama up and running on your machine
- For detailed instructions on setting up the Ollama API server, please refer to the
[Ollama download page](https://ollama.ai/download) and [instructions for linux](https://github.com/jmorganca/ollama/blob/main/docs/linux.md).
[Ollama download page](https://ollama.ai/download) and [instructions for linux](https://github.com/jmorganca/ollama/blob/main/docs/linux.md).
2. **Add Ollama as a Model Source**: In `big-AGI`, navigate to the **Models** section, select **Add a model source**, and choose **Ollama**
3. **Enter Ollama Host URL**: Provide the Ollama Host URL where the API server is accessible (e.g., `http://localhost:11434`)
4. **Refresh Model List**: Once connected, refresh the list of available models to include the Ollama models
@@ -22,6 +22,9 @@ _Last updated Dec 16, 2023_
you'll have to press the 'Pull' button again, until a green message appears.
5. **Chat with Ollama models**: select an Ollama model and begin chatting with AI personas
In addition to using the UI, configuration can also be done using
[environment variables](environment-variables.md).
**Visual Configuration Guide**:
* After adding the `Ollama` model vendor, entering the IP address of an Ollama server, and refreshing models:<br/>
@@ -37,7 +40,7 @@ _Last updated Dec 16, 2023_
### ⚠️ Network Troubleshooting
If you get errors about the server having trouble connecting with Ollama, please see
If you get errors about the server having trouble connecting with Ollama, please see
[this message](https://github.com/enricoros/big-AGI/issues/276#issuecomment-1858591483) on Issue #276.
And in brief, make sure the Ollama endpoint is accessible from the servers where you run big-AGI (which could
@@ -69,15 +72,19 @@ Then, edit the nginx configuration file `/etc/nginx/sites-enabled/default` and a
```nginx
location /ollama/ {
proxy_pass http://localhost:11434;
proxy_pass http://127.0.0.1:11434/;
# Disable buffering for the streaming responses (SSE)
proxy_set_header Connection '';
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;
# Disable buffering for the streaming responses
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
# Longer timeouts
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
}
```
+4 -4
View File
@@ -25,15 +25,15 @@ This guide assumes that **big-AGI** is already installed on your system. Note th
- 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
- Make sure that `--listen --api` is present and uncommented
3. Restart text-generation-webui
- Double-click on "start"
- You should see something like:
- 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
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
+3
View File
@@ -22,6 +22,9 @@ This document details the process of integrating OpenRouter with big-AGI.
![feature-openrouter-configure.png](pixels/feature-openrouter-configure.png)
4. OpenAI GPT4-32k and other models will now be accessible and selectable in the application.
In addition to using the UI, configuration can also be done using
[environment variables](environment-variables.md).
### Pricing
OpenRouter independently manages its service and pricing and is not affiliated with big-AGI.
+90
View File
@@ -0,0 +1,90 @@
# Customizing and Creating Derivative Applications
This document outlines how to develop applications derived from big-AGI.
## Manual Customization
Application customization _requires manual code modifications or the use of environment variables_. Currently, **there is no admin panel to "managed" deployment customization** for enterprise use cases.
| Required Code Alteration | Not Required |
|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| - Persona changes<br>- UI theme customization<br>- Feature additions or modifications | - Setting API keys in [environment variables](environment-variables.md)<br>- Toggling features with environment variables |
| Apply these to the source code before building the application | Set these post-build on local machines or cloud deployment, before application launch |
<br/>
## Code Alterations
Start by creating a fork of the [big-AGI repository](https://github.com/enricoros/big-AGI) on GitHub for a personal development space.
Understand the Architecture: big-AGI uses Next.js, React for the front end, and Node.js (Next.js edge functions) for the back end.
### Add Authentication
This necessitates a code change (file renaming) before build initiation, detailed in [deploy-authentication.md](deploy-authentication.md).
### Increase Vercel Functions Timeout
For long-running operations, Vercel allows paid deployments to increase the timeout on Functions.
Note that this applies to old-style Vercel Functions (based on Node.js) and not the new Edge Functions.
At time of writing, big-AGI has only 2 operations that run on Node.js Functions:
browsing (fetching web pages) and sharing. They both can exceed 10 seconds, especially
when fetching large pages or waiting for websites to be completed.
We provide `vercel_PRODUCTION.json` to raise the duration to 25 seconds (from a default of 10), to use it,
make sure to rename it to `vercel.json` before build.
From the Vercel Project > Settings > General > Build & Development Settings,
you can for instance set the build command to:
```bash
mv vercel_PRODUCTION.json vercel.json; next build
```
### Change the Personas
Edit the `src/data.ts` file to customize personas. This file houses the default personas. You can add, remove, or modify these to meet your project's needs.
- [ ] Modify `src/data.ts` to alter default personas
### Change the UI
Adapt the UI to match your project's aesthetic, incorporate new features, or exclude unnecessary ones.
- [ ] Adjust `src/common/app.theme.ts` for theme changes: colors, spacing, button appearance, animations, etc
- [ ] Modify `src/common/app.config.tsx` to alter the application's name
- [ ] Update `src/common/app.nav.tsx` to revise the navigation bar
## Testing & Deployment
Test your application thoroughly using local development (refer to README.md for local build instructions). Deploy using your preferred hosting service. big-AGI supports deployment on platforms like Vercel, Docker, or any Node.js-compatible service, especially those supporting NextJS's "Edge Runtime."
- [deploy-cloudflare.md](deploy-cloudflare.md): for Cloudflare Workers deployment
- [deploy-docker.md](deploy-docker.md): for Docker deployment instructions and examples
## Debugging
We introduced the `/info/debug` page that provides a detailed overview of the application's environment, including the API keys, environment variables, and other configuration settings.
<br/>
## Community Projects - Share Your Project
After deployment, share your project with the community. We will link to your project to help others discover and learn from your work.
| Project | Features | GitHub |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| 🚀 CoolAGI: Where AI meets Imagination<br/>![CoolAGI Logo](https://github.com/nextgen-user/freegpt4plus/assets/150797204/9b0e1232-4791-4d61-b949-16f9eb284c22) | Code Interpreter, Vision, Mind maps, Web Searches, Advanced Data Analytics, Large Data Handling and more! | [nextgen-user/CoolAGI](https://github.com/nextgen-user/CoolAGI) |
| HL-GPT | Fully remodeled UI | [harlanlewis/nextjs-chatgpt-app](https://github.com/harlanlewis/nextjs-chatgpt-app) |
For public projects, update your README.md with your modifications and submit a pull request to add your project to our list, aiding in its discovery.
<br/>
## Best Practices
- **Stay Updated**: Frequently merge updates from the main big-AGI repository to incorporate bug fixes and new features.
- **Keep It Open Source**: Consider maintaining your derivative as open source to foster community contributions.
- **Engage with the Community**: Leverage platforms like GitHub, Discord, or Reddit for feedback, collaboration, and project promotion.
Developing a derivative application is an opportunity to explore new possibilities with AI and share your innovations with the global community. We look forward to seeing your contributions.
+63
View File
@@ -0,0 +1,63 @@
# big-AGI Analytics
The open-source big-AGI project provides support for the following analytics services:
- **Vercel Analytics**: automatic when deployed to Vercel
- **Google Analytics 4**: manual setup required
The following is a quick overview of the Analytics options for the deployers of this open-source project.
big-AGI is deployed to many large-scale and enterprise though various ways (custom builds, Docker, Vercel, Cloudflare, etc.),
and this guide is for its customization.
## Service Configuration
### Vercel Analytics
- Why: understand coarse traction, and identify deployment issues - all without tracking individual users
- What: top pages, top referrers, country of origin, operating system, browser, and page speed metrics
Vercel Analytics and Speed Insights are local API endpoints deployed to your domain, so everything stays within your
domain. Furthermore, the Vercel Analytics service is privacy-friendly, and does not track individual users.
This service is avaialble to system administrators when deploying to Vercel. It is automatically enabled when deploying to Vercel.
The code that activates Vercel Analytics is located in the `src/pages/_app.tsx` file:
```tsx
const MyApp = ({ Component, emotionCache, pageProps }: MyAppProps) => <>
...
{isVercelFromFrontend && <VercelAnalytics debug={false} />}
{isVercelFromFrontend && <VercelSpeedInsights debug={false} sampleRate={1 / 2} />}
...
</>;
```
When big-AGI is served on Vercel hosts, the ```process.env.NEXT_PUBLIC_VERCEL_URL``` environment variable is trueish, and
analytics will be sent by default to the Vercel Analytics service which is deployed by Vercel IF configured from the
Vercel project dashboard.
In summary: to turn it on: activate the `Analytics` service in the Vercel project dashboard.
### Google Analytics 4
- Why: user engagement and retention, performance insights, personalization, content optimization
- What: https://support.google.com/analytics/answer/11593727
Google Analytics 4 (GA4) is a powerful tool for understanding user behavior and engagement.
This can help optimize big-AGI, understanding which features are needed/users and which aren't.
To enable Google Analytics 4, you need to set the `NEXT_PUBLIC_GA4_MEASUREMENT_ID` environment variable
before starting the local build or the docker build (i.e. at build time), at which point the
server/container will be able to report analytics to your Google Analytics 4 property.
As of Feb 27, 2024, this feature is in development.
## Configurations
| Scope | Default | Description / Instructions |
|-----------------------------------------------------------------------------------------|------------------|-------------------------------------------------------------------------------------------------------------------------|
| Your source builds of big-AGI | None | **Vercel**: enable Vercel Analytics from the dashboard. · **Google Analytics**: set environment variable at build time. |
| Your docker builds of big-AGI | None | **Vercel**: n/a. · **Google Analytics**: set environment variable at `docker build` time. |
| [big-agi.com](https://big-agi.com) | Vercel + Google | The main website ([privacy policy](https://big-agi.com/privacy)) hosted for free for anyone. |
| [official Docker packages](https://github.com/enricoros/big-AGI/pkgs/container/big-agi) | Google Analytics | **Vercel**: n/a · **Google Analytics**: set to the big-agi.com Google Analytics for analytics and improvements. |
Note: this information is updated as of Feb 27, 2024 and can change at any time.
@@ -9,31 +9,33 @@ This guide outlines the database options and setup steps for enabling features l
- Available on Vercel, Neon, and other platforms.
- Less feature-rich but a suitable option depending on your needs.
- **Connection String:** Replace placeholders with your Postgres credentials.
- `postgres://USER:PASS@SOMEHOST.postgres.vercel-storage.com/SOMEDB?pgbouncer=true&connect_timeout=15`
- `postgres://USER:PASS@SOMEHOST.postgres.vercel-storage.com/SOMEDB?pgbouncer=true&connect_timeout=15`
**2. MongoDB Atlas (alternative):**
- **Highly Recommended:** More than a database, it's a data platform. MongoDB Atlas is a robust cloud-based platform that offers scalability, security, and a suite of developer tools. No need for a separate vector database, you can query your vector embeddings right within your operational database!
- **Additional Features:** MongoDB Atlas is packed with unique features designed to streamline the development process such as: Atlas App Services, Atlas search (with vector search), Atlas charts, Data Federation, and more.
- **Highly Recommended:** More than a database, it's a data platform. MongoDB Atlas is a robust cloud-based platform that offers scalability, security, and a suite of developer tools. No need for a separate vector database, you can query your vector embeddings right within your operational database!
- **Additional Features:** MongoDB Atlas is packed with unique features designed to streamline the development process such as: Atlas App Services, Atlas search (with vector search), Atlas charts, Data Federation, and more.
- **Connection String:** Replace placeholders with your Atlas credentials.
- `mongodb://USER:PASS@CLUSTER-NAME.mongodb.net/DATABASE-NAME?retryWrites=true&w=majority`
- `mongodb://USER:PASS@CLUSTER-NAME.mongodb.net/DATABASE-NAME?retryWrites=true&w=majority`
### Environment Variables:
#### Postgres:
| Variable | |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `POSTGRES_PRISMA_URL` | `postgres://USER:PASS@SOMEHOST.postgres.vercel-storage.com/SOMEDB?pgbouncer=true&connect_timeout=15` |
| `POSTGRES_URL_NON_POOLING` (optional) | URL for the Postgres database without pooling (specific use cases) |
| Variable | |
|---------------------------------------|------------------------------------------------------------------------------------------------------|
| `POSTGRES_PRISMA_URL` | `postgres://USER:PASS@SOMEHOST.postgres.vercel-storage.com/SOMEDB?pgbouncer=true&connect_timeout=15` |
| `POSTGRES_URL_NON_POOLING` (optional) | URL for the Postgres database without pooling (specific use cases) |
#### MongoDB:
| Variable | |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `MDB_URI` | `mongodb://USER:PASS@CLUSTER-NAME.mongodb.net/DATABASE-NAME?retryWrites=true&w=majority` |
| Variable | |
|-----------|------------------------------------------------------------------------------------------|
| `MDB_URI` | `mongodb://USER:PASS@CLUSTER-NAME.mongodb.net/DATABASE-NAME?retryWrites=true&w=majority` |
### MongoDB Atlas + Prisma
When using MongoDB Atlas, you'll need to make the below changes to the file `prisma.schema`
When using MongoDB Atlas, you'll need to make the below changes to the file [`src/server/prisma/schema.prisma`](../src/server/prisma/schema.prisma).
```
...
@@ -53,8 +55,7 @@ model LinkStorage {
### Initial Setup Steps:
1. **Run `npx prisma db:push`:** Create or update the database schema (run once after connecting).
1. **Run `npx prisma db push`:** Create or update the database schema (run once after connecting).
### Additional Resources:
+2 -2
View File
@@ -9,7 +9,7 @@ Docker ensures faster development cycles, easier collaboration, and seamless env
```bash
git clone https://github.com/enricoros/big-agi.git
cd big-agi
```
```
2. **Build the Docker Image**: Build a local docker image from the provided Dockerfile:
```bash
docker build -t big-agi .
@@ -50,7 +50,7 @@ docker-compose up -d
### Make Local Services Visible to Docker 🌐
To make local services running on your host machine accessible to a Docker container, such as a
[Browseless](./config-browse.md) service or a local API, you can follow this simplified guide:
[Browseless](./config-feature-browse.md) service or a local API, you can follow this simplified guide:
| Operating System | Steps to Make Local Services Visible to Docker |
|:------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+14
View File
@@ -0,0 +1,14 @@
# Why big-AGI?
Placeholder for a document that demonstrates the productivity and unique features of Big-AGI.
## Exclusive features
- [x] Call AGI
- [x] Continuous Voice mode
- [x] Diagram generation
- [ ] ...
## Productivity Features
- [x] Multi-window to never wait
- [x] Multi-Chat to explore different solutions
- [x] Rendering of graphs, charts, mindmaps
- [ ] ...
+40 -10
View File
@@ -28,9 +28,13 @@ AZURE_OPENAI_API_KEY=
ANTHROPIC_API_KEY=
ANTHROPIC_API_HOST=
GEMINI_API_KEY=
GROQ_API_KEY=
LOCALAI_API_HOST=
LOCALAI_API_KEY=
MISTRAL_API_KEY=
OLLAMA_API_HOST=
OPENROUTER_API_KEY=
PERPLEXITY_API_KEY=
TOGETHERAI_API_KEY=
# Model Observability: Helicone
@@ -54,15 +58,22 @@ BACKEND_ANALYTICS=
# 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=
```
## Variables Documentation
## Backend Variables
These variables are used only by the server-side code, at runtime. Define them before running the nextjs local server (in development or
cloud deployment), or pass them to Docker (--env-file or -e) when starting the container.
### Database
For Database configuration see [config-database.md](config-database.md).
To enable Chat Link Sharing, you need to connect the backend to a database. We currently support Postgres and MongoDB.
To enable features such as Chat Link Sharing, you need to connect the backend to a database. We currently support Postgres and MongoDB.
For Database configuration see [deploy-database.md](deploy-database.md).
### LLMs
@@ -79,12 +90,16 @@ requiring the user to enter an API key
| `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-ollama.md](config-ollama.md) | |
| `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 |
### Model Observability: Helicone
### LLM Observability: Helicone
Helicone provides observability to your LLM calls. It is a paid service, with a generous free tier.
It is currently supported for:
@@ -96,7 +111,7 @@ It is currently supported for:
|--------------------|--------------------------|
| `HELICONE_API_KEY` | The API key for Helicone |
### Specials
### Features
Enable the app to Talk, Draw, and Google things up.
@@ -106,16 +121,31 @@ Enable the app to Talk, Draw, and Google things up.
| `ELEVENLABS_API_KEY` | ElevenLabs API Key - used for calls, etc. |
| `ELEVENLABS_API_HOST` | Custom host for ElevenLabs |
| `ELEVENLABS_VOICE_ID` | Default voice ID for ElevenLabs |
| **Text-To-Image** | [Prodia](https://prodia.com/) is a reliable image generation service |
| `PRODIA_API_KEY` | Prodia API Key - used with '/imagine ...' |
| **Google Custom Search** | [Google Programmable Search Engine](https://programmablesearchengine.google.com/about/) produces links to pages |
| `GOOGLE_CLOUD_API_KEY` | Google Cloud API Key, used with the '/react' command - [Link to GCP](https://console.cloud.google.com/apis/credentials) |
| `GOOGLE_CSE_ID` | Google Custom/Programmable Search Engine ID - [Link to PSE](https://programmablesearchengine.google.com/) |
| **Text-To-Image** | [Prodia](https://prodia.com/) is a reliable image generation service |
| `PRODIA_API_KEY` | Prodia API Key - used with '/imagine ...' |
| **Browse** | |
| `PUPPETEER_WSS_ENDPOINT` | Puppeteer WebSocket endpoint - used for browsing, etc. |
| **Backend** | |
| `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. |
### Frontend Variables
The value of these variables are passed to the frontend (Web UI) - make sure they do not contain secrets.
| Variable | Description |
|:----------------------------------|:-----------------------------------------------------------------------------------------|
| `NEXT_PUBLIC_GA4_MEASUREMENT_ID` | The measurement ID for Google Analytics 4. (see [deploy-analytics](deploy-analytics.md)) |
| `NEXT_PUBLIC_PLANTUML_SERVER_URL` | The URL of the PlantUML server, used for rendering UML diagrams. (code in RederCode.tsx) |
> Important: these variables must be set at build time, which is required by Next.js to pass them to the frontend.
> This is in contrast to the backend variables, which can be set when starting the local server/container.
---
For a higher level overview of backend code and environment customization,
see the [big-AGI Customization](customizations.md) guide.
+119
View File
@@ -0,0 +1,119 @@
# Installation Guide
Welcome to the big-AGI Installation Guide - Whether you're a developer
eager to explore, a system integrator, or an enterprise looking for a
white-label solution, this comprehensive guide ensures a smooth setup
process for your own instance of big-AGI and related products.
**Try big-AGI** - You don't need to install anything if you want to play with big-AGI
and have your API keys to various model services. You can access our free instance on [big-AGI.com](https://big-agi.com).
The free instance runs the latest `main-stable` branch from this repository.
## 🧩 Build-your-own
If you want to change the code, have a deeper configuration,
add your own models, or run your own instance, follow the steps below.
### Local Development
**Prerequisites:**
- Node.js and npm installed on your machine.
**Steps:**
1. Clone the big-AGI repository:
```bash
git clone https://github.com/enricoros/big-AGI.git
cd big-AGI
```
2. Install dependencies:
```bash
npm install
```
3. Run the development server:
```bash
npm run dev
```
Your big-AGI instance is now running at `http://localhost:3000`.
### Local Production build
The production build is optimized for performance and follows
the same steps 1 and 2 as for [local development](#local-development).
3. Build the production version:
```bash
# .. repeat the steps above up to `npm install`, then:
npm run build
```
4. Start the production server (`npx` may be optional):
```bash
npx next start --port 3000
```
Your big-AGI production instance is on `http://localhost:3000`.
### Advanced Customization
Want to pre-enable models, customize the interface, or deploy with username/password or alter code to your needs?
Check out the [Customizations Guide](README.md) for detailed instructions.
## ☁️ Cloud Deployment Options
To deploy big-AGI on a public server, you have several options. Choose the one that best fits your needs.
### Deploy on Vercel
Install big-AGI on Vercel with just a few clicks.
Create your GitHub fork, create a Vercel project over that fork, and deploy it. Or press the button below for convenience.
[![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)
### Deploy on Cloudflare
Deploy on Cloudflare's global network by installing big-AGI on
Cloudflare Pages. Check out the [Cloudflare Installation Guide](deploy-cloudflare.md)
for step-by-step instructions.
### Docker Deployments
Containerize your big-AGI installation using Docker for portability and scalability.
Our [Docker Deployment Guide](deploy-docker.md) will walk you through the process,
or follow the steps below for a quick start.
1. (optional) Build the Docker image - if you do not want to use the [pre-built Docker images](https://github.com/enricoros/big-AGI/pkgs/container/big-agi):
```bash
docker build -t big-agi .
```
2. Run the Docker container with either:
```bash
# 2A. if you built the image yourself:
docker run -d -p 3000:3000 big-agi
# 2B. or use the pre-built image:
docker run -d -p 3000:3000 ghcr.io/enricoros/big-agi
# 2C. or use docker-compose:
docker-compose up
```
Access your big-AGI instance at `http://localhost:3000`.
### Midori AI Subsystem for Docker Deployment
Follow the instructions found on [Midori AI Subsystem Site](https://io.midori-ai.xyz/subsystem/manager/)
for your host OS. After completing the setup process, install the Big-AGI docker backend to the Midori AI Subsystem.
## Enterprise-Grade Installation
For businesses seeking a fully-managed, scalable solution, consider our managed installations.
Enjoy all the features of big-AGI without the hassle of infrastructure management. [hello@big-agi.com](mailto:hello@big-agi.com) to learn more.
## Support
Join our vibrant community of developers, researchers, and AI enthusiasts. Share your projects, get help, and collaborate with others.
- [Discord Community](https://discord.gg/MkH4qj2Jp9)
- [Twitter](https://twitter.com/yourusername)
For any questions or inquiries, please don't hesitate to [reach out to our team](mailto:hello@big-agi.com).
Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

+30 -6
View File
@@ -1,13 +1,26 @@
// 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`);
/** @type {import('next').NextConfig} */
let nextConfig = {
reactStrictMode: true,
// Note: disabled to chech whether the project becomes slower with this
// modularizeImports: {
// '@mui/icons-material': {
// transform: '@mui/icons-material/{{member}}',
// },
// },
// [exports] https://nextjs.org/docs/advanced-features/static-html-export
...buildType && {
output: buildType,
distDir: 'dist',
// disable image optimization for exports
images: { unoptimized: true },
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
},
// [puppeteer] https://github.com/puppeteer/puppeteer/issues/11052
experimental: {
@@ -24,9 +37,20 @@ let nextConfig = {
layers: 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)
config.optimization.splitChunks.minSize = 40 * 1024;
return config;
},
// Note: disabled to check whether the project becomes slower with this
// modularizeImports: {
// '@mui/icons-material': {
// transform: '@mui/icons-material/{{member}}',
// },
// },
// Uncomment the following leave console messages in production
// compiler: {
// removeConsole: false,
+2042 -821
View File
File diff suppressed because it is too large Load Diff
+43 -30
View File
@@ -1,7 +1,9 @@
{
"name": "big-agi",
"version": "1.13.0",
"version": "1.16.0",
"private": true,
"author": "Enrico Ros <enrico.ros@gmail.com>",
"repository": "https://github.com/enricoros/big-agi",
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -12,67 +14,78 @@
"db:studio": "prisma studio",
"vercel:env:pull": "npx vercel env pull .env.development.local"
},
"prisma": {
"schema": "src/server/prisma/schema.prisma"
},
"dependencies": {
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.3",
"@emotion/react": "^11.11.4",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.8",
"@mui/joy": "5.0.0-beta.25",
"@next/bundle-analyzer": "^14.1.0",
"@prisma/client": "^5.9.1",
"@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.8.0",
"@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.1.3",
"@vercel/speed-insights": "^1.0.9",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.10",
"browser-fs-access": "^0.35.0",
"eventsource-parser": "^1.1.1",
"cheerio": "^1.0.0-rc.12",
"eventsource-parser": "^1.1.2",
"idb-keyval": "^6.2.1",
"next": "^14.1.0",
"next": "~14.1.4",
"nprogress": "^0.2.0",
"pdfjs-dist": "4.0.379",
"pdfjs-dist": "4.2.67",
"plantuml-encoder": "^1.4.0",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-csv": "^2.2.2",
"react-dom": "^18.2.0",
"react-dom": "^18.3.1",
"react-katex": "^3.0.1",
"react-markdown": "^9.0.1",
"react-player": "^2.14.1",
"react-resizable-panels": "^2.0.3",
"react-player": "^2.16.0",
"react-resizable-panels": "^2.0.19",
"react-timeago": "^7.2.0",
"rehype-katex": "^7.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"sharp": "^0.33.3",
"superjson": "^2.2.1",
"tesseract.js": "^5.0.4",
"tiktoken": "^1.0.13",
"tesseract.js": "^5.1.0",
"tiktoken": "^1.0.15",
"turndown": "^7.2.0",
"uuid": "^9.0.1",
"zod": "^3.22.4",
"zustand": "^4.5.0"
"zod": "^3.23.8",
"zustand": "^4.5.2"
},
"devDependencies": {
"@cloudflare/puppeteer": "^0.0.5",
"@types/node": "^20.11.16",
"@cloudflare/puppeteer": "0.0.5",
"@types/node": "^20.12.11",
"@types/nprogress": "^0.2.3",
"@types/plantuml-encoder": "^1.4.2",
"@types/prismjs": "^1.26.3",
"@types/react": "^18.2.55",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.1",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-csv": "^1.1.10",
"@types/react-dom": "^18.2.18",
"@types/react-dom": "^18.3.0",
"@types/react-katex": "^3.0.4",
"@types/react-timeago": "^4.1.7",
"@types/turndown": "^5.0.4",
"@types/uuid": "^9.0.8",
"eslint": "^8.56.0",
"eslint-config-next": "^14.1.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"prettier": "^3.2.5",
"prisma": "^5.9.1",
"typescript": "^5.3.3"
"prisma": "^5.13.0",
"typescript": "^5.4.5"
},
"engines": {
"node": "^20.0.0 || ^18.0.0"
+17 -14
View File
@@ -1,10 +1,9 @@
import * as React from 'react';
import Head from 'next/head';
import { MyAppProps } from 'next/app';
import { Analytics as VercelAnalytics } from '@vercel/analytics/react';
import { Analytics as VercelAnalytics } from '@vercel/analytics/next';
import { SpeedInsights as VercelSpeedInsights } from '@vercel/speed-insights/next';
import { Brand } from '~/common/app.config';
import { apiQuery } from '~/common/util/trpc.client';
@@ -14,12 +13,14 @@ import '~/common/styles/GithubMarkdown.css';
import '~/common/styles/NProgress.css';
import '~/common/styles/app.styles.css';
import { ProviderBackendAndNoSSR } from '~/common/providers/ProviderBackendAndNoSSR';
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 { ProviderTRPCQueryClient } from '~/common/providers/ProviderTRPCQueryClient';
import { ProviderTRPCQuerySettings } from '~/common/providers/ProviderTRPCQuerySettings';
import { ProviderTheming } from '~/common/providers/ProviderTheming';
import { hasGoogleAnalytics, OptionalGoogleAnalytics } from '~/common/components/GoogleAnalytics';
import { isVercelFromFrontend } from '~/common/util/pwaUtils';
const MyApp = ({ Component, emotionCache, pageProps }: MyAppProps) =>
@@ -32,20 +33,22 @@ const MyApp = ({ Component, emotionCache, pageProps }: MyAppProps) =>
<ProviderTheming emotionCache={emotionCache}>
<ProviderSingleTab>
<ProviderBootstrapLogic>
<ProviderTRPCQueryClient>
<ProviderSnacks>
<ProviderBackendAndNoSSR>
<ProviderTRPCQuerySettings>
<ProviderBackendCapabilities>
{/* ^ SSR boundary */}
<ProviderBootstrapLogic>
<ProviderSnacks>
<Component {...pageProps} />
</ProviderBackendAndNoSSR>
</ProviderSnacks>
</ProviderTRPCQueryClient>
</ProviderBootstrapLogic>
</ProviderSnacks>
</ProviderBootstrapLogic>
</ProviderBackendCapabilities>
</ProviderTRPCQuerySettings>
</ProviderSingleTab>
</ProviderTheming>
<VercelAnalytics debug={false} />
<VercelSpeedInsights debug={false} sampleRate={1 / 10} />
{isVercelFromFrontend && <VercelAnalytics debug={false} />}
{isVercelFromFrontend && <VercelSpeedInsights debug={false} sampleRate={1 / 2} />}
{hasGoogleAnalytics && <OptionalGoogleAnalytics />}
</>;
+1 -1
View File
@@ -26,7 +26,7 @@ export default function MyDocument({ emotionStyleTags }: MyDocumentProps) {
<link rel='icon' type='image/png' sizes='16x16' href='/icons/favicon-16x16.png' />
<link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' />
<link rel='manifest' href='/manifest.json' />
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta name='mobile-web-app-capable' content='yes' />
<meta name='apple-mobile-web-app-status-bar-style' content='black' />
{/* Opengraph */}
+10
View File
@@ -0,0 +1,10 @@
import * as React from 'react';
import { AppBeam } from '../../src/apps/beam/AppBeam';
import { withLayout } from '~/common/layout/withLayout';
export default function BeamPage() {
return withLayout({ type: 'optima' }, <AppBeam />);
}
+1 -4
View File
@@ -1,16 +1,13 @@
import * as React from 'react';
import { AppChat } from '../src/apps/chat/AppChat';
import { useRedirectToNewsOnUpdates } from '../src/apps/news/news.hooks';
import { withLayout } from '~/common/layout/withLayout';
export default function IndexPage() {
// show the News page if there are unseen updates
useRedirectToNewsOnUpdates();
// TODO: This Index page will point to the Dashboard (or a landing page) soon
// 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 />);
+169
View File
@@ -0,0 +1,169 @@
import * as React from 'react';
import { fileSave } from 'browser-fs-access';
import { Box, Button, Card, CardContent, Typography } from '@mui/joy';
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 { withLayout } from '~/common/layout/withLayout';
// app config
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';
// 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 { useUXLabsStore } from '~/common/state/store-ux-labs';
// utils access
import { clientHostName, isChromeDesktop, isFirefox, isIPhoneUser, isMacUser, isPwa, isVercelFromFrontend } from '~/common/util/pwaUtils';
import { getGA4MeasurementId } from '~/common/components/GoogleAnalytics';
import { prettyTimestampForFilenames } from '~/common/util/timeUtils';
import { supportsClipboardRead } from '~/common/util/clipboardUtils';
import { supportsScreenCapture } from '~/common/util/screenCaptureUtils';
function DebugCard(props: { title: string, children: React.ReactNode }) {
return (
<Box>
<Typography level='title-lg'>
{props.title}
</Typography>
{props.children}
</Box>
);
}
function prettifyJsonString(jsonString: string, deleteChars: number, removeDoubleQuotes: boolean, removeTrailComma: boolean): string {
return jsonString.split('\n').map(l => {
if (deleteChars > 0)
l = l.substring(deleteChars);
if (removeDoubleQuotes)
l = l.replaceAll('\"', '');
if (removeTrailComma && l.endsWith(','))
l = l.substring(0, l.length - 1);
return l;
}).join('\n').trim();
}
function DebugJsonCard(props: { title: string, data: any }) {
return (
<DebugCard title={props.title}>
<Typography level='body-sm' sx={{ whiteSpace: 'break-spaces', fontFamily: 'code', fontSize: { xs: 'xs' } }}>
{prettifyJsonString(JSON.stringify(props.data, null, 2), 2, true, true)}
</Typography>
</DebugCard>
);
}
function AppDebug() {
// state
const [saved, setSaved] = React.useState(false);
// external state
const backendCaps = getBackendCapabilities();
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();
// derived state
const cClient = {
// isBrowser,
isChromeDesktop,
isFirefox,
isIPhone: isIPhoneUser,
isMac: isMacUser,
isPWA: isPwa(),
supportsClipboardPaste: supportsClipboardRead,
supportsScreenCapture,
};
const cProduct = {
capabilities: {
mic: useCapabilityBrowserSpeechRecognition(),
elevenLabs: useCapabilityElevenLabs(),
textToImage: useCapabilityTextToImage(),
},
models: getLLMsDebugInfo(),
state: {
chatsCount,
foldersCount: folders?.length,
foldersEnabled: enableFolders,
newsCurrent: incrementalNewsVersion,
newsSeen: lastSeenNewsVersion,
labsActive: uxLabsExperiments,
reloads: usageCount,
},
};
const cBackend = {
configuration: backendCaps,
deployment: {
home: Brand.URIs.Home,
hostName: clientHostName(),
isVercelFromFrontend,
measurementId: getGA4MeasurementId(),
plantUmlServerUrl: getPlantUmlServerUrl(),
routeIndex: ROUTE_INDEX,
routeChat: ROUTE_APP_CHAT,
},
};
const handleDownload = async () => {
fileSave(
new Blob([JSON.stringify({ client: cClient, agi: cProduct, backend: cBackend }, null, 2)], { type: 'application/json' }),
{ fileName: `big-agi_debug_${prettyTimestampForFilenames()}.json`, extensions: ['.json'] },
)
.then(() => setSaved(true))
.catch(e => console.error('Error saving debug.json', e));
};
return (
<AppPlaceholder title={`${Brand.Title.Common} Debug`}>
<Box sx={{ display: 'grid', gap: 3, my: 3 }}>
<Button
variant={saved ? 'soft' : 'outlined'} color={saved ? 'success' : 'neutral'}
onClick={handleDownload}
endDecorator={<DownloadIcon />}
sx={{
backgroundColor: saved ? undefined : 'background.surface',
boxShadow: 'sm',
placeSelf: 'start',
minWidth: 260,
}}
>
Download debug JSON
</Button>
<Card>
<CardContent sx={{ display: 'grid', gap: 3 }}>
<DebugJsonCard title='Client' data={cClient} />
<DebugJsonCard title='AGI' data={cProduct} />
<DebugJsonCard title='Backend' data={cBackend} />
</CardContent>
</Card>
</Box>
</AppPlaceholder>
);
}
export default function DebugPage() {
return withLayout({ type: 'plain' }, <AppDebug />);
};
+1 -1
View File
@@ -1,6 +1,6 @@
import * as React from 'react';
import { AppLinkChat } from '../../../src/apps/link/AppLinkChat';
import { AppLinkChat } from '../../../src/apps/link-chat/AppLinkChat';
import { useRouterQuery } from '~/common/app.routes';
import { withLayout } from '~/common/layout/withLayout';
+6 -3
View File
@@ -77,9 +77,12 @@ function AppShareTarget() {
setIsDownloading(true);
callBrowseFetchPage(intentURL)
.then(page => {
if (page.stopReason !== 'error')
queueComposerTextAndLaunchApp('\n\n```' + intentURL + '\n' + page.content + '\n```\n');
else
if (page.stopReason !== 'error') {
let pageContent = page.content.markdown || page.content.text || page.content.html || '';
if (pageContent)
pageContent = '\n\n```' + intentURL + '\n' + pageContent + '\n```\n';
queueComposerTextAndLaunchApp(pageContent);
} else
setErrorMessage('Could not read any data' + page.error ? ': ' + page.error : '');
})
.catch(error => setErrorMessage(error?.message || error || 'Unknown error'))
+2 -2
View File
@@ -1,14 +1,14 @@
import * as React from 'react';
import { AppNews } from '../src/apps/news/AppNews';
import { useMarkNewsAsSeen } from '../src/apps/news/news.hooks';
import { markNewsAsSeen } from '../src/apps/news/news.version';
import { withLayout } from '~/common/layout/withLayout';
export default function NewsPage() {
// 'touch' the last seen news version
useMarkNewsAsSeen();
React.useEffect(() => markNewsAsSeen(), []);
return withLayout({ type: 'optima', suspendAutoModelsSetup: true }, <AppNews />);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

+28 -3
View File
@@ -3,9 +3,16 @@
"short_name": "big-AGI",
"theme_color": "#32383E",
"background_color": "#9FA6AD",
"description": "Personal AGI App",
"description": "Your Generative AI Suite",
"categories": [
"productivity",
"AI",
"tool",
"utilities"
],
"display": "standalone",
"start_url": "/",
"start_url": "/?source=pwa",
"scope": "/",
"icons": [
{
"src": "/icons/icon-192x192.png",
@@ -24,6 +31,17 @@
"type": "image/png"
}
],
"file_handlers": [
{
"action": "/link/share_target",
"accept": {
"application/big-agi": [
".agi",
".agi.json"
]
}
}
],
"share_target": {
"action": "/link/share_target",
"method": "GET",
@@ -33,5 +51,12 @@
"text": "text",
"url": "url"
}
}
},
"shortcuts": [
{
"name": "Call",
"url": "/call",
"description": "Call a Persona"
}
]
}
File diff suppressed because one or more lines are too long
+25 -15
View File
@@ -9,13 +9,17 @@ import { useRouterRoute } from '~/common/app.routes';
/**
* https://github.com/enricoros/big-AGI/issues/299
*/
export function AppPlaceholder(props: { text?: string }) {
export function AppPlaceholder(props: {
title?: string | null,
text?: React.ReactNode,
children?: React.ReactNode,
}) {
// external state
const route = useRouterRoute();
// derived state
const placeholderAppName = capitalizeFirstLetter(route.replace('/', '') || 'Home');
const placeholderAppName = props.title || capitalizeFirstLetter(route.replace('/', '') || 'Home');
return (
<Box sx={{
@@ -25,21 +29,27 @@ export function AppPlaceholder(props: { text?: string }) {
border: '1px solid blue',
}}>
<Box sx={{
my: 'auto',
display: 'flex', flexDirection: 'column', alignItems: 'center',
gap: 4,
border: '1px solid red',
}}>
{(props.title !== null || !!props.text) && (
<Box sx={{
my: 'auto',
display: 'flex', flexDirection: 'column', alignItems: 'center',
gap: 4,
border: '1px solid red',
}}>
<Typography level='h1'>
{placeholderAppName}
</Typography>
<Typography>
{props.text || 'Intelligent applications to help you learn, think, and do'}
</Typography>
<Typography level='h1'>
{placeholderAppName}
</Typography>
{!!props.text && (
<Typography>
{props.text}
</Typography>
)}
</Box>
</Box>
)}
{props.children}
</Box>
);
+105
View File
@@ -0,0 +1,105 @@
import * as React from 'react';
import { useShallow } from 'zustand/react/shallow';
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 { createDConversation, createDMessage, DConversation, DMessage } from '~/common/state/store-chats';
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...)'));
return conversation;
}
function initTestBeamStore(messages: DMessage[], beamStore: BeamStoreApi = createBeamVanillaStore()): BeamStoreApi {
beamStore.getState().open(messages, useModelsStore.getState().chatLLMId, (text) => alert(text));
return beamStore;
}
export function AppBeam() {
// state
const [showDebug, setShowDebug] = React.useState(false);
const [conversation, setConversation] = React.useState<DConversation>(() => initTestConversation());
const [beamStoreApi] = React.useState(() => createBeamVanillaStore());
// reinit the beam store if the conversation changes
React.useEffect(() => {
initTestBeamStore(conversation.messages, beamStoreApi);
}, [beamStoreApi, conversation]);
// external state
const isMobile = useIsMobile();
const { isOpen, beamState } = useBeamStore(beamStoreApi, useShallow(state => {
return {
isOpen: state.isOpen,
beamState: showDebug ? state : null,
};
}));
const handleClose = React.useCallback(() => {
beamStoreApi.getState().terminateKeepingSettings();
}, [beamStoreApi]);
// layout
usePluggableOptimaLayout(null, React.useMemo(() => <>
{/* button to toggle debug info */}
<Button size='sm' variant='plain' color='neutral' onClick={() => setShowDebug(on => !on)}>
{showDebug ? 'Hide' : 'Show'} debug
</Button>
{/* 'open' */}
<Button size='sm' variant='plain' color='neutral' onClick={() => setConversation(initTestConversation())}>
.open
</Button>
{/* 'close' */}
<Button size='sm' variant='plain' color='neutral' onClick={handleClose}>
.close
</Button>
</>, [handleClose, showDebug]), null, 'AppBeam');
return (
<Box sx={{ flexGrow: 1, overflowY: 'auto', position: 'relative' }}>
{isOpen && (
<BeamView
beamStore={beamStoreApi}
isMobile={isMobile}
/>
)}
{showDebug && (
<Typography level='body-xs' sx={{
whiteSpace: 'pre',
position: 'absolute',
inset: 0,
zIndex: 1 /* debug on top of BeamView */,
backdropFilter: 'blur(4px)',
padding: '1rem',
}}>
{JSON.stringify(beamState, null, 2)
// add an extra newline between first level properties (space, space, double quote) to make it more readable
.split('\n').map(line => line.replace(/^\s\s"/g, '\n ')).join('\n')}
</Typography>
)}
</Box>
);
}
+2
View File
@@ -65,6 +65,8 @@ export function AppCall() {
display: 'flex', flexDirection: 'column', alignItems: 'center',
justifyContent: hasIntent ? 'space-evenly' : undefined,
gap: hasIntent ? 1 : undefined,
// shall force the contacts or telephone to stay within the container
overflowY: hasIntent ? 'hidden' : undefined,
}}>
{!hasIntent ? (
+11 -49
View File
@@ -1,60 +1,22 @@
import * as React from 'react';
import { Box, Button, Card, CardContent, IconButton, ListItemDecorator, Typography } from '@mui/joy';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
import ArrowForwardRoundedIcon from '@mui/icons-material/ArrowForwardRounded';
import ChatIcon from '@mui/icons-material/Chat';
import CheckIcon from '@mui/icons-material/Check';
import CloseIcon from '@mui/icons-material/Close';
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import MicIcon from '@mui/icons-material/Mic';
import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver';
import WarningIcon from '@mui/icons-material/Warning';
import RecordVoiceOverTwoToneIcon from '@mui/icons-material/RecordVoiceOverTwoTone';
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
import { PreferencesTab, useOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { cssRainbowColorKeyframes } from '~/common/app.theme';
import { animationColorRainbow } from '~/common/util/animUtils';
import { navigateBack } from '~/common/app.routes';
import { useCapabilityBrowserSpeechRecognition, useCapabilityElevenLabs } from '~/common/components/useCapabilities';
import { useChatStore } from '~/common/state/store-chats';
import { useUICounter } from '~/common/state/store-ui';
/*export const cssRainbowBackgroundKeyframes = keyframes`
100%, 0% {
background-color: rgb(128, 0, 0);
}
8% {
background-color: rgb(102, 51, 0);
}
16% {
background-color: rgb(64, 64, 0);
}
25% {
background-color: rgb(38, 76, 0);
}
33% {
background-color: rgb(0, 89, 0);
}
41% {
background-color: rgb(0, 76, 41);
}
50% {
background-color: rgb(0, 64, 64);
}
58% {
background-color: rgb(0, 51, 102);
}
66% {
background-color: rgb(0, 0, 128);
}
75% {
background-color: rgb(63, 0, 128);
}
83% {
background-color: rgb(76, 0, 76);
}
91% {
background-color: rgb(102, 0, 51);
}`;*/
function StatusCard(props: { icon: React.JSX.Element, hasIssue: boolean, text: string, button?: React.JSX.Element }) {
return (
<Card sx={{ width: '100%' }}>
@@ -67,7 +29,7 @@ function StatusCard(props: { icon: React.JSX.Element, hasIssue: boolean, text: s
{props.button}
</Typography>
<ListItemDecorator>
{props.hasIssue ? <WarningIcon color='warning' /> : <CheckIcon color='success' />}
{props.hasIssue ? <WarningRoundedIcon color='warning' /> : <CheckRoundedIcon color='success' />}
</ListItemDecorator>
</CardContent>
</Card>
@@ -122,9 +84,9 @@ export function CallWizard(props: { strict?: boolean, conversationId: string | n
<Box sx={{ flexGrow: 0.5 }} />
<Typography level='title-lg' sx={{ fontSize: '3rem', fontWeight: 200, textAlign: 'center' }}>
<Typography level='title-lg' sx={{ fontSize: '3rem', fontWeight: 'sm', textAlign: 'center' }}>
Welcome to<br />
<Box component='span' sx={{ animation: `${cssRainbowColorKeyframes} 15s linear infinite` }}>
<Box component='span' sx={{ animation: `${animationColorRainbow} 15s linear infinite` }}>
your first call
</Box>
</Typography>
@@ -167,7 +129,7 @@ export function CallWizard(props: { strict?: boolean, conversationId: string | n
{/* Text to Speech status */}
<StatusCard
icon={<RecordVoiceOverIcon />}
icon={<RecordVoiceOverTwoToneIcon />}
text={
(synthesis.mayWork ? 'Voice synthesis should be ready.' : 'There might be an issue with ElevenLabs voice synthesis.')
+ (synthesis.isConfiguredServerSide ? '' : (synthesis.isConfiguredClientSide ? '' : ' Please add your API key in the settings.'))
@@ -208,7 +170,7 @@ export function CallWizard(props: { strict?: boolean, conversationId: string | n
// boxShadow: allGood ? 'md' : 'none',
}}
>
{allGood ? <ArrowForwardIcon sx={{ fontSize: '1.5em' }} /> : <CloseIcon sx={{ fontSize: '1.5em' }} />}
{allGood ? <ArrowForwardRoundedIcon sx={{ fontSize: '1.5em' }} /> : <CloseRoundedIcon sx={{ fontSize: '1.5em' }} />}
</IconButton>
</Box>
+2 -24
View File
@@ -1,12 +1,12 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { keyframes } from '@emotion/react';
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 { animationShadowRingLimey } from '~/common/util/animUtils';
import { conversationTitle, DConversation, DConversationId, useChatStore } from '~/common/state/store-chats';
import { usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
@@ -19,27 +19,6 @@ import { useAppCallStore } from './state/store-app-call';
const COLLAPSED_COUNT = 2;
export const niceShadowKeyframes = keyframes`
100%, 0% {
//background-color: rgb(102, 0, 51);
box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(183, 255, 0);
}
25% {
//background-color: rgb(76, 0, 76);
box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(255, 251, 0);
//scale: 1.2;
}
50% {
//background-color: rgb(63, 0, 128);
box-shadow: 1px 1px 0 white, 2px 2px 12px rgba(0, 255, 81);
//scale: 0.8;
}
75% {
//background-color: rgb(0, 0, 128);
box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(255, 153, 0);
}`;
const ContactCardAvatar = (props: { size: string, symbol?: string, imageUrl?: string, onClick?: () => void, sx?: SxProps }) =>
<Avatar
// variant='outlined'
@@ -125,7 +104,6 @@ function CallContactCard(props: {
sx={{
mx: 'auto',
mt: '-2.5rem',
zIndex: 1,
}}
/>
@@ -282,7 +260,7 @@ export function Contacts(props: { setCallIntent: (intent: AppCallIntent) => void
borderRadius: '50%',
pointerEvents: 'none',
backgroundColor: 'background.popup',
animation: `${niceShadowKeyframes} 5s infinite`,
animation: `${animationShadowRingLimey} 5s infinite`,
}}>
<CallIcon />
</IconButton>
+14 -25
View File
@@ -1,5 +1,5 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { useShallow } from 'zustand/react/shallow';
import { Box, Card, ListDivider, ListItemDecorator, MenuItem, Switch, Typography } from '@mui/joy';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
@@ -7,10 +7,10 @@ import CallEndIcon from '@mui/icons-material/CallEnd';
import CallIcon from '@mui/icons-material/Call';
import MicIcon from '@mui/icons-material/Mic';
import MicNoneIcon from '@mui/icons-material/MicNone';
import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver';
import RecordVoiceOverTwoToneIcon from '@mui/icons-material/RecordVoiceOverTwoTone';
import { ScrollToBottom } from '../chat/components/scroll-to-bottom/ScrollToBottom';
import { ScrollToBottomButton } from '../chat/components/scroll-to-bottom/ScrollToBottomButton';
import { ScrollToBottom } from '~/common/scroll-to-bottom/ScrollToBottom';
import { ScrollToBottomButton } from '~/common/scroll-to-bottom/ScrollToBottomButton';
import { useChatLLMDropdown } from '../chat/components/useLLMDropdown';
import { EXPERIMENTAL_speakTextStream } from '~/modules/elevenlabs/elevenlabs.client';
@@ -57,7 +57,7 @@ function CallMenuItems(props: {
</MenuItem>
<MenuItem onClick={handleChangeVoiceToggle}>
<ListItemDecorator><RecordVoiceOverIcon /></ListItemDecorator>
<ListItemDecorator><RecordVoiceOverTwoToneIcon /></ListItemDecorator>
Change Voice
<Switch checked={props.override} onChange={handleChangeVoiceToggle} sx={{ ml: 'auto' }} />
</MenuItem>
@@ -99,7 +99,7 @@ export function Telephone(props: {
// external state
const { chatLLMId, chatLLMDropdown } = useChatLLMDropdown();
const { chatTitle, reMessages } = useChatStore(state => {
const { chatTitle, reMessages } = useChatStore(useShallow(state => {
const conversation = props.callIntent.conversationId
? state.conversations.find(conversation => conversation.id === props.callIntent.conversationId) ?? null
: null;
@@ -107,7 +107,7 @@ export function Telephone(props: {
chatTitle: conversation ? conversationTitle(conversation) : null,
reMessages: conversation ? conversation.messages : null,
};
}, shallow);
}));
const persona = SystemPurposes[props.callIntent.personaId as SystemPurposeId] ?? undefined;
const personaCallStarters = persona?.call?.starters ?? undefined;
const personaVoiceId = overridePersonaVoice ? undefined : (persona?.voices?.elevenLabs?.voiceId ?? undefined);
@@ -224,8 +224,9 @@ export function Telephone(props: {
responseAbortController.current = new AbortController();
let finalText = '';
let error: any | null = null;
llmStreamingChatGenerate(chatLLMId, callPrompt, null, null, responseAbortController.current.signal, (updatedMessage: Partial<DMessage>) => {
const text = updatedMessage.text?.trim();
setPersonaTextInterim('💭...');
llmStreamingChatGenerate(chatLLMId, callPrompt, 'call', callMessages[0].id, null, null, responseAbortController.current.signal, ({ textSoFar }) => {
const text = textSoFar?.trim();
if (text) {
finalText = text;
setPersonaTextInterim(text);
@@ -330,22 +331,9 @@ export function Telephone(props: {
padding: 0, // move this to the ScrollToBottom component
}}>
<ScrollToBottom
// bootToBottom
stickToBottom
sx={{
// allows the content to be scrolled (all browsers)
overflowY: 'auto',
// actually make sure this scrolls & fills
height: '100%',
<ScrollToBottom stickToBottomInitial>
// content
display: 'grid',
padding: 1,
}}
>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
<Box sx={{ minHeight: '100%', p: 1, display: 'flex', flexDirection: 'column', gap: 1 }}>
{/* Call Messages [] */}
{callMessages.map((message) =>
@@ -354,7 +342,8 @@ export function Telephone(props: {
text={message.text}
variant={message.role === 'assistant' ? 'solid' : 'soft'}
color={message.role === 'assistant' ? 'neutral' : 'primary'}
role={message.role} />,
role={message.role}
/>,
)}
{/* Persona streaming text... */}
+2 -13
View File
@@ -1,19 +1,8 @@
import * as React from 'react';
import { keyframes } from '@emotion/react';
import { Avatar, Box } from '@mui/joy';
const cssScaleKeyframes = keyframes`
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}`;
import { animationScalePulse } from '~/common/util/animUtils';
export function CallAvatar(props: { symbol: string, imageUrl?: string, isRinging?: boolean, onClick: () => void }) {
@@ -34,7 +23,7 @@ export function CallAvatar(props: { symbol: string, imageUrl?: string, isRinging
<Box
sx={{
...(props.isRinging
? { animation: `${cssScaleKeyframes} 1.4s ease-in-out infinite` }
? { animation: `${animationScalePulse} 1.4s ease-in-out infinite` }
: {}),
}}
>
+7 -1
View File
@@ -12,13 +12,19 @@ export function CallMessage(props: {
role: VChatMessageIn['role'],
sx?: SxProps,
}) {
const isUserMessage = props.role === 'user';
return (
<Chip
color={props.color} variant={props.variant}
sx={{
alignSelf: props.role === 'user' ? 'end' : 'start',
alignSelf: isUserMessage ? 'end' : 'start',
whiteSpace: 'break-spaces',
borderRadius: 'lg',
...(isUserMessage ? {
borderBottomRightRadius: 0,
} : {
borderBottomLeftRadius: 0,
}),
// boxShadow: 'md',
py: 1,
px: 1.5,
+305 -264
View File
@@ -1,55 +1,82 @@
import * as React from 'react';
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
import type { SxProps } from '@mui/joy/styles/types';
import { useTheme } from '@mui/joy';
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 { useAreBeamsOpen } from '~/modules/beam/store-beam.hooks';
import { useCapabilityTextToImage } from '~/modules/t2i/t2i.client';
import { Brand } from '~/common/app.config';
import { ConfirmationModal } from '~/common/components/ConfirmationModal';
import { ConversationsManager } from '~/common/chats/ConversationsManager';
import { GlobalShortcutItem, ShortcutKeyName, useGlobalShortcuts } from '~/common/components/useGlobalShortcut';
import { PanelResizeInset } from '~/common/components/panes/GoodPanelResizeHandler';
import { PreferencesTab, useOptimaLayout, usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
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, getConversation, useConversation } from '~/common/state/store-chats';
import { createDMessage, DConversationId, DMessage, DMessageMetadata, getConversation, getConversationSystemPurposeId, useConversation } from '~/common/state/store-chats';
import { themeBgAppChatComposer } from '~/common/app.theme';
import { useFolderStore } from '~/common/state/store-folders';
import { useIsMobile } from '~/common/components/useMatchMedia';
import { useOptimaLayout, usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
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 { ChatBeamWrapper } from './components/ChatBeamWrapper';
import { ChatDrawerMemo } from './components/ChatDrawer';
import { ChatDropdowns } from './components/ChatDropdowns';
import { ChatPageMenuItems } from './components/ChatPageMenuItems';
import { ChatMessageList } from './components/ChatMessageList';
import { ChatPageMenuItems } from './components/ChatPageMenuItems';
import { Composer } from './components/composer/Composer';
import { Ephemerals } from './components/Ephemerals';
import { ScrollToBottom } from './components/scroll-to-bottom/ScrollToBottom';
import { ScrollToBottomButton } from './components/scroll-to-bottom/ScrollToBottomButton';
import { usePanesManager } from './components/panes/usePanesManager';
import { extractChatCommand, findAllChatCommands } from './commands/commands.registry';
import { runAssistantUpdatingState } from './editors/chat-stream';
import { runBrowseUpdatingState } from './editors/browse-load';
import { runImageGenerationUpdatingState } from './editors/image-generate';
import { runReActUpdatingState } from './editors/react-tangent';
import { _handleExecute } from './editors/_handleExecute';
// what to say when a chat is new and has no title
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';
const SPECIAL_ID_WIPE_ALL: DConversationId = 'wipe-chats';
export interface AppChatIntent {
initialConversationId: string | null;
}
const composerOpenSx: SxProps = {
zIndex: 21, // just to allocate a surface, and potentially have a shadow
backgroundColor: themeBgAppChatComposer,
borderTop: `1px solid`,
borderTopColor: 'divider',
p: { xs: 1, md: 2 },
};
const composerClosedSx: SxProps = {
display: 'none',
};
export function AppChat() {
@@ -59,7 +86,7 @@ export function AppChat() {
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 [deleteConversationId, setDeleteConversationId] = 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 composerTextAreaRef = React.useRef<HTMLTextAreaElement>(null);
@@ -70,68 +97,94 @@ export function AppChat() {
const isMobile = useIsMobile();
const { openLlmOptions } = useOptimaLayout();
const intent = useRouterQuery<Partial<AppChatIntent>>();
const showAltTitleBar = useUXLabsStore(state => DEV_MODE_SETTINGS && state.labsChatBarAlt === 'title');
const { openLlmOptions, openModelsSetup, openPreferencesTab } = useOptimaLayout();
const { chatLLM } = useChatLLM();
const {
// state
chatPanes,
focusedConversationId,
focusedPaneIndex,
focusedPaneConversationId,
// actions
navigateHistoryInFocusedPane,
openConversationInFocusedPane,
openConversationInSplitPane,
focusedPaneIndex,
removePane,
setFocusedPane,
setFocusedPaneIndex,
} = usePanesManager();
const chatHandlers = React.useMemo(() => chatPanes.map(pane => {
return pane.conversationId ? ConversationsManager.getHandler(pane.conversationId) : null;
}), [chatPanes]);
const beamsStores = React.useMemo(() => chatHandlers.map(handler => {
return handler?.getBeamStore() ?? null;
}), [chatHandlers]);
const beamsOpens = useAreBeamsOpen(beamsStores);
const beamOpenStoreInFocusedPane = React.useMemo(() => {
const open = focusedPaneIndex !== null ? (beamsOpens?.[focusedPaneIndex] ?? false) : false;
return open ? beamsStores?.[focusedPaneIndex!] ?? null : null;
}, [beamsOpens, beamsStores, focusedPaneIndex]);
const {
// focused
title: focusedChatTitle,
chatIdx: focusedChatNumber,
isNoChat: isNoChat,
isChatEmpty: isFocusedChatEmpty,
areChatsEmpty,
newConversationId,
conversationsLength,
_remove_systemPurposeId: focusedSystemPurposeId,
isEmpty: isFocusedChatEmpty,
isDeveloper: isFocusedChatDeveloper,
conversationIdx: focusedChatNumber,
// all
hasConversations,
recycleNewConversationId,
// actions
prependNewConversation,
branchConversation,
deleteConversation,
wipeAllConversations,
setMessages,
} = useConversation(focusedConversationId);
deleteConversations,
} = useConversation(focusedPaneConversationId);
const { mayWork: capabilityHasT2I } = useCapabilityTextToImage();
const { activeFolderId, activeFolderConversationsCount } = 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,
activeFolderConversationsCount: activeFolder ? activeFolder.conversationIds.length : conversationsLength,
};
});
// Window actions
const isMultiPane = chatPanes.length >= 2;
const isMultiAddable = chatPanes.length < 4;
const isMultiConversationId = isMultiPane && new Set(chatPanes.map((pane) => pane.conversationId)).size >= 2;
const willMulticast = isComposerMulticast && isMultiConversationId;
const disableNewButton = isFocusedChatEmpty && !isMultiPane;
const setFocusedConversationId = React.useCallback((conversationId: DConversationId | null) => {
const handleOpenConversationInFocusedPane = React.useCallback((conversationId: DConversationId | null) => {
conversationId && openConversationInFocusedPane(conversationId);
}, [openConversationInFocusedPane]);
const openSplitConversationId = React.useCallback((conversationId: DConversationId | null) => {
const handleOpenConversationInSplitPane = React.useCallback((conversationId: DConversationId | null) => {
conversationId && openConversationInSplitPane(conversationId);
}, [openConversationInSplitPane]);
const handleNavigateHistory = React.useCallback((direction: 'back' | 'forward') => {
const handleNavigateHistoryInFocusedPane = React.useCallback((direction: 'back' | 'forward') => {
if (navigateHistoryInFocusedPane(direction))
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;
@@ -141,89 +194,23 @@ export function AppChat() {
}
}, [focusedChatNumber, focusedChatTitle]);
// Execution
const _handleExecute = React.useCallback(async (chatModeId: ChatModeId, conversationId: DConversationId, history: DMessage[]): Promise<void> => {
const chatLLMId = getChatLLMId();
if (!chatModeId || !conversationId || !chatLLMId) return;
const handleExecuteAndOutcome = React.useCallback(async (chatModeId: ChatModeId, conversationId: DConversationId, history: DMessage[]) => {
const outcome = await _handleExecute(chatModeId, conversationId, history);
if (outcome === 'err-no-chatllm')
openModelsSetup();
else if (outcome === 'err-t2i-unconfigured')
openPreferencesTab(PreferencesTab.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' });
return outcome === true;
}, [openModelsSetup, openPreferencesTab]);
// "/command ...": overrides the chat mode
const lastMessage = history.length > 0 ? history[history.length - 1] : null;
if (lastMessage?.role === 'user') {
const chatCommand = extractChatCommand(lastMessage.text)[0];
if (chatCommand && chatCommand.type === 'cmd') {
switch (chatCommand.providerId) {
case 'ass-browse':
setMessages(conversationId, history);
return await runBrowseUpdatingState(conversationId, chatCommand.params!);
case 'ass-t2i':
setMessages(conversationId, history);
return await runImageGenerationUpdatingState(conversationId, chatCommand.params!);
case 'ass-react':
setMessages(conversationId, history);
return await runReActUpdatingState(conversationId, chatCommand.params!, chatLLMId);
case 'chat-alter':
if (chatCommand.command === '/clear') {
if (chatCommand.params === 'all')
return setMessages(conversationId, []);
const helpMessage = createDMessage('assistant', 'This command requires the \'all\' parameter to confirm the operation.');
helpMessage.originLLM = Brand.Title.Base;
return setMessages(conversationId, [...history, helpMessage]);
}
Object.assign(lastMessage, {
role: chatCommand.command.startsWith('/s') ? 'system' : chatCommand.command.startsWith('/a') ? 'assistant' : 'user',
sender: 'Bot',
text: chatCommand.params || '',
} satisfies Partial<DMessage>);
return setMessages(conversationId, history);
case 'cmd-help':
const chatCommandsText = findAllChatCommands()
.map(cmd => ` - ${cmd.primary}` + (cmd.alternatives?.length ? ` (${cmd.alternatives.join(', ')})` : '') + `: ${cmd.description}`)
.join('\n');
const helpMessage = createDMessage('assistant', 'Available Chat Commands:\n' + chatCommandsText);
helpMessage.originLLM = Brand.Title.Base;
return setMessages(conversationId, [...history, helpMessage]);
}
}
}
// synchronous long-duration tasks, which update the state as they go
if (chatLLMId && focusedSystemPurposeId) {
switch (chatModeId) {
case 'generate-text':
return await runAssistantUpdatingState(conversationId, history, chatLLMId, focusedSystemPurposeId);
case 'append-user':
return setMessages(conversationId, history);
case 'generate-image':
if (!lastMessage?.text)
break;
// also add a 'fake' user message with the '/draw' command
setMessages(conversationId, history.map(message => message.id !== lastMessage.id ? message : {
...message,
text: `/draw ${lastMessage.text}`,
}));
return await runImageGenerationUpdatingState(conversationId, lastMessage.text);
case 'generate-react':
if (!lastMessage?.text)
break;
setMessages(conversationId, history);
return await runReActUpdatingState(conversationId, lastMessage.text, chatLLMId);
}
}
// ISSUE: if we're here, it means we couldn't do the job, at least sync the history
console.log('handleExecuteConversation: issue running', chatModeId, conversationId, lastMessage);
setMessages(conversationId, history);
}, [focusedSystemPurposeId, setMessages]);
const handleComposerAction = (chatModeId: ChatModeId, conversationId: DConversationId, multiPartMessage: ComposerOutputMultiPart): boolean => {
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({
@@ -239,67 +226,80 @@ export function AppChat() {
const userText = multiPartMessage[0].text;
// multicast: send the message to all the panes
const uniqueIds = new Set([conversationId]);
const uniqueConversationIds = new Set([conversationId]);
if (willMulticast)
chatPanes.forEach(pane => pane.conversationId && uniqueIds.add(pane.conversationId));
chatPanes.forEach(pane => pane.conversationId && uniqueConversationIds.add(pane.conversationId));
// we loop to handle both the normal and multicast modes
let enqueued = false;
for (const _cId of uniqueIds) {
const _conversation = getConversation(_cId);
if (_conversation) {
// start execution fire/forget
void _handleExecute(chatModeId, _cId, [
..._conversation.messages,
createDMessage('user', userText),
]);
enqueued = true;
}
let enqueuedAny = false;
for (const _cId of uniqueConversationIds) {
const history = getConversation(_cId)?.messages;
if (!history) continue;
const newUserMessage = createDMessage('user', userText);
if (metadata) newUserMessage.metadata = metadata;
// fire/forget
void handleExecuteAndOutcome(chatModeId, _cId, [...history, newUserMessage]);
enqueuedAny = true;
}
return enqueued;
};
return enqueuedAny;
}, [chatPanes, handleExecuteAndOutcome, willMulticast]);
const handleConversationExecuteHistory = React.useCallback(async (conversationId: DConversationId, history: DMessage[]): Promise<void> => {
await _handleExecute('generate-text', conversationId, history);
}, [_handleExecute]);
const handleConversationExecuteHistory = React.useCallback(async (conversationId: DConversationId, history: DMessage[]) => {
await handleExecuteAndOutcome('generate-text', conversationId, history);
}, [handleExecuteAndOutcome]);
const handleMessageRegenerateLast = React.useCallback(async () => {
const focusedConversation = getConversation(focusedConversationId);
const handleMessageRegenerateLastInFocusedPane = React.useCallback(async () => {
const focusedConversation = getConversation(focusedPaneConversationId);
if (focusedConversation?.messages?.length) {
const lastMessage = focusedConversation.messages[focusedConversation.messages.length - 1];
return await _handleExecute('generate-text', focusedConversation.id, lastMessage.role === 'assistant'
? focusedConversation.messages.slice(0, -1)
: [...focusedConversation.messages],
);
const history = lastMessage.role === 'assistant' ? focusedConversation.messages.slice(0, -1) : [...focusedConversation.messages];
await handleExecuteAndOutcome('generate-text', focusedConversation.id, history);
}
}, [focusedConversationId, _handleExecute]);
}, [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);
}
}, [focusedPaneConversationId]);
const handleTextDiagram = React.useCallback((diagramConfig: DiagramConfig | null) => setDiagramConfig(diagramConfig), []);
const handleTextImagine = React.useCallback(async (conversationId: DConversationId, messageText: string): Promise<void> => {
const handleTextImagine = React.useCallback(async (conversationId: DConversationId, messageText: string) => {
const conversation = getConversation(conversationId);
if (!conversation)
return;
const imaginedPrompt = await imaginePromptFromText(messageText) || 'An error sign.';
return await _handleExecute('generate-image', conversationId, [
await handleExecuteAndOutcome('generate-image', conversationId, [
...conversation.messages,
createDMessage('user', imaginedPrompt),
]);
}, [_handleExecute]);
}, [handleExecuteAndOutcome]);
const handleTextSpeak = React.useCallback(async (text: string): Promise<void> => {
await speakText(text);
}, []);
// Chat actions
const handleConversationNew = React.useCallback((forceNoRecycle?: boolean) => {
const handleConversationNewInFocusedPane = React.useCallback((forceNoRecycle?: boolean) => {
// activate an existing new conversation if present, or create another
const conversationId = (newConversationId && !forceNoRecycle)
? newConversationId
: prependNewConversation(focusedSystemPurposeId ?? undefined);
setFocusedConversationId(conversationId);
// create conversation (or recycle the existing top-of-stack empty conversation)
const conversationId = (recycleNewConversationId && !forceNoRecycle)
? recycleNewConversationId
: prependNewConversation(getConversationSystemPurposeId(focusedPaneConversationId) ?? undefined);
// switch the focused pane to the new conversation
handleOpenConversationInFocusedPane(conversationId);
// if a folder is active, add the new conversation to the folder
if (activeFolderId && conversationId)
@@ -308,7 +308,7 @@ export function AppChat() {
// focus the composer
composerTextAreaRef.current?.focus();
}, [activeFolderId, focusedSystemPurposeId, newConversationId, prependNewConversation, setFocusedConversationId]);
}, [activeFolderId, focusedPaneConversationId, handleOpenConversationInFocusedPane, prependNewConversation, recycleNewConversationId]);
const handleConversationImportDialog = React.useCallback(() => setTradeConfig({ dir: 'import' }), []);
@@ -316,6 +316,32 @@ 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 handleFileSaveConversation = React.useCallback((conversationId: DConversationId | null) => {
const conversation = getConversation(conversationId);
conversation && downloadConversation(conversation, 'json')
.then(() => {
addSnackbar({ key: 'chat-save-as-ok', message: 'File saved.', type: 'success' });
})
.catch((err: any) => {
if (err?.name !== 'AbortError')
addSnackbar({ key: 'chat-save-as-fail', message: `Could not save the file. ${err?.message || ''}`, type: 'issue' });
});
}, []);
const handleConversationBranch = React.useCallback((srcConversationId: DConversationId, messageId: string | null): DConversationId | null => {
// clone data
const branchedConversationId = branchConversation(srcConversationId, messageId);
@@ -326,43 +352,42 @@ export function AppChat() {
// replace/open a new pane with this
showNextTitleChange.current = true;
if (isMultiAddable)
openSplitConversationId(branchedConversationId);
if (!isMultiAddable)
handleOpenConversationInFocusedPane(branchedConversationId);
else
setFocusedConversationId(branchedConversationId);
handleOpenConversationInSplitPane(branchedConversationId);
return branchedConversationId;
}, [activeFolderId, branchConversation, isMultiAddable, openSplitConversationId, setFocusedConversationId]);
}, [activeFolderId, branchConversation, handleOpenConversationInFocusedPane, handleOpenConversationInSplitPane, isMultiAddable]);
const handleConversationFlatten = React.useCallback((conversationId: DConversationId) => setFlattenConversationId(conversationId), []);
const handleConfirmedClearConversation = React.useCallback(() => {
if (clearConversationId) {
setMessages(clearConversationId, []);
ConversationsManager.getHandler(clearConversationId).messagesReplace([]);
setClearConversationId(null);
}
}, [clearConversationId, setMessages]);
}, [clearConversationId]);
const handleConversationClear = React.useCallback((conversationId: DConversationId) => setClearConversationId(conversationId), []);
const handleConversationsDeleteAll = React.useCallback(() => setDeleteConversationId(SPECIAL_ID_WIPE_ALL), []);
const handleConversationDelete = React.useCallback((conversationId: DConversationId, bypassConfirmation: boolean) => {
// show dialog if not bypassed
const handleDeleteConversations = React.useCallback((conversationIds: DConversationId[], bypassConfirmation: boolean) => {
if (!bypassConfirmation)
return setDeleteConversationId(conversationId);
return setDeleteConversationIds(conversationIds);
const nextConversationId = conversationId === SPECIAL_ID_WIPE_ALL
? wipeAllConversations(activeFolderId /* restricted to this folder (or null for all) */, /*focusedSystemPurposeId ??*/ undefined)
: deleteConversation(conversationId, /*focusedSystemPurposeId ??*/ undefined);
setFocusedConversationId(nextConversationId);
// perform deletion, and return the next (or a new) conversation
const nextConversationId = deleteConversations(conversationIds, /*focusedSystemPurposeId ??*/ undefined);
setDeleteConversationId(null);
}, [activeFolderId, deleteConversation, setFocusedConversationId, wipeAllConversations]);
// 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]);
const handleConfirmedDeleteConversation = React.useCallback(() => {
deleteConversationId && handleConversationDelete(deleteConversationId, true);
}, [deleteConversationId, handleConversationDelete]);
// Shortcuts
@@ -373,60 +398,73 @@ export function AppChat() {
}, [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],
['r', true, true, false, handleMessageRegenerateLast],
['n', true, false, true, handleConversationNew],
['b', true, false, true, () => isFocusedChatEmpty || (focusedConversationId && handleConversationBranch(focusedConversationId, null))],
['x', true, false, true, () => isFocusedChatEmpty || (focusedConversationId && handleConversationClear(focusedConversationId))],
['d', true, false, true, () => focusedConversationId && handleConversationDelete(focusedConversationId, false)],
[ShortcutKeyName.Left, true, false, true, () => handleNavigateHistory('back')],
[ShortcutKeyName.Right, true, false, true, () => handleNavigateHistory('forward')],
], [focusedConversationId, handleConversationBranch, handleConversationClear, handleConversationDelete, handleConversationNew, handleMessageRegenerateLast, handleNavigateHistory, handleOpenChatLlmOptions, isFocusedChatEmpty]);
['+', 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);
// Pluggable ApplicationBar components
const centerItems = React.useMemo(() =>
<ChatDropdowns
conversationId={focusedConversationId}
/>,
[focusedConversationId],
// Pluggable Optima components
const barAltTitle = showAltTitleBar ? focusedChatTitle ?? 'No Chat' : null;
const focusedBarContent = React.useMemo(() => beamOpenStoreInFocusedPane
? <ChatBarAltBeam beamStore={beamOpenStoreInFocusedPane} isMobile={isMobile} />
: (barAltTitle === null)
? <ChatBarDropdowns conversationId={focusedPaneConversationId} />
: <ChatBarAltTitle conversationId={focusedPaneConversationId} conversationTitle={barAltTitle} />
, [barAltTitle, beamOpenStoreInFocusedPane, focusedPaneConversationId, isMobile],
);
const drawerContent = React.useMemo(() =>
<ChatDrawerMemo
activeConversationId={focusedConversationId}
isMobile={isMobile}
activeConversationId={focusedPaneConversationId}
activeFolderId={activeFolderId}
chatPanesConversationIds={chatPanes.map(pane => pane.conversationId).filter(Boolean) as DConversationId[]}
disableNewButton={isFocusedChatEmpty && !isNoChat}
onConversationActivate={setFocusedConversationId}
onConversationDelete={handleConversationDelete}
onConversationExportDialog={handleConversationExport}
onConversationImportDialog={handleConversationImportDialog}
onConversationNew={handleConversationNew}
onConversationsDeleteAll={handleConversationsDeleteAll}
disableNewButton={disableNewButton}
onConversationActivate={handleOpenConversationInFocusedPane}
onConversationBranch={handleConversationBranch}
onConversationNew={handleConversationNewInFocusedPane}
onConversationsDelete={handleDeleteConversations}
onConversationsExportDialog={handleConversationExport}
onConversationsImportDialog={handleConversationImportDialog}
setActiveFolderId={setActiveFolderId}
/>,
[activeFolderId, chatPanes, focusedConversationId, handleConversationDelete, handleConversationExport, handleConversationImportDialog, handleConversationNew, handleConversationsDeleteAll, isFocusedChatEmpty, isNoChat, setFocusedConversationId],
[activeFolderId, chatPanes, disableNewButton, focusedPaneConversationId, handleConversationBranch, handleConversationExport, handleConversationImportDialog, handleConversationNewInFocusedPane, handleDeleteConversations, handleOpenConversationInFocusedPane, isMobile],
);
const menuItems = React.useMemo(() =>
const focusedMenuItems = React.useMemo(() =>
<ChatPageMenuItems
isMobile={isMobile}
conversationId={focusedConversationId}
disableItems={!focusedConversationId || isFocusedChatEmpty}
hasConversations={!areChatsEmpty}
conversationId={focusedPaneConversationId}
disableItems={!focusedPaneConversationId || isFocusedChatEmpty}
hasConversations={hasConversations}
isMessageSelectionMode={isMessageSelectionMode}
onConversationBranch={handleConversationBranch}
onConversationClear={handleConversationClear}
onConversationFlatten={handleConversationFlatten}
// onConversationNew={handleConversationNew}
// onConversationNew={handleConversationNewInFocusedPane}
setIsMessageSelectionMode={setIsMessageSelectionMode}
/>,
[areChatsEmpty, focusedConversationId, handleConversationBranch, handleConversationClear, handleConversationFlatten, /*handleConversationNew,*/ isFocusedChatEmpty, isMessageSelectionMode, isMobile],
[focusedPaneConversationId, handleConversationBranch, handleConversationClear, handleConversationFlatten, hasConversations, isFocusedChatEmpty, isMessageSelectionMode, isMobile],
);
usePluggableOptimaLayout(drawerContent, centerItems, menuItems, 'AppChat');
usePluggableOptimaLayout(drawerContent, focusedBarContent, focusedMenuItems, 'AppChat');
return <>
@@ -436,10 +474,14 @@ export function AppChat() {
>
{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 _panesCount = chatPanes.length;
const _keyAndId = `chat-pane-${idx}-${_paneConversationId}`;
const _sepId = `sep-pane-${idx}-${_paneConversationId}`;
const _keyAndId = `chat-pane-${pane.paneId}`;
const _sepId = `sep-pane-${idx}`;
return <React.Fragment key={_keyAndId}>
<Panel
@@ -450,7 +492,7 @@ export function AppChat() {
minSize={20}
onClick={(event) => {
const setFocus = chatPanes.length < 2 || !event.altKey;
setFocusedPane(setFocus ? idx : -1);
setFocusedPaneIndex(setFocus ? idx : -1);
}}
onCollapse={() => {
// NOTE: despite the delay to try to let the draggin settle, there seems to be an issue with the Pane locking the screen
@@ -463,58 +505,66 @@ export function AppChat() {
position: 'relative',
...(isMultiPane ? {
borderRadius: '0.375rem',
border: `2px solid ${idx === focusedPaneIndex
border: `2px solid ${_paneIsFocused
? ((willMulticast || !isMultiConversationId) ? theme.palette.primary.solidBg : theme.palette.primary.solidBg)
: ((willMulticast || !isMultiConversationId) ? theme.palette.warning.softActiveBg : theme.palette.background.level1)}`,
filter: (!willMulticast && idx !== focusedPaneIndex)
? (!isMultiConversationId ? 'grayscale(66.67%)' /* clone of the same */ : 'grayscale(66.67%)')
: undefined,
} : {}),
: ((willMulticast || !isMultiConversationId) ? theme.palette.primary.softActiveBg : theme.palette.background.level1)}`,
// DISABLED on 2024-03-13, it gets in the way quite a lot
// filter: (!willMulticast && !_paneIsFocused)
// ? (!isMultiConversationId ? 'grayscale(66.67%)' /* clone of the same */ : 'grayscale(66.67%)')
// : undefined,
} : {
// NOTE: this is a workaround for the 'stuck-after-collapse-close' issue. We will collapse the 'other' pane, which
// will get it removed (onCollapse), and somehow this pane will be stuck with a pointerEvents: 'none' style, which de-facto
// disables further interaction with the chat. This is a workaround to re-enable the pointer events.
// The root cause seems to be a Dragstate not being reset properly, however the pointerEvents has been set since 0.0.56 while
// it was optional before: https://github.com/bvaughn/react-resizable-panels/issues/241
pointerEvents: 'auto',
}),
}}
>
<ScrollToBottom
bootToBottom
stickToBottom
sx={{
// allows the content to be scrolled (all browsers)
overflowY: 'auto',
// actually make sure this scrolls & fills
height: '100%',
}}
stickToBottomInitial
sx={{ display: 'flex', flexDirection: 'column' }}
>
<ChatMessageList
conversationId={_paneConversationId}
capabilityHasT2I={capabilityHasT2I}
chatLLMContextTokens={chatLLM?.contextTokens ?? null}
isMessageSelectionMode={isMessageSelectionMode}
isMobile={isMobile}
setIsMessageSelectionMode={setIsMessageSelectionMode}
onConversationBranch={handleConversationBranch}
onConversationExecuteHistory={handleConversationExecuteHistory}
onTextDiagram={handleTextDiagram}
onTextImagine={handleTextImagine}
onTextSpeak={handleTextSpeak}
sx={{
minHeight: '100%', // ensures filling of the blank space on newer chats
}}
/>
{!_paneBeamIsOpen && (
<ChatMessageList
conversationId={_paneConversationId}
conversationHandler={_paneChatHandler}
capabilityHasT2I={capabilityHasT2I}
chatLLMContextTokens={chatLLM?.contextTokens ?? null}
fitScreen={isMobile || isMultiPane}
isMessageSelectionMode={isMessageSelectionMode}
setIsMessageSelectionMode={setIsMessageSelectionMode}
onConversationBranch={handleConversationBranch}
onConversationExecuteHistory={handleConversationExecuteHistory}
onTextDiagram={handleTextDiagram}
onTextImagine={handleTextImagine}
onTextSpeak={handleTextSpeak}
sx={{
flexGrow: 1,
}}
/>
)}
<Ephemerals
conversationId={_paneConversationId}
sx={{
// TODO: Fixme post panels?
// flexGrow: 0.1,
flexShrink: 0.5,
overflowY: 'auto',
minHeight: 64,
}}
/>
{_paneBeamIsOpen && (
<ChatBeamWrapper
beamStore={_paneBeamStore}
isMobile={isMobile}
inlineSx={{
flexGrow: 1,
// minHeight: 'calc(100vh - 69px - var(--AGI-Nav-width))',
}}
/>
)}
{/* Visibility and actions are handled via Context */}
<ScrollToBottomButton />
</ScrollToBottom>
</Panel>
{/* Panel Separators & Resizers */}
@@ -533,20 +583,14 @@ export function AppChat() {
isMobile={isMobile}
chatLLM={chatLLM}
composerTextAreaRef={composerTextAreaRef}
conversationId={focusedConversationId}
conversationId={focusedPaneConversationId}
capabilityHasT2I={capabilityHasT2I}
isMulticast={!isMultiConversationId ? null : isComposerMulticast}
isDeveloperMode={focusedSystemPurposeId === 'Developer'}
isDeveloperMode={isFocusedChatDeveloper}
onAction={handleComposerAction}
onTextImagine={handleTextImagine}
setIsMulticast={setIsComposerMulticast}
sx={{
zIndex: 21, // position: 'sticky', bottom: 0,
backgroundColor: themeBgAppChatComposer,
borderTop: `1px solid`,
borderTopColor: 'divider',
p: { xs: 1, md: 2 },
}}
sx={beamOpenStoreInFocusedPane ? composerClosedSx : composerOpenSx}
/>
{/* Diagrams */}
@@ -565,7 +609,7 @@ export function AppChat() {
{!!tradeConfig && (
<TradeModal
config={tradeConfig}
onConversationActivate={setFocusedConversationId}
onConversationActivate={handleOpenConversationInFocusedPane}
onClose={() => setTradeConfig(null)}
/>
)}
@@ -573,23 +617,20 @@ export function AppChat() {
{/* [confirmation] Reset Conversation */}
{!!clearConversationId && (
<ConfirmationModal
open
onClose={() => setClearConversationId(null)}
onPositive={handleConfirmedClearConversation}
open onClose={() => setClearConversationId(null)} onPositive={handleConfirmedClearConversation}
confirmationText='Are you sure you want to discard all messages?'
positiveActionText='Clear conversation'
/>
)}
{/* [confirmation] Delete All */}
{!!deleteConversationId && <ConfirmationModal
open onClose={() => setDeleteConversationId(null)} onPositive={handleConfirmedDeleteConversation}
confirmationText={deleteConversationId === SPECIAL_ID_WIPE_ALL
? `Are you absolutely sure you want to delete ${activeFolderId ? 'ALL conversations in this folder' : 'ALL conversations'}? This action cannot be undone.`
: 'Are you sure you want to delete this conversation?'}
positiveActionText={deleteConversationId === SPECIAL_ID_WIPE_ALL
? `Yes, delete all ${activeFolderConversationsCount} conversations`
: 'Delete conversation'}
/>}
{!!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`}
/>
)}
</>;
}
+16
View File
@@ -0,0 +1,16 @@
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,
}],
};
+2 -2
View File
@@ -1,4 +1,4 @@
import FormatPaintIcon from '@mui/icons-material/FormatPaint';
import FormatPaintTwoToneIcon from '@mui/icons-material/FormatPaintTwoTone';
import type { ICommandsProvider } from './ICommandsProvider';
@@ -11,7 +11,7 @@ export const CommandsDraw: ICommandsProvider = {
alternatives: ['/imagine', '/img'],
arguments: ['prompt'],
description: 'Assistant will draw the text',
Icon: FormatPaintIcon,
Icon: FormatPaintTwoToneIcon,
}],
};
+28 -12
View File
@@ -1,13 +1,14 @@
import { 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';
export type CommandsProviderId = 'ass-browse' | 'ass-t2i' | 'ass-react' | 'chat-alter' | 'cmd-help' | 'mode-beam';
type TextCommandPiece =
| { type: 'text'; value: string; }
@@ -20,6 +21,7 @@ const ChatCommandsProviders: Record<CommandsProviderId, ICommandsProvider> = {
'ass-t2i': CommandsDraw,
'chat-alter': CommandsAlter,
'cmd-help': CommandsHelp,
'mode-beam': CommandsBeam,
};
export function findAllChatCommands(): ChatCommand[] {
@@ -38,7 +40,10 @@ export function extractChatCommand(input: string): TextCommandPiece[] {
// Find the first space to separate the command from its parameters (if any)
const firstSpaceIndex = inputTrimmed.indexOf(' ');
const potentialCommand = inputTrimmed.substring(0, firstSpaceIndex >= 0 ? firstSpaceIndex : inputTrimmed.length);
const commandMatch = inputTrimmed.match(/^\/\S+/);
const potentialCommand = commandMatch ? commandMatch[0] : inputTrimmed;
const textAfterCommand = firstSpaceIndex >= 0 ? inputTrimmed.substring(firstSpaceIndex + 1) : '';
// Check if the potential command is an actual command
for (const provider of Object.values(ChatCommandsProviders)) {
@@ -46,22 +51,33 @@ export function extractChatCommand(input: string): TextCommandPiece[] {
if (cmd.primary === potentialCommand || cmd.alternatives?.includes(potentialCommand)) {
// command needs arguments: take the rest of the input as parameters
if (cmd.arguments?.length) {
const params = firstSpaceIndex >= 0 ? inputTrimmed.substring(firstSpaceIndex + 1) : '';
return [{ type: 'cmd', providerId: provider.id, command: potentialCommand, params: params || undefined, isError: !params || undefined }];
}
if (cmd.arguments?.length) return [{
type: 'cmd',
providerId: provider.id,
command: potentialCommand,
params: textAfterCommand || undefined,
isError: !textAfterCommand || undefined,
}];
// command without arguments, treat any text after as a separate text piece
const pieces: TextCommandPiece[] = [{ type: 'cmd', providerId: provider.id, command: potentialCommand, params: undefined }];
const textAfterCommand = firstSpaceIndex >= 0 ? inputTrimmed.substring(firstSpaceIndex + 1) : '';
if (textAfterCommand)
pieces.push({ type: 'text', value: textAfterCommand });
const pieces: TextCommandPiece[] = [{
type: 'cmd',
providerId: provider.id,
command: potentialCommand,
params: undefined,
}];
textAfterCommand && pieces.push({
type: 'text',
value: textAfterCommand,
});
return pieces;
}
}
}
// No command found, return the entire input as text
return [{ type: 'text', value: input }];
return [{
type: 'text',
value: input,
}];
}
+117
View File
@@ -0,0 +1,117 @@
import * as React from 'react';
import { useShallow } from 'zustand/react/shallow';
import { Box, IconButton, Typography } from '@mui/joy';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import FullscreenRoundedIcon from '@mui/icons-material/FullscreenRounded';
import { BeamStoreApi, useBeamStore } from '~/modules/beam/store-beam.hooks';
import { ConfirmationModal } from '~/common/components/ConfirmationModal';
import { GoodTooltip } from '~/common/components/GoodTooltip';
import { KeyStroke } from '~/common/components/KeyStroke';
import { ShortcutKeyName, useGlobalShortcut } from '~/common/components/useGlobalShortcut';
import { animationBackgroundBeamGather, animationColorBeamScatterINV, animationEnterBelow } from '~/common/util/animUtils';
export function ChatBarAltBeam(props: {
beamStore: BeamStoreApi,
isMobile?: boolean
}) {
// state
const [showCloseConfirmation, setShowCloseConfirmation] = React.useState(false);
// external beam state
const { isScattering, isGatheringAny, requiresConfirmation, setIsMaximized, terminateBeam } = useBeamStore(props.beamStore, useShallow((store) => ({
// state
isScattering: store.isScattering,
isGatheringAny: store.isGatheringAny,
requiresConfirmation: store.isScattering || store.isGatheringAny || store.raysReady > 0,
// actions
setIsMaximized: store.setIsMaximized,
terminateBeam: store.terminateKeepingSettings,
})));
// closure handlers
const handleCloseBeam = React.useCallback(() => {
if (requiresConfirmation)
setShowCloseConfirmation(true);
else
terminateBeam();
}, [requiresConfirmation, terminateBeam]);
const handleCloseConfirmation = React.useCallback(() => {
terminateBeam();
setShowCloseConfirmation(false);
}, [terminateBeam]);
const handleCloseDenial = React.useCallback(() => {
setShowCloseConfirmation(false);
}, []);
const handleMaximizeBeam = React.useCallback(() => {
setIsMaximized(true);
}, [setIsMaximized]);
// intercept esc this beam is focused
useGlobalShortcut(ShortcutKeyName.Esc, false, false, false, handleCloseBeam);
return (
<Box sx={{ display: 'flex', gap: { xs: 1, md: 2 }, alignItems: 'center' }}>
{/* Title & Status */}
<Typography level='title-md'>
<Box
component='span'
sx={
isGatheringAny ? { animation: `${animationBackgroundBeamGather} 3s infinite, ${animationEnterBelow} 0.6s`, px: 1.5, py: 0.5 }
: isScattering ? { animation: `${animationColorBeamScatterINV} 5s infinite, ${animationEnterBelow} 0.6s` }
: { fontWeight: 'lg' }
}>
{isGatheringAny ? 'Merging...' : isScattering ? 'Beaming...' : 'Beam'}
</Box>
{(!isGatheringAny && !isScattering) && ' Mode'}
</Typography>
{/* Right Close Icon */}
<Box sx={{ display: 'flex' }}>
{/* [desktop] maximize button, or a disabled spacer */}
{!props.isMobile && (
<GoodTooltip usePlain title={<Box sx={{ p: 1 }}>Maximize</Box>}>
<IconButton size='sm' onClick={handleMaximizeBeam}>
<FullscreenRoundedIcon />
</IconButton>
</GoodTooltip>
)}
<GoodTooltip usePlain title={<Box sx={{ p: 1, display: 'flex', flexDirection: 'column', gap: 1 }}>Back to Chat <KeyStroke combo='Esc' /></Box>}>
<IconButton aria-label='Close' size='sm' onClick={handleCloseBeam}>
<CloseRoundedIcon />
</IconButton>
</GoodTooltip>
</Box>
{/* Confirmation Modal */}
{showCloseConfirmation && (
<ConfirmationModal
open
onClose={handleCloseDenial}
onPositive={handleCloseConfirmation}
lowStakes
noTitleBar
confirmationText='Are you sure you want to close Beam Mode? Unsaved text will be lost.'
positiveActionText='Yes, close'
/>
)}
</Box>
);
}
@@ -0,0 +1,52 @@
import * as React from 'react';
import { Box, Typography } from '@mui/joy';
import AutoFixHighIcon from '@mui/icons-material/AutoFixHigh';
import { conversationAutoTitle } from '~/modules/aifn/autotitle/autoTitle';
import type { DConversationId } from '~/common/state/store-chats';
import { capitalizeFirstLetter } from '~/common/util/textUtils';
import { CHAT_NOVEL_TITLE } from '../AppChat';
import { FadeInButton } from './ChatDrawerItem';
export function ChatBarAltTitle(props: {
conversationId: DConversationId | null,
conversationTitle: string,
}) {
// state
const [isEditingTitle, setIsEditingTitle] = React.useState<boolean>(false);
// derived state
const { conversationId, conversationTitle } = props;
const hasConversation = !!conversationId;
const handleTitleEditAuto = React.useCallback(async () => {
if (!conversationId) return;
setIsEditingTitle(true);
await conversationAutoTitle(conversationId, true);
setIsEditingTitle(false);
}, [conversationId]);
return (
<Box sx={{ display: 'flex', gap: { xs: 1, md: 3 }, alignItems: 'center' }}>
<Typography>
{capitalizeFirstLetter(conversationTitle?.trim() || CHAT_NOVEL_TITLE)}
</Typography>
{hasConversation && (
<FadeInButton size='sm' disabled={isEditingTitle} onClick={handleTitleEditAuto}>
<AutoFixHighIcon />
</FadeInButton>
)}
</Box>
);
}
@@ -7,7 +7,7 @@ import { usePersonaIdDropdown } from './usePersonaDropdown';
import { useFolderDropdown } from './folders/useFolderDropdown';
export function ChatDropdowns(props: {
export function ChatBarDropdowns(props: {
conversationId: DConversationId | null
}) {
@@ -0,0 +1,59 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, Modal, ModalClose } from '@mui/joy';
import { BeamStoreApi, useBeamStore } from '~/modules/beam/store-beam.hooks';
import { BeamView } from '~/modules/beam/BeamView';
import { ScrollToBottom } from '~/common/scroll-to-bottom/ScrollToBottom';
/*const overlaySx: SxProps = {
position: 'absolute',
inset: 0,
zIndex: themeZIndexBeamView, // stay on top of Message > Chips (:1), and Overlays (:2) - note: Desktop Drawer (:26)
}*/
export function ChatBeamWrapper(props: {
beamStore: BeamStoreApi,
isMobile: boolean,
inlineSx?: SxProps,
}) {
// state
const isMaximized = useBeamStore(props.beamStore, state => state.isMaximized);
const handleUnMaximize = React.useCallback(() => {
props.beamStore.getState().setIsMaximized(false);
}, [props.beamStore]);
// memo the beamview
const beamView = React.useMemo(() => (
<BeamView
beamStore={props.beamStore}
isMobile={props.isMobile}
showExplainer
/>
), [props.beamStore, props.isMobile]);
return isMaximized ? (
<Modal open onClose={handleUnMaximize}>
<Box sx={{
backgroundColor: 'background.level1',
position: 'absolute',
inset: 0,
}}>
<ScrollToBottom disableAutoStick>
{beamView}
</ScrollToBottom>
<ModalClose sx={{ color: 'white', backgroundColor: 'background.surface', boxShadow: 'xs', mr: 2 }} />
</Box>
</Modal>
) : (
<Box sx={props.inlineSx}>
{beamView}
</Box>
);
}
+213 -182
View File
@@ -1,29 +1,35 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { useShallow } from 'zustand/react/shallow';
import { Box, IconButton, ListDivider, ListItem, ListItemButton, ListItemDecorator, Tooltip } from '@mui/joy';
import { Box, Button, Dropdown, IconButton, ListDivider, ListItem, ListItemButton, ListItemDecorator, Menu, MenuButton, MenuItem, Tooltip, Typography } from '@mui/joy';
import AddIcon from '@mui/icons-material/Add';
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
import ClearIcon from '@mui/icons-material/Clear';
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import FileDownloadOutlinedIcon from '@mui/icons-material/FileDownloadOutlined';
import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined';
import FolderIcon from '@mui/icons-material/Folder';
import FolderOpenOutlinedIcon from '@mui/icons-material/FolderOpenOutlined';
import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import StarOutlineRoundedIcon from '@mui/icons-material/StarOutlineRounded';
import DebounceInput from '~/common/components/DebounceInput';
import type { DConversationId } from '~/common/state/store-chats';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { DFolder, useFolderStore } from '~/common/state/store-folders';
import { DebounceInputMemo } from '~/common/components/DebounceInput';
import { FoldersToggleOff } from '~/common/components/icons/FoldersToggleOff';
import { FoldersToggleOn } from '~/common/components/icons/FoldersToggleOn';
import { PageDrawerHeader } from '~/common/layout/optima/components/PageDrawerHeader';
import { PageDrawerList, PageDrawerTallItemSx } from '~/common/layout/optima/components/PageDrawerList';
import { conversationTitle, DConversationId, useChatStore } from '~/common/state/store-chats';
import { themeZIndexOverMobileDrawer } from '~/common/app.theme';
import { PageDrawerList } from '~/common/layout/optima/components/PageDrawerList';
import { capitalizeFirstLetter } from '~/common/util/textUtils';
import { themeScalingMap, themeZIndexOverMobileDrawer } from '~/common/app.theme';
import { useOptimaDrawers } from '~/common/layout/optima/useOptimaDrawers';
import { useUIPreferencesStore } from '~/common/state/store-ui';
import { ChatDrawerItemMemo, ChatNavigationItemData, FolderChangeRequest } from './ChatDrawerItem';
import { ChatDrawerItemMemo, FolderChangeRequest } from './ChatDrawerItem';
import { ChatFolderList } from './folders/ChatFolderList';
import { ChatNavGrouping, ChatSearchSorting, isDrawerSearching, useChatDrawerRenderItems } from './useChatDrawerRenderItems';
import { ClearFolderText } from './folders/useFolderDropdown';
import { useChatDrawerFilters } from '../store-app-chat';
// this is here to make shallow comparisons work on the next hook
@@ -32,7 +38,7 @@ const noFolders: DFolder[] = [];
/*
* Lists folders and returns the active folder
*/
export const useFolders = (activeFolderId: string | null) => useFolderStore(({ enableFolders, folders, toggleEnableFolders }) => {
export const useFolders = (activeFolderId: string | null) => useFolderStore(useShallow(({ enableFolders, folders, toggleEnableFolders }) => {
// finds the active folder if any
const activeFolder = (enableFolders && activeFolderId)
@@ -45,95 +51,61 @@ export const useFolders = (activeFolderId: string | null) => useFolderStore(({ e
enableFolders,
toggleEnableFolders,
};
}, shallow);
/*
* Returns a string with the pane indices where the conversation is also open, or false if it's not
*/
function findOpenInViewNumbers(chatPanesConversationIds: DConversationId[], ourId: DConversationId): string | false {
if (chatPanesConversationIds.length <= 1) return false;
return chatPanesConversationIds.reduce((acc: string[], id, idx) => {
if (id === ourId)
acc.push((idx + 1).toString());
return acc;
}, []).join(', ') || false;
}
/*
* Optimization: return a reduced version of the DConversation object for 'Drawer Items' purposes,
* to avoid unnecessary re-renders on each new character typed by the assistant
*/
export const useChatNavigationItemsData = (activeFolder: DFolder | null, allFolders: DFolder[], activeConversationId: DConversationId | null, chatPanesConversationIds: DConversationId[]): ChatNavigationItemData[] =>
useChatStore(({ conversations }) => {
const activeConversations = activeFolder
? conversations.filter(_c => activeFolder.conversationIds.includes(_c.id))
: conversations;
return activeConversations.map((_c): ChatNavigationItemData => ({
conversationId: _c.id,
isActive: _c.id === activeConversationId,
isAlsoOpen: findOpenInViewNumbers(chatPanesConversationIds, _c.id),
isEmpty: !_c.messages.length && !_c.userTitle,
title: conversationTitle(_c),
folder: !allFolders.length
? undefined // don't show folder select if folders are disabled
: _c.id === activeConversationId // only show the folder for active conversation(s)
? allFolders.find(folder => folder.conversationIds.includes(_c.id)) ?? null
: null,
messageCount: _c.messages.length,
assistantTyping: !!_c.abortController,
systemPurposeId: _c.systemPurposeId,
}));
}, (a, b) => {
// custom equality function to avoid unnecessary re-renders
return a.length === b.length && a.every((_a, i) => shallow(_a, b[i]));
});
}));
export const ChatDrawerMemo = React.memo(ChatDrawer);
function ChatDrawer(props: {
isMobile: boolean,
activeConversationId: DConversationId | null,
activeFolderId: string | null,
chatPanesConversationIds: DConversationId[],
disableNewButton: boolean,
onConversationActivate: (conversationId: DConversationId) => void,
onConversationDelete: (conversationId: DConversationId, bypassConfirmation: boolean) => void,
onConversationExportDialog: (conversationId: DConversationId | null, exportAll: boolean) => void,
onConversationImportDialog: () => void,
onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void,
onConversationNew: (forceNoRecycle: boolean) => void,
onConversationsDeleteAll: () => void,
onConversationsDelete: (conversationIds: DConversationId[], bypassConfirmation: boolean) => void,
onConversationsExportDialog: (conversationId: DConversationId | null, exportAll: boolean) => void,
onConversationsImportDialog: () => void,
setActiveFolderId: (folderId: string | null) => void,
}) {
const { onConversationActivate, onConversationDelete, onConversationExportDialog, onConversationNew } = props;
const { onConversationActivate, onConversationBranch, onConversationNew, onConversationsDelete, onConversationsExportDialog } = props;
// local state
const [navGrouping, setNavGrouping] = React.useState<ChatNavGrouping>('date');
const [searchSorting, setSearchSorting] = React.useState<ChatSearchSorting>('frequency');
const [debouncedSearchQuery, setDebouncedSearchQuery] = React.useState('');
const [folderChangeRequest, setFolderChangeRequest] = React.useState<FolderChangeRequest | null>(null);
// external state
const { closeDrawer, closeDrawerOnMobile } = useOptimaDrawers();
const {
filterHasStars, toggleFilterHasStars,
showPersonaIcons, toggleShowPersonaIcons,
showRelativeSize, toggleShowRelativeSize,
} = useChatDrawerFilters();
const { activeFolder, allFolders, enableFolders, toggleEnableFolders } = useFolders(props.activeFolderId);
const chatNavItems = useChatNavigationItemsData(activeFolder, allFolders, props.activeConversationId, props.chatPanesConversationIds);
const showSymbols = useUIPreferencesStore(state => state.zenMode !== 'cleaner');
const { filteredChatsCount, filteredChatIDs, filteredChatsAreEmpty, filteredChatsBarBasis, filteredChatsIncludeActive, renderNavItems } = useChatDrawerRenderItems(
props.activeConversationId, props.chatPanesConversationIds, debouncedSearchQuery, activeFolder, allFolders, filterHasStars, navGrouping, searchSorting, showRelativeSize,
);
const { contentScaling, showSymbols } = useUIPreferencesStore(useShallow(state => ({
contentScaling: state.contentScaling,
showSymbols: state.zenMode !== 'cleaner',
})));
// derived state
const selectConversationsCount = chatNavItems.length;
const nonEmptyChats = selectConversationsCount > 1 || (selectConversationsCount === 1 && !chatNavItems[0].isEmpty);
const softMaxReached = selectConversationsCount >= 40 && showSymbols;
// New/Activate/Delete Conversation
const isMultiPane = props.chatPanesConversationIds.length >= 2;
const handleButtonNew = React.useCallback(() => {
onConversationNew(isMultiPane);
closeDrawerOnMobile();
}, [closeDrawerOnMobile, isMultiPane, onConversationNew]);
const disableNewButton = props.disableNewButton && filteredChatsIncludeActive;
const newButtonDontRecycle = isMultiPane || !filteredChatsIncludeActive;
const handleButtonNew = React.useCallback(() => {
onConversationNew(newButtonDontRecycle);
closeDrawerOnMobile();
}, [closeDrawerOnMobile, newButtonDontRecycle, onConversationNew]);
const handleConversationActivate = React.useCallback((conversationId: DConversationId, closeMenu: boolean) => {
onConversationActivate(conversationId);
@@ -141,10 +113,17 @@ function ChatDrawer(props: {
closeDrawerOnMobile();
}, [closeDrawerOnMobile, onConversationActivate]);
const handleConversationsDeleteFiltered = React.useCallback(() => {
!!filteredChatIDs?.length && onConversationsDelete(filteredChatIDs, false);
}, [filteredChatIDs, onConversationsDelete]);
const handleConversationDelete = React.useCallback((conversationId: DConversationId) => {
conversationId && onConversationDelete(conversationId, true);
}, [onConversationDelete]);
const handleConversationDeleteNoConfirmation = React.useCallback((conversationId: DConversationId) => {
conversationId && onConversationsDelete([conversationId], true);
}, [onConversationsDelete]);
const handleConversationsExport = React.useCallback(() => {
props.activeConversationId && onConversationsExportDialog(props.activeConversationId, true);
}, [onConversationsExportDialog, props.activeConversationId]);
// Folder change request
@@ -166,67 +145,90 @@ function ChatDrawer(props: {
}, []);
// Filter chatNavItems based on the search query and rank them by search frequency
const filteredChatNavItems = React.useMemo(() => {
if (!debouncedSearchQuery) return chatNavItems;
return chatNavItems
.map(item => {
// Get the conversation by ID
const conversation = useChatStore.getState().conversations.find(c => c.id === item.conversationId);
// Calculate the frequency of the search term in the title and messages
const titleFrequency = (item.title.toLowerCase().match(new RegExp(debouncedSearchQuery.toLowerCase(), 'g')) || []).length;
const messageFrequency = conversation?.messages.reduce((count, message) => {
return count + (message.text.toLowerCase().match(new RegExp(debouncedSearchQuery.toLowerCase(), 'g')) || []).length;
}, 0) || 0;
// Return the item with the searchFrequency property
return {
...item,
searchFrequency: titleFrequency + messageFrequency,
};
})
// Exclude items with a searchFrequency of 0
.filter(item => item.searchFrequency > 0)
// Sort the items by searchFrequency in descending order
.sort((a, b) => b.searchFrequency! - a.searchFrequency!);
}, [chatNavItems, debouncedSearchQuery]);
// memoize the group dropdown
const { isSearching } = isDrawerSearching(debouncedSearchQuery);
const groupingComponent = React.useMemo(() => (
<Dropdown>
<MenuButton
aria-label='View options'
slots={{ root: IconButton }}
slotProps={{ root: { size: 'sm' } }}
>
<MoreVertIcon />
</MenuButton>
{!isSearching ? (
// Search/Filter default menu: Grouping, Filtering, ...
<Menu placement='bottom-start' sx={{ minWidth: 180, zIndex: themeZIndexOverMobileDrawer /* need to be on top of the Modal on Mobile */ }}>
<ListItem>
<Typography level='body-sm'>Group By</Typography>
</ListItem>
{(['date', 'persona'] as const).map(_gName => (
<MenuItem
key={'group-' + _gName}
aria-label={`Group by ${_gName}`}
selected={navGrouping === _gName}
onClick={() => setNavGrouping(grouping => grouping === _gName ? false : _gName)}
>
<ListItemDecorator>{navGrouping === _gName && <CheckRoundedIcon />}</ListItemDecorator>
{capitalizeFirstLetter(_gName)}
</MenuItem>
))}
// basis for the underline bar
const bottomBarBasis = filteredChatNavItems.reduce((longest, _c) => Math.max(longest, _c.searchFrequency ?? _c.messageCount), 1);
<ListDivider />
<ListItem>
<Typography level='body-sm'>Filter</Typography>
</ListItem>
<MenuItem onClick={toggleFilterHasStars}>
<ListItemDecorator>{filterHasStars && <CheckRoundedIcon />}</ListItemDecorator>
Starred <StarOutlineRoundedIcon />
</MenuItem>
<ListDivider />
<ListItem>
<Typography level='body-sm'>Show</Typography>
</ListItem>
<MenuItem onClick={toggleShowPersonaIcons}>
<ListItemDecorator>{showPersonaIcons && <CheckRoundedIcon />}</ListItemDecorator>
Icons
</MenuItem>
<MenuItem onClick={toggleShowRelativeSize}>
<ListItemDecorator>{showRelativeSize && <CheckRoundedIcon />}</ListItemDecorator>
Relative Size
</MenuItem>
</Menu>
) : (
// While searching, show the sorting options
<Menu placement='bottom-start' sx={{ minWidth: 180, zIndex: themeZIndexOverMobileDrawer /* need to be on top of the Modal on Mobile */ }}>
<ListItem>
<Typography level='body-sm'>Sort By</Typography>
</ListItem>
<MenuItem selected={searchSorting === 'frequency'} onClick={() => setSearchSorting('frequency')}>
<ListItemDecorator>{searchSorting === 'frequency' && <CheckRoundedIcon />}</ListItemDecorator>
Matches
</MenuItem>
<MenuItem selected={searchSorting === 'date'} onClick={() => setSearchSorting('date')}>
<ListItemDecorator>{searchSorting === 'date' && <CheckRoundedIcon />}</ListItemDecorator>
Date
</MenuItem>
</Menu>
)}
</Dropdown>
), [filterHasStars, isSearching, navGrouping, searchSorting, showPersonaIcons, showRelativeSize, toggleFilterHasStars, toggleShowPersonaIcons, toggleShowRelativeSize]);
// grouping
/*let sortedIds = conversationIDs;
if (grouping === 'persona') {
const conversations = useChatStore.getState().conversations;
// group conversations by persona
const groupedConversations: { [personaId: string]: string[] } = {};
conversations.forEach(conversation => {
const persona = conversation.systemPurposeId;
if (persona) {
if (!groupedConversations[persona])
groupedConversations[persona] = [];
groupedConversations[persona].push(conversation.id);
}
});
// flatten grouped conversations
sortedIds = Object.values(groupedConversations).flat();
}*/
return <>
{/* Drawer Header */}
<PageDrawerHeader title='Chats' onClose={closeDrawer}>
<Tooltip title={enableFolders ? 'Hide Folders' : 'Use Folders'}>
<IconButton onClick={toggleEnableFolders}>
{enableFolders ? <FolderOpenOutlinedIcon /> : <FolderOutlinedIcon />}
<IconButton size='sm' onClick={toggleEnableFolders}>
{enableFolders ? <FoldersToggleOn /> : <FoldersToggleOff />}
</IconButton>
</Tooltip>
</PageDrawerHeader>
{/* Folders List */}
{/* Folders List (shrink at twice the rate as the Titles) */}
{/*<Box sx={{*/}
{/* display: 'grid',*/}
{/* gridTemplateRows: !enableFolders ? '0fr' : '1fr',*/}
@@ -240,8 +242,15 @@ function ChatDrawer(props: {
{enableFolders && (
<ChatFolderList
folders={allFolders}
contentScaling={contentScaling}
activeFolderId={props.activeFolderId}
onFolderSelect={props.setActiveFolderId}
sx={{
// shrink this at twice the rate as the Titles list
flexGrow: 0, flexShrink: 2, overflow: 'hidden',
minHeight: '7.5rem',
p: 2,
}}
/>
)}
{/*</Box>*/}
@@ -251,69 +260,91 @@ function ChatDrawer(props: {
{enableFolders && <ListDivider sx={{ mb: 0 }} />}
{/* Search Input Field */}
<DebounceInput
minChars={2}
onDebounce={setDebouncedSearchQuery}
debounceTimeout={300}
placeholder='Search...'
aria-label='Search'
sx={{ m: 2 }}
/>
{/* Search / New Chat */}
<Box sx={{ display: 'flex', flexDirection: 'column', m: 2, gap: 2 }}>
{/* Search Input Field */}
<DebounceInputMemo
minChars={2}
onDebounce={setDebouncedSearchQuery}
debounceTimeout={300}
placeholder='Search...'
aria-label='Search'
endDecorator={groupingComponent}
/>
{/* New Chat Button */}
<Button
// variant='outlined'
variant={disableNewButton ? undefined : 'soft'}
disabled={disableNewButton}
onClick={handleButtonNew}
sx={{
// ...PageDrawerTallItemSx,
justifyContent: 'flex-start',
padding: '0px 0.75rem',
<ListItem sx={{ '--ListItem-minHeight': '2.75rem' }}>
<ListItemButton disabled={props.disableNewButton && !isMultiPane} onClick={handleButtonNew} sx={PageDrawerTallItemSx}>
<ListItemDecorator><AddIcon /></ListItemDecorator>
<Box sx={{
// style
fontSize: 'sm',
fontWeight: 'lg',
// content
flexGrow: 1,
display: 'flex',
justifyContent: 'space-between',
gap: 1,
}}>
New chat
{/*<KeyStroke combo='Ctrl + Alt + N' sx={props.disableNewButton ? { opacity: 0.5 } : undefined} />*/}
</Box>
</ListItemButton>
</ListItem>
border: '1px solid',
borderColor: 'neutral.outlinedBorder',
borderRadius: 'sm',
'--ListItemDecorator-size': 'calc(2.5rem - 1px)', // compensate for the border
// backgroundColor: 'background.popup',
// boxShadow: (disableNewButton || props.isMobile) ? 'none' : 'xs',
// transition: 'box-shadow 0.2s',
}}
>
<ListItemDecorator><AddIcon sx={{ fontSize: '' }} /></ListItemDecorator>
New chat
</Button>
{/*<ListDivider sx={{ mt: 0 }} />*/}
<Box sx={{ flex: 1, overflowY: 'auto' }}>
{/*<ListItem sticky sx={{ justifyContent: 'space-between', boxShadow: 'sm' }}>*/}
{/* <Typography level='body-sm'>*/}
{/* Conversations*/}
{/* </Typography>*/}
{/* <ToggleButtonGroup variant='soft' size='sm' value={grouping} onChange={(_event, newValue) => newValue && setGrouping(newValue)}>*/}
{/* <IconButton value='off'>*/}
{/* <AccessTimeIcon />*/}
{/* </IconButton>*/}
{/* <IconButton value='persona'>*/}
{/* <PersonIcon />*/}
{/* </IconButton>*/}
{/* </ToggleButtonGroup>*/}
{/*</ListItem>*/}
{filteredChatNavItems.map(item =>
<ChatDrawerItemMemo
key={'nav-' + item.conversationId}
item={item}
showSymbols={showSymbols}
bottomBarBasis={(softMaxReached || debouncedSearchQuery) ? bottomBarBasis : 0}
onConversationActivate={handleConversationActivate}
onConversationDelete={handleConversationDelete}
onConversationExport={onConversationExportDialog}
onConversationFolderChange={handleConversationFolderChange}
/>)}
</Box>
<ListDivider sx={{ mt: 0 }} />
{/* Chat Titles List (shrink as half the rate as the Folders List) */}
<Box sx={{ flexGrow: 1, flexShrink: 1, flexBasis: '20rem', overflowY: 'auto', ...themeScalingMap[contentScaling].chatDrawerItemSx }}>
{renderNavItems.map((item, idx) => item.type === 'nav-item-chat-data' ? (
<ChatDrawerItemMemo
key={'nav-chat-' + item.conversationId}
item={item}
showSymbols={showPersonaIcons && showSymbols}
bottomBarBasis={filteredChatsBarBasis}
onConversationActivate={handleConversationActivate}
onConversationBranch={onConversationBranch}
onConversationDeleteNoConfirmation={handleConversationDeleteNoConfirmation}
onConversationExport={onConversationsExportDialog}
onConversationFolderChange={handleConversationFolderChange}
/>
) : item.type === 'nav-item-group' ? (
<Typography key={'nav-divider-' + idx} level='body-xs' sx={{
textAlign: 'center',
my: 'calc(var(--ListItem-minHeight) / 4)',
// keeps the group header sticky to the top
position: 'sticky',
top: 0,
backgroundColor: 'background.popup',
zIndex: 1,
}}>
{item.title}
</Typography>
) : item.type === 'nav-item-info-message' ? (
<Typography key={'nav-info-' + idx} level='body-xs' sx={{ textAlign: 'center', color: 'primary.softColor', my: 'calc(var(--ListItem-minHeight) / 4)' }}>
{filterHasStars && <StarOutlineRoundedIcon sx={{ color: 'primary.softColor', fontSize: 'xl', mb: -0.5, mr: 1 }} />}
{item.message}
{filterHasStars && <>
<Button variant='soft' size='sm' onClick={toggleFilterHasStars} sx={{ display: 'block', mt: 2, mx: 'auto' }}>
remove filters
</Button>
</>}
</Typography>
) : null,
)}
</Box>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<ListItemButton onClick={props.onConversationImportDialog} sx={{ flex: 1 }}>
<ListDivider sx={{ my: 0 }} />
{/* Bottom commands */}
<Box sx={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>
<ListItemButton onClick={props.onConversationsImportDialog} sx={{ flex: 1 }}>
<ListItemDecorator>
<FileUploadOutlinedIcon />
</ListItemDecorator>
@@ -321,7 +352,7 @@ function ChatDrawer(props: {
{/*<OpenAIIcon sx={{ ml: 'auto' }} />*/}
</ListItemButton>
<ListItemButton disabled={!nonEmptyChats} onClick={() => props.onConversationExportDialog(props.activeConversationId, true)} sx={{ flex: 1 }}>
<ListItemButton disabled={filteredChatsAreEmpty} onClick={handleConversationsExport} sx={{ flex: 1 }}>
<ListItemDecorator>
<FileDownloadOutlinedIcon />
</ListItemDecorator>
@@ -329,11 +360,11 @@ function ChatDrawer(props: {
</ListItemButton>
</Box>
<ListItemButton disabled={!nonEmptyChats} onClick={props.onConversationsDeleteAll}>
<ListItemButton disabled={filteredChatsAreEmpty} onClick={handleConversationsDeleteFiltered}>
<ListItemDecorator>
<DeleteOutlineIcon />
</ListItemDecorator>
Delete {selectConversationsCount >= 2 ? `all ${selectConversationsCount} chats` : 'chat'}
Delete {filteredChatsCount >= 2 ? `all ${filteredChatsCount} chats` : 'chat'}
</ListItemButton>
</PageDrawerList>
+117 -77
View File
@@ -2,13 +2,14 @@ import * as React from 'react';
import { Avatar, Box, IconButton, ListItem, ListItemButton, ListItemDecorator, Sheet, styled, Tooltip, Typography } from '@mui/joy';
import AutoFixHighIcon from '@mui/icons-material/AutoFixHigh';
import CloseIcon from '@mui/icons-material/Close';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import EditIcon from '@mui/icons-material/Edit';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import FileDownloadOutlinedIcon from '@mui/icons-material/FileDownloadOutlined';
import FolderIcon from '@mui/icons-material/Folder';
import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined';
import ForkRightIcon from '@mui/icons-material/ForkRight';
import { SystemPurposeId, SystemPurposes } from '../../../data';
@@ -19,13 +20,16 @@ import { DConversationId, useChatStore } from '~/common/state/store-chats';
import { InlineTextarea } from '~/common/components/InlineTextarea';
import { isDeepEqual } from '~/common/util/jsUtils';
import { CHAT_NOVEL_TITLE } from '../AppChat';
import { STREAM_TEXT_INDICATOR } from '../editors/chat-stream';
// set to true to display the conversation IDs
// const DEBUG_CONVERSATION_IDS = false;
export const FadeInButton = styled(IconButton)({
opacity: 0.667,
opacity: 0.5,
transition: 'opacity 0.2s',
'&:hover': { opacity: 1 },
});
@@ -37,22 +41,26 @@ export const ChatDrawerItemMemo = React.memo(ChatDrawerItem, (prev, next) =>
prev.showSymbols === next.showSymbols &&
prev.bottomBarBasis === next.bottomBarBasis &&
prev.onConversationActivate === next.onConversationActivate &&
prev.onConversationDelete === next.onConversationDelete &&
prev.onConversationBranch === next.onConversationBranch &&
prev.onConversationDeleteNoConfirmation === next.onConversationDeleteNoConfirmation &&
prev.onConversationExport === next.onConversationExport &&
prev.onConversationFolderChange === next.onConversationFolderChange,
);
export interface ChatNavigationItemData {
type: 'nav-item-chat-data',
conversationId: DConversationId;
isActive: boolean;
isAlsoOpen: string | false;
isEmpty: boolean;
title: string;
userFlagsSummary: string | undefined;
folder: DFolder | null | undefined; // null: 'All', undefined: do not show folder select
updatedAt: number;
messageCount: number;
assistantTyping: boolean;
systemPurposeId: SystemPurposeId;
searchFrequency?: number;
searchFrequency: number;
}
export interface FolderChangeRequest {
@@ -67,18 +75,20 @@ function ChatDrawerItem(props: {
showSymbols: boolean,
bottomBarBasis: number,
onConversationActivate: (conversationId: DConversationId, closeMenu: boolean) => void,
onConversationDelete: (conversationId: DConversationId) => void,
onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void,
onConversationDeleteNoConfirmation: (conversationId: DConversationId) => void,
onConversationExport: (conversationId: DConversationId, exportAll: boolean) => void,
onConversationFolderChange: (folderChangeRequest: FolderChangeRequest) => void,
}) {
// state
const [isEditingTitle, setIsEditingTitle] = React.useState(false);
const [isAutoEditingTitle, setIsAutoEditingTitle] = React.useState(false);
const [deleteArmed, setDeleteArmed] = React.useState(false);
// derived state
const { onConversationExport, onConversationFolderChange } = props;
const { conversationId, isActive, isAlsoOpen, title, folder, messageCount, assistantTyping, systemPurposeId, searchFrequency } = props.item;
const { onConversationBranch, onConversationExport, onConversationFolderChange } = props;
const { conversationId, isActive, isAlsoOpen, title, userFlagsSummary, folder, messageCount, assistantTyping, systemPurposeId, searchFrequency } = props.item;
const isNew = messageCount === 0;
@@ -95,6 +105,14 @@ function ChatDrawerItem(props: {
const handleConversationActivate = () => props.onConversationActivate(conversationId, true);
// branch
const handleConversationBranch = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
conversationId && onConversationBranch(conversationId, null);
}, [conversationId, onConversationBranch]);
// export
const handleConversationExport = React.useCallback((event: React.MouseEvent) => {
@@ -128,14 +146,25 @@ function ChatDrawerItem(props: {
useChatStore.getState().setUserTitle(conversationId, text.trim());
}, [conversationId]);
const handleTitleEditAuto = React.useCallback(() => {
conversationAutoTitle(conversationId, true);
const handleTitleEditAuto = React.useCallback(async () => {
setIsAutoEditingTitle(true);
await conversationAutoTitle(conversationId, true);
setIsAutoEditingTitle(false);
}, [conversationId]);
// Delete
const handleDeleteButtonShow = React.useCallback(() => setDeleteArmed(true), []);
const { onConversationDeleteNoConfirmation } = props;
const handleDeleteButtonShow = React.useCallback((event: React.MouseEvent) => {
// special case: if 'Shift' is pressed, delete immediately
if (event.shiftKey) {
event.stopPropagation();
onConversationDeleteNoConfirmation(conversationId);
return;
}
setDeleteArmed(true);
}, [conversationId, onConversationDeleteNoConfirmation]);
const handleDeleteButtonHide = React.useCallback(() => setDeleteArmed(false), []);
@@ -143,15 +172,14 @@ function ChatDrawerItem(props: {
if (deleteArmed) {
setDeleteArmed(false);
event.stopPropagation();
props.onConversationDelete(conversationId);
onConversationDeleteNoConfirmation(conversationId);
}
}, [conversationId, deleteArmed, props]);
}, [conversationId, deleteArmed, onConversationDeleteNoConfirmation]);
const textSymbol = SystemPurposes[systemPurposeId]?.symbol || '❓';
const progress = props.bottomBarBasis ? 100 * (searchFrequency ?? messageCount) / props.bottomBarBasis : 0;
const progress = props.bottomBarBasis ? 100 * (searchFrequency || messageCount) / props.bottomBarBasis : 0;
const titleRowComponent = React.useMemo(() => <>
@@ -178,8 +206,8 @@ function ChatDrawerItem(props: {
{/* Title */}
{!isEditingTitle ? (
<Typography
// level={isActive ? 'title-md' : 'body-md'}
// using Box to not reset the parent font scaling
<Box
onDoubleClick={handleTitleEditBegin}
sx={{
color: isActive ? 'text.primary' : 'text.secondary',
@@ -187,8 +215,8 @@ function ChatDrawerItem(props: {
}}
>
{/*{DEBUG_CONVERSATION_IDS && `${conversationId} - `}*/}
{title.trim() ? title : 'Chat'}{assistantTyping && '...'}
</Typography>
{title.trim() ? title : CHAT_NOVEL_TITLE}{assistantTyping && STREAM_TEXT_INDICATOR}
</Box>
) : (
<InlineTextarea
invertedColors
@@ -202,21 +230,24 @@ function ChatDrawerItem(props: {
/>
)}
{/* Display search frequency if it exists and is greater than 0 */}
{searchFrequency && searchFrequency > 0 && (
<Box sx={{ ml: 1 }}>
<Typography level='body-sm'>
{searchFrequency}
</Typography>
</Box>
)}
{/* Right text */}
{searchFrequency > 0 ? (
// Display search frequency if it exists and is greater than 0
<Typography level='body-sm'>
{searchFrequency}
</Typography>
) : (userFlagsSummary && props.showSymbols) ? (
<Typography sx={{ mr: '5px' }}>
{userFlagsSummary}
</Typography>
) : null}
</>, [assistantTyping, handleTitleEditBegin, handleTitleEditCancel, handleTitleEditChange, isActive, isEditingTitle, isNew, props.showSymbols, searchFrequency, textSymbol, title]);
</>, [assistantTyping, handleTitleEditBegin, handleTitleEditCancel, handleTitleEditChange, isActive, isEditingTitle, isNew, props.showSymbols, searchFrequency, textSymbol, title, userFlagsSummary]);
const progressBarFixedComponent = React.useMemo(() =>
progress > 0 && (
<Box sx={{
backgroundColor: 'neutral.softBg',
backgroundColor: 'neutral.softHoverBg',
position: 'absolute', left: 0, bottom: 0, width: progress + '%', height: 4,
}} />
), [progress]);
@@ -260,67 +291,74 @@ function ChatDrawerItem(props: {
{/* buttons row */}
{isActive && (
<Box sx={{ display: 'flex', gap: 1, minHeight: '2.25rem', alignItems: 'center' }}>
<ListItemDecorator />
<Box sx={{ display: 'flex', gap: 0.5, minHeight: '2.25rem', alignItems: 'center' }}>
{props.showSymbols && <ListItemDecorator />}
{/* Current Folder color, and change initiator */}
{(folder !== undefined) && <>
<Tooltip disableInteractive title={folder ? `Change Folder (${folder.title})` : 'Add to Folder'}>
{folder ? (
<IconButton size='sm' onClick={handleFolderChangeBegin}>
<FolderIcon style={{ color: folder.color || 'inherit' }} />
</IconButton>
) : (
<FadeInButton size='sm' onClick={handleFolderChangeBegin}>
<FolderOutlinedIcon />
{!deleteArmed && <>
{(folder !== undefined) && <>
<Tooltip disableInteractive title={folder ? `Change Folder (${folder.title})` : 'Add to Folder'}>
{folder ? (
<IconButton size='sm' onClick={handleFolderChangeBegin}>
<FolderIcon style={{ color: folder.color || 'inherit' }} />
</IconButton>
) : (
<FadeInButton size='sm' onClick={handleFolderChangeBegin}>
<FolderOutlinedIcon />
</FadeInButton>
)}
</Tooltip>
{/*<Divider orientation='vertical' sx={{ my: 1, opacity: 0.5 }} />*/}
</>}
<Tooltip disableInteractive title='Rename'>
<FadeInButton size='sm' disabled={isEditingTitle || isAutoEditingTitle} onClick={handleTitleEditBegin}>
<EditRoundedIcon />
</FadeInButton>
</Tooltip>
{!isNew && <>
<Tooltip disableInteractive title='Auto-Title'>
<FadeInButton size='sm' disabled={isEditingTitle || isAutoEditingTitle} onClick={handleTitleEditAuto}>
<AutoFixHighIcon />
</FadeInButton>
)}
</Tooltip>
</Tooltip>
{/*<Divider orientation='vertical' sx={{ my: 1, opacity: 0.5 }} />*/}
</>}
<Tooltip disableInteractive title='Branch'>
<FadeInButton size='sm' onClick={handleConversationBranch}>
<ForkRightIcon />
</FadeInButton>
</Tooltip>
<Tooltip disableInteractive title='Rename'>
<FadeInButton size='sm' disabled={isEditingTitle} onClick={handleTitleEditBegin}>
<EditIcon />
</FadeInButton>
</Tooltip>
<Tooltip disableInteractive title='Export Chat'>
<FadeInButton size='sm' onClick={handleConversationExport}>
<FileDownloadOutlinedIcon />
</FadeInButton>
</Tooltip>
</>}
{!isNew && <>
<Tooltip disableInteractive title='Auto-Title'>
<FadeInButton size='sm' disabled={isEditingTitle} onClick={handleTitleEditAuto}>
<AutoFixHighIcon />
</FadeInButton>
</Tooltip>
{/*<Divider orientation='vertical' sx={{ my: 1, opacity: 0.5 }} />*/}
<Tooltip disableInteractive title='Export Chat'>
<FadeInButton size='sm' onClick={handleConversationExport}>
<FileDownloadOutlinedIcon />
</FadeInButton>
</Tooltip>
</>}
{/* --> */}
<Box sx={{ flex: 1 }} />
{/* Delete [armed, arming] buttons */}
{!searchFrequency && <>
{deleteArmed && (
<Tooltip disableInteractive title='Confirm Deletion'>
<FadeInButton key='btn-del' variant='solid' color='success' size='sm' onClick={handleConversationDelete} sx={{ opacity: 1 }}>
<DeleteForeverIcon sx={{ color: 'danger.solidBg' }} />
</FadeInButton>
</Tooltip>
)}
<Tooltip disableInteractive title={deleteArmed ? 'Cancel Delete' : 'Delete'}>
<FadeInButton key='btn-arm' size='sm' onClick={deleteArmed ? handleDeleteButtonHide : handleDeleteButtonShow} sx={deleteArmed ? { opacity: 1 } : {}}>
{deleteArmed ? <CloseIcon /> : <DeleteOutlineIcon />}
{/*{!searchFrequency && <>*/}
{deleteArmed && (
<Tooltip disableInteractive title='Confirm Deletion'>
<FadeInButton key='btn-del' variant='solid' color='success' size='sm' onClick={handleConversationDelete} sx={{ opacity: 1, mr: 0.5 }}>
<DeleteForeverIcon sx={{ color: 'danger.solidBg' }} />
</FadeInButton>
</Tooltip>
</>}
)}
<Tooltip disableInteractive title={deleteArmed ? 'Cancel Delete' : 'Delete'}>
<FadeInButton key='btn-arm' size='sm' onClick={deleteArmed ? handleDeleteButtonHide : handleDeleteButtonShow} sx={deleteArmed ? { opacity: 1 } : {}}>
{deleteArmed ? <CloseRoundedIcon /> : <DeleteOutlineIcon />}
</FadeInButton>
</Tooltip>
{/*</>}*/}
</Box>
)}
@@ -342,7 +380,9 @@ function ChatDrawerItem(props: {
) : (
// Inactive Conversation - click to activate
<ListItem sx={{ '--ListItem-minHeight': '2.75rem' }}>
<ListItem
// sx={{ '--ListItem-minHeight': '2.75rem' }}
>
<ListItemButton
onClick={handleConversationActivate}
+113 -47
View File
@@ -1,22 +1,26 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { useShallow } from 'zustand/react/shallow';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, List } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
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, getConversation, useChatStore } from '~/common/state/store-chats';
import { createDMessage, DConversationId, DMessage, DMessageUserFlag, getConversation, messageToggleUserFlag, useChatStore } from '~/common/state/store-chats';
import { useBrowserTranslationWarning } from '~/common/components/useIsBrowserTranslating';
import { useCapabilityElevenLabs } from '~/common/components/useCapabilities';
import { useEphemerals } from '~/common/chats/EphemeralsStore';
import { useScrollToBottom } from '~/common/scroll-to-bottom/useScrollToBottom';
import { ChatMessageMemo } from './message/ChatMessage';
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 { useScrollToBottom } from './scroll-to-bottom/useScrollToBottom';
/**
@@ -24,10 +28,11 @@ import { useScrollToBottom } from './scroll-to-bottom/useScrollToBottom';
*/
export function ChatMessageList(props: {
conversationId: DConversationId | null,
conversationHandler: ConversationHandler | null,
capabilityHasT2I: boolean,
chatLLMContextTokens: number | null,
fitScreen: boolean,
isMessageSelectionMode: boolean,
isMobile: boolean,
onConversationBranch: (conversationId: DConversationId, messageId: string) => void,
onConversationExecuteHistory: (conversationId: DConversationId, history: DMessage[]) => Promise<void>,
onTextDiagram: (diagramConfig: DiagramConfig | null) => void,
@@ -46,7 +51,8 @@ export function ChatMessageList(props: {
const { notifyBooting } = useScrollToBottom();
const { openPreferencesTab } = useOptimaLayout();
const [showSystemMessages] = useChatShowSystemMessages();
const { conversationMessages, historyTokenCount, editMessage, deleteMessage, setMessages } = useChatStore(state => {
const optionalTranslationWarning = useBrowserTranslationWarning();
const { conversationMessages, historyTokenCount, editMessage, deleteMessage, setMessages } = useChatStore(useShallow(state => {
const conversation = state.conversations.find(conversation => conversation.id === props.conversationId);
return {
conversationMessages: conversation ? conversation.messages : [],
@@ -55,7 +61,8 @@ export function ChatMessageList(props: {
editMessage: state.editMessage,
setMessages: state.setMessages,
};
}, shallow);
}));
const ephemerals = useEphemerals(props.conversationHandler);
const { mayWork: isSpeakable } = useCapabilityElevenLabs();
// derived state
@@ -64,18 +71,14 @@ export function ChatMessageList(props: {
// text actions
const handleRunExample = React.useCallback(async (text: string) => {
conversationId && await onConversationExecuteHistory(conversationId, [...conversationMessages, createDMessage('user', text)]);
const handleRunExample = React.useCallback(async (examplePrompt: string) => {
conversationId && await onConversationExecuteHistory(conversationId, [...conversationMessages, createDMessage('user', examplePrompt)]);
}, [conversationId, conversationMessages, onConversationExecuteHistory]);
// message menu methods proxy
const handleConversationBranch = React.useCallback((messageId: string) => {
conversationId && onConversationBranch(conversationId, messageId);
}, [conversationId, onConversationBranch]);
const handleConversationRestartFrom = React.useCallback(async (messageId: string, offset: number) => {
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);
@@ -83,7 +86,35 @@ export function ChatMessageList(props: {
}
}, [conversationId, onConversationExecuteHistory]);
const handleConversationTruncate = React.useCallback((messageId: string) => {
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);
}
}
}
}, [conversationId, props.conversationHandler]);
const handleMessageBranch = React.useCallback((messageId: string) => {
conversationId && onConversationBranch(conversationId, messageId);
}, [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);
@@ -99,6 +130,16 @@ export function ChatMessageList(props: {
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);
}, [props.conversationHandler]);
const handleTextDiagram = React.useCallback(async (messageId: string, text: string) => {
conversationId && onTextDiagram({ conversationId: conversationId, messageId, text });
}, [conversationId, onTextDiagram]);
@@ -188,14 +229,19 @@ export function ChatMessageList(props: {
return (
<List sx={{
p: 0, ...(props.sx || {}),
// this makes sure that the the window is scrolled to the bottom (column-reverse)
display: 'flex',
flexDirection: 'column',
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',
}}>
{optionalTranslationWarning}
{props.isMessageSelectionMode && (
<MessagesSelectionHeader
hasSelected={selectedMessages.size > 0}
@@ -206,37 +252,57 @@ export function ChatMessageList(props: {
/>
)}
{filteredMessages.map((message, idx, { length: count }) =>
props.isMessageSelectionMode ? (
{filteredMessages.map((message, idx, { length: count }) => {
<CleanerMessage
key={'sel-' + message.id}
message={message}
remainingTokens={props.chatLLMContextTokens ? (props.chatLLMContextTokens - historyTokenCount) : undefined}
selected={selectedMessages.has(message.id)} onToggleSelected={handleSelectMessage}
/>
// 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;
) : (
return props.isMessageSelectionMode ? (
<ChatMessageMemo
key={'msg-' + message.id}
message={message}
diffPreviousText={message === diffTargetMessage ? diffPrevText : undefined}
isBottom={idx === count - 1}
isImagining={isImagining}
isMobile={props.isMobile}
isSpeaking={isSpeaking}
onConversationBranch={handleConversationBranch}
onConversationRestartFrom={handleConversationRestartFrom}
onConversationTruncate={handleConversationTruncate}
onMessageDelete={handleMessageDelete}
onMessageEdit={handleMessageEdit}
onTextDiagram={handleTextDiagram}
onTextImagine={handleTextImagine}
onTextSpeak={handleTextSpeak}
/>
<CleanerMessage
key={'sel-' + message.id}
message={message}
remainingTokens={props.chatLLMContextTokens ? (props.chatLLMContextTokens - historyTokenCount) : undefined}
selected={selectedMessages.has(message.id)} onToggleSelected={handleSelectMessage}
/>
),
) : (
<ChatMessageMemoOrNot
key={'msg-' + message.id}
message={message}
diffPreviousText={message === diffTargetMessage ? diffPrevText : undefined}
fitScreen={props.fitScreen}
isBottom={idx === count - 1}
isImagining={isImagining}
isSpeaking={isSpeaking}
onMessageAssistantFrom={handleMessageAssistantFrom}
onMessageBeam={handleMessageBeam}
onMessageBranch={handleMessageBranch}
onMessageDelete={handleMessageDelete}
onMessageEdit={handleMessageEdit}
onMessageToggleUserFlag={handleMessageToggleUserFlag}
onMessageTruncate={handleMessageTruncate}
// onReplyTo={handleReplyTo}
onTextDiagram={handleTextDiagram}
onTextImagine={capabilityHasT2I ? handleTextImagine : undefined}
onTextSpeak={isSpeakable ? handleTextSpeak : undefined}
/>
);
},
)}
{!!ephemerals.length && (
<Ephemerals
ephemerals={ephemerals}
conversationId={props.conversationId}
sx={{
mt: 'auto',
overflowY: 'auto',
minHeight: 64,
}}
/>
)}
</List>
@@ -127,11 +127,9 @@ export function ChatPageMenuItems(props: {
<ListDivider />
<MenuItem disabled={props.disableItems} onClick={handleToggleMessageSelectionMode}>
<MenuItem disabled={props.disableItems} onClick={handleToggleMessageSelectionMode} sx={props.isMessageSelectionMode ? { fontWeight: 'lg' } : {}}>
<ListItemDecorator>{props.isMessageSelectionMode ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />}</ListItemDecorator>
<span style={props.isMessageSelectionMode ? { fontWeight: 800 } : {}}>
Cleanup ...
</span>
Cleanup ...
</MenuItem>
<MenuItem disabled={props.disableItems} onClick={handleConversationFlatten}>
+23 -14
View File
@@ -1,12 +1,13 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { Box, Grid, IconButton, Sheet, styled, Typography } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
import CloseIcon from '@mui/icons-material/Close';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import { DConversationId, DEphemeral, useChatStore } from '~/common/state/store-chats';
import { lineHeightChatText } from '~/common/app.theme';
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';
const StateLine = styled(Typography)(({ theme }) => ({
@@ -16,7 +17,7 @@ const StateLine = styled(Typography)(({ theme }) => ({
fontSize: theme.fontSize.xs,
fontFamily: theme.fontFamily.code,
marginLeft: theme.spacing(1),
lineHeight: lineHeightChatText,
lineHeight: lineHeightChatTextMd,
}));
function isPrimitive(value: any): boolean {
@@ -75,6 +76,11 @@ function StateRenderer(props: { state: object }) {
function EphemeralItem({ conversationId, ephemeral }: { conversationId: string, ephemeral: DEphemeral }) {
const handleDelete = React.useCallback(() => {
ConversationsManager.getHandler(conversationId).ephemeralsStore.delete(ephemeral.id);
}, [conversationId, ephemeral.id]);
return <Box
sx={{
p: { xs: 1, md: 2 },
@@ -93,7 +99,7 @@ function EphemeralItem({ conversationId, ephemeral }: { conversationId: string,
{/* Left pane (console) */}
<Grid xs={12} md={ephemeral.state ? 6 : 12}>
<Typography fontSize='smaller' sx={{ overflowWrap: 'anywhere', whiteSpace: 'break-spaces', lineHeight: lineHeightChatText }}>
<Typography fontSize='smaller' sx={{ overflowWrap: 'anywhere', whiteSpace: 'break-spaces', lineHeight: lineHeightChatTextMd }}>
{ephemeral.text}
</Typography>
</Grid>
@@ -112,12 +118,12 @@ function EphemeralItem({ conversationId, ephemeral }: { conversationId: string,
{/* Close button (right of title) */}
<IconButton
size='sm'
onClick={() => useChatStore.getState().deleteEphemeral(conversationId, ephemeral.id)}
onClick={handleDelete}
sx={{
position: 'absolute', top: 8, right: 8,
opacity: { xs: 1, sm: 0.5 }, transition: 'opacity 0.3s',
}}>
<CloseIcon />
<CloseRoundedIcon />
</IconButton>
</Box>;
@@ -130,19 +136,22 @@ function EphemeralItem({ conversationId, ephemeral }: { conversationId: string,
// `);
export function Ephemerals(props: { conversationId: DConversationId | null, sx?: SxProps }) {
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 = useChatStore(state => {
// const conversation = state.conversations.find(conversation => conversation.id === props.conversationId);
// return conversation ? conversation.ephemerals : [];
// }, shallow);
if (!ephemerals?.length) return null;
const ephemerals = props.ephemerals;
// if (!ephemerals?.length) return null;
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',
@@ -85,7 +85,7 @@ export function CameraCaptureModal(props: {
}}>
{/* Top bar */}
<Sheet variant='solid' invertedColors sx={{ zIndex: 10, display: 'flex', justifyContent: 'space-between', p: 1 }}>
<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)}
@@ -116,7 +116,7 @@ export function CameraCaptureModal(props: {
{showInfo && !!info && <Typography
sx={{
position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 1,
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',
}}>
@@ -127,7 +127,7 @@ export function CameraCaptureModal(props: {
</Box>
{/* Bottom controls (zoom, ocr, download) & progress */}
<Sheet variant='soft' sx={{ display: 'flex', flexDirection: 'column', zIndex: 20, gap: 1, p: 1 }}>
<Sheet variant='soft' sx={{ display: 'flex', flexDirection: 'column', gap: 1, p: 1 }}>
{!!error && <InlineError error={error} />}
@@ -137,7 +137,7 @@ export function CameraCaptureModal(props: {
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'space-between' }}>
{/* Info */}
<IconButton size='lg' disabled={!info} variant='soft' onClick={() => setShowInfo(info => !info)} sx={{ zIndex: 30 }}>
<IconButton size='lg' disabled={!info} variant='soft' onClick={() => setShowInfo(info => !info)}>
<InfoIcon />
</IconButton>
{/*<Button disabled={ocrProgress !== null} fullWidth variant='solid' size='lg' onClick={handleVideoOCRClicked} sx={{ flex: 1, maxWidth: 260 }}>*/}
@@ -3,7 +3,7 @@ import * as React from 'react';
import { Box, MenuItem, Radio, Typography } from '@mui/joy';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { KeyStroke } from '~/common/components/KeyStroke';
import { KeyStroke, platformAwareKeystrokes } from '~/common/components/KeyStroke';
import { useUIPreferencesStore } from '~/common/state/store-ui';
import { ChatModeId } from '../../AppChat';
@@ -12,7 +12,9 @@ import { ChatModeId } from '../../AppChat';
interface ChatModeDescription {
label: string;
description: string | React.JSX.Element;
highlight?: boolean;
shortcut?: string;
hideOnDesktop?: boolean;
requiresTTI?: boolean;
}
@@ -21,9 +23,15 @@ const ChatModeItems: { [key in ChatModeId]: ChatModeDescription } = {
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: 'Appends a message',
description: 'Append a message',
shortcut: 'Alt + Enter',
},
'generate-image': {
@@ -32,8 +40,8 @@ const ChatModeItems: { [key in ChatModeId]: ChatModeDescription } = {
requiresTTI: true,
},
'generate-react': {
label: 'Reason + Act · α',
description: 'Answers questions in multiple steps',
label: 'Reason + Act', // · α
description: 'Answer questions in multiple steps',
},
};
@@ -45,8 +53,11 @@ function fixNewLineShortcut(shortcut: string, enterIsNewLine: boolean) {
}
export function ChatModeMenu(props: {
anchorEl: HTMLAnchorElement | null, onClose: () => void,
chatModeId: ChatModeId, onSetChatModeId: (chatMode: ChatModeId) => void
isMobile: boolean,
anchorEl: HTMLAnchorElement | null,
onClose: () => void,
chatModeId: ChatModeId,
onSetChatModeId: (chatMode: ChatModeId) => void,
capabilityHasTTI: boolean,
}) {
@@ -68,16 +79,17 @@ export function ChatModeMenu(props: {
{/* 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 checked={key === props.chatModeId} />
<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={fixNewLineShortcut((key === props.chatModeId) ? 'ENTER' : data.shortcut ? data.shortcut : 'ENTER', enterIsNewline)} />
<KeyStroke combo={platformAwareKeystrokes(fixNewLineShortcut((key === props.chatModeId) ? 'ENTER' : data.shortcut ? data.shortcut : 'ENTER', enterIsNewline))} />
)}
</Box>
</MenuItem>)}
+243 -113
View File
@@ -1,7 +1,6 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { useShallow } from 'zustand/react/shallow';
import { fileOpen, FileWithHandle } from 'browser-fs-access';
import { keyframes } from '@emotion/react';
import { Box, Button, ButtonGroup, Card, Dropdown, Grid, IconButton, Menu, MenuButton, MenuItem, Textarea, Tooltip, Typography } from '@mui/joy';
import { ColorPaletteProp, SxProps, VariantProp } from '@mui/joy/styles/types';
@@ -10,7 +9,7 @@ import AttachFileIcon from '@mui/icons-material/AttachFile';
import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';
import AutoModeIcon from '@mui/icons-material/AutoMode';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import FormatPaintIcon from '@mui/icons-material/FormatPaint';
import FormatPaintTwoToneIcon from '@mui/icons-material/FormatPaintTwoTone';
import PsychologyIcon from '@mui/icons-material/Psychology';
import SendIcon from '@mui/icons-material/Send';
import StopOutlinedIcon from '@mui/icons-material/StopOutlined';
@@ -23,27 +22,35 @@ import type { DLLM } from '~/modules/llms/store-llms';
import type { LLMOptionsOpenAI } from '~/modules/llms/vendors/openai/openai.vendor';
import { useBrowseCapability } from '~/modules/browse/store-module-browsing';
import { DConversationId, useChatStore } from '~/common/state/store-chats';
import { ChatBeamIcon } from '~/common/components/icons/ChatBeamIcon';
import { ConversationsManager } from '~/common/chats/ConversationsManager';
import { PreferencesTab, useOptimaLayout } from '~/common/layout/optima/useOptimaLayout';
import { SpeechResult, useSpeechRecognition } from '~/common/components/useSpeechRecognition';
import { animationEnterBelow } from '~/common/util/animUtils';
import { conversationTitle, DConversationId, DMessageMetadata, getConversation, useChatStore } from '~/common/state/store-chats';
import { countModelTokens } from '~/common/util/token-counter';
import { isMacUser } from '~/common/util/pwaUtils';
import { launchAppCall } from '~/common/app.routes';
import { lineHeightTextarea } from '~/common/app.theme';
import { lineHeightTextareaMd } from '~/common/app.theme';
import { platformAwareKeystrokes } from '~/common/components/KeyStroke';
import { playSoundUrl } from '~/common/util/audioUtils';
import { supportsClipboardRead } from '~/common/util/clipboardUtils';
import { supportsScreenCapture } from '~/common/util/screenCaptureUtils';
import { useAppStateStore } from '~/common/state/store-appstate';
import { useChatOverlayStore } from '~/common/chats/store-chat-overlay-vanilla';
import { useDebouncer } from '~/common/components/useDebouncer';
import { useGlobalShortcut } from '~/common/components/useGlobalShortcut';
import { useUICounter, useUIPreferencesStore } from '~/common/state/store-ui';
import { useUXLabsStore } from '~/common/state/store-ux-labs';
import type { ActileItem, ActileProvider } from './actile/ActileProvider';
import type { ActileItem } from './actile/ActileProvider';
import { providerCommands } from './actile/providerCommands';
import { providerStarredMessage, StarredMessageItem } from './actile/providerStarredMessage';
import { useActileManager } from './actile/useActileManager';
import type { AttachmentId } from './attachments/store-attachments';
import { Attachments } from './attachments/Attachments';
import { getTextBlockText, useLLMAttachments } from './attachments/useLLMAttachments';
import { getSingleTextBlockText, useLLMAttachments } from './attachments/useLLMAttachments';
import { useAttachments } from './attachments/useAttachments';
import type { ComposerOutputMultiPart } from './composer.types';
@@ -51,27 +58,36 @@ import { ButtonAttachCameraMemo, useCameraCaptureModal } from './buttons/ButtonA
import { ButtonAttachClipboardMemo } from './buttons/ButtonAttachClipboard';
import { ButtonAttachFileMemo } from './buttons/ButtonAttachFile';
import { ButtonAttachScreenCaptureMemo } from './buttons/ButtonAttachScreenCapture';
import { ButtonCall } from './buttons/ButtonCall';
import { ButtonBeamMemo } from './buttons/ButtonBeam';
import { ButtonCallMemo } from './buttons/ButtonCall';
import { ButtonMicContinuationMemo } from './buttons/ButtonMicContinuation';
import { ButtonMicMemo } from './buttons/ButtonMic';
import { ButtonMultiChat } from './buttons/ButtonMultiChat';
import { ButtonMultiChatMemo } from './buttons/ButtonMultiChat';
import { ButtonOptionsDraw } from './buttons/ButtonOptionsDraw';
import { ChatModeMenu } from './ChatModeMenu';
import { ReplyToBubble } from '../message/ReplyToBubble';
import { TokenBadgeMemo } from './TokenBadge';
import { TokenProgressbarMemo } from './TokenProgressbar';
import { useComposerStartupText } from './store-composer';
export const animationStopEnter = keyframes`
from {
opacity: 0;
transform: translateY(8px)
}
to {
opacity: 1;
transform: translateY(0)
}
`;
const zIndexComposerOverlayDrop = 10;
const zIndexComposerOverlayMic = 20;
const dropperCardSx: SxProps = {
display: 'none',
position: 'absolute', bottom: 0, left: 0, right: 0, top: 0,
alignItems: 'center', justifyContent: 'center', gap: 2,
border: '2px dashed',
borderRadius: 'xs',
boxShadow: 'none',
zIndex: zIndexComposerOverlayDrop,
} as const;
const dropppedCardDraggingSx: SxProps = {
...dropperCardSx,
display: 'flex',
} as const;
/**
@@ -85,13 +101,14 @@ export function Composer(props: {
capabilityHasT2I: boolean;
isMulticast: boolean | null;
isDeveloperMode: boolean;
onAction: (chatModeId: ChatModeId, conversationId: DConversationId, multiPartMessage: ComposerOutputMultiPart) => boolean;
onAction: (conversationId: DConversationId, chatModeId: ChatModeId, multiPartMessage: ComposerOutputMultiPart, metadata?: DMessageMetadata) => boolean;
onTextImagine: (conversationId: DConversationId, text: string) => void;
setIsMulticast: (on: boolean) => void;
sx?: SxProps;
}) {
// state
const [chatModeId, setChatModeId] = React.useState<ChatModeId>('generate-text');
const [composeText, debouncedText, setComposeText] = useDebouncer('', 300, 1200, true);
const [micContinuation, setMicContinuation] = React.useState(false);
const [speechInterimResult, setSpeechInterimResult] = React.useState<SpeechResult | null>(null);
@@ -100,16 +117,19 @@ export function Composer(props: {
// external state
const { openPreferencesTab /*, setIsFocusedMode*/ } = useOptimaLayout();
const { labsAttachScreenCapture, labsCameraDesktop } = useUXLabsStore(state => ({
const { labsAttachScreenCapture, labsCameraDesktop, labsShowCost } = useUXLabsStore(useShallow(state => ({
labsAttachScreenCapture: state.labsAttachScreenCapture,
labsCameraDesktop: state.labsCameraDesktop,
}), shallow);
labsShowCost: state.labsShowCost,
})));
const timeToShowTips = useAppStateStore(state => state.usageCount > 2);
const { novel: explainShiftEnter, touch: touchShiftEnter } = useUICounter('composer-shift-enter');
const [chatModeId, setChatModeId] = React.useState<ChatModeId>('generate-text');
const { novel: explainAltEnter, touch: touchAltEnter } = useUICounter('composer-alt-enter');
const { novel: explainCtrlEnter, touch: touchCtrlEnter } = useUICounter('composer-ctrl-enter');
const [startupText, setStartupText] = useComposerStartupText();
const enterIsNewline = useUIPreferencesStore(state => state.enterIsNewline);
const chatMicTimeoutMs = useChatMicTimeoutMsValue();
const { assistantAbortible, systemPurposeId, tokenCount: _historyTokenCount, stopTyping } = useChatStore(state => {
const { assistantAbortible, systemPurposeId, tokenCount: _historyTokenCount, stopTyping } = useChatStore(useShallow(state => {
const conversation = state.conversations.find(_c => _c.id === props.conversationId);
return {
assistantAbortible: conversation ? !!conversation.abortController : false,
@@ -117,11 +137,18 @@ export function Composer(props: {
tokenCount: conversation ? conversation.tokenCount : 0,
stopTyping: state.stopTyping,
};
}, shallow);
}));
const { inComposer: browsingInComposer } = useBrowseCapability();
const { attachAppendClipboardItems, attachAppendDataTransfer, attachAppendFile, attachments: _attachments, clearAttachments, removeAttachment } =
const { attachAppendClipboardItems, attachAppendDataTransfer, attachAppendEgoMessage, attachAppendFile, attachments: _attachments, clearAttachments, removeAttachment } =
useAttachments(browsingInComposer && !composeText.startsWith('/'));
// external overlay state (extra conversationId-dependent state)
const conversationHandler = props.conversationId ? ConversationsManager.getHandler(props.conversationId) : null;
const conversationOverlayStore = conversationHandler?.getOverlayStore() ?? null;
const { replyToGenerateText } = useChatOverlayStore(conversationOverlayStore, useShallow(store => ({
replyToGenerateText: chatModeId === 'generate-text' ? store.replyToText?.trim() || null : null,
})));
// derived state
@@ -146,6 +173,8 @@ export function Composer(props: {
const tokensHistory = _historyTokenCount;
const tokensReponseMax = (props.chatLLM?.options as LLMOptionsOpenAI /* FIXME: BIG ASSUMPTION */)?.llmResponseTokens || 0;
const tokenLimit = props.chatLLM?.contextTokens || 0;
const tokenPriceIn = props.chatLLM?.pricing?.chatIn;
const tokenPriceOut = props.chatLLM?.pricing?.chatOut;
// Effect: load initial text if queued up (e.g. by /link/share_targe)
@@ -157,6 +186,18 @@ export function Composer(props: {
}, [setComposeText, setStartupText, startupText]);
// Overlay actions
const handleReplyToCleared = React.useCallback(() => {
conversationOverlayStore?.getState().setReplyToText(null);
}, [conversationOverlayStore]);
React.useEffect(() => {
if (replyToGenerateText)
setTimeout(() => props.composerTextAreaRef.current?.focus(), 1 /* prevent focus theft */);
}, [replyToGenerateText, props.composerTextAreaRef]);
// Primary button
const { conversationId, onAction } = props;
@@ -165,56 +206,75 @@ export function Composer(props: {
if (!conversationId)
return false;
// get attachments
const multiPartMessage = llmAttachments.getAttachmentsOutputs(composerText || null);
// get the multipart output including all attachments
const multiPartMessage = llmAttachments.collapseWithAttachments(composerText || null);
if (!multiPartMessage.length)
return false;
// metadata
const metadata = replyToGenerateText ? { inReplyToText: replyToGenerateText } : undefined;
// send the message
const enqueued = onAction(_chatModeId, conversationId, multiPartMessage);
const enqueued = onAction(conversationId, _chatModeId, multiPartMessage, metadata);
if (enqueued) {
clearAttachments();
handleReplyToCleared();
setComposeText('');
}
return enqueued;
}, [clearAttachments, conversationId, llmAttachments, onAction, setComposeText]);
}, [clearAttachments, conversationId, handleReplyToCleared, llmAttachments, onAction, replyToGenerateText, setComposeText]);
const handleSendClicked = () => handleSendAction(chatModeId, composeText);
const handleSendClicked = React.useCallback(() => {
handleSendAction(chatModeId, composeText);
}, [chatModeId, composeText, handleSendAction]);
const handleStopClicked = () => props.conversationId && stopTyping(props.conversationId);
const handleSendTextBeamClicked = React.useCallback(() => {
handleSendAction('generate-text-beam', composeText);
}, [composeText, handleSendAction]);
const handleStopClicked = React.useCallback(() => {
!!props.conversationId && stopTyping(props.conversationId);
}, [props.conversationId, stopTyping]);
// Secondary buttons
const handleCallClicked = () => props.conversationId && systemPurposeId && launchAppCall(props.conversationId, systemPurposeId);
const handleCallClicked = React.useCallback(() => {
props.conversationId && systemPurposeId && launchAppCall(props.conversationId, systemPurposeId);
}, [props.conversationId, systemPurposeId]);
const handleDrawOptionsClicked = () => openPreferencesTab(PreferencesTab.Draw);
const handleDrawOptionsClicked = React.useCallback(() => {
openPreferencesTab(PreferencesTab.Draw);
}, [openPreferencesTab]);
const handleTextImagineClicked = () => {
const handleTextImagineClicked = React.useCallback(() => {
if (!composeText || !props.conversationId)
return;
props.onTextImagine(props.conversationId, composeText);
setComposeText('');
};
}, [composeText, props, setComposeText]);
// Mode menu
const handleModeSelectorHide = () => setChatModeMenuAnchor(null);
const handleModeSelectorHide = React.useCallback(() => {
setChatModeMenuAnchor(null);
}, []);
const handleModeSelectorShow = (event: React.MouseEvent<HTMLAnchorElement>) =>
const handleModeSelectorShow = React.useCallback((event: React.MouseEvent<HTMLAnchorElement>) => {
setChatModeMenuAnchor(anchor => anchor ? null : event.currentTarget);
}, []);
const handleModeChange = (_chatModeId: ChatModeId) => {
const handleModeChange = React.useCallback((_chatModeId: ChatModeId) => {
handleModeSelectorHide();
setChatModeId(_chatModeId);
};
}, [handleModeSelectorHide]);
// Actiles
const onActileCommandSelect = React.useCallback((item: ActileItem) => {
const onActileCommandPaste = React.useCallback((item: ActileItem) => {
if (props.composerTextAreaRef.current) {
const textArea = props.composerTextAreaRef.current;
const currentText = textArea.value;
@@ -235,9 +295,22 @@ export function Composer(props: {
}
}, [props.composerTextAreaRef, setComposeText]);
const actileProviders: ActileProvider[] = React.useMemo(() => {
return [providerCommands(onActileCommandSelect)];
}, [onActileCommandSelect]);
const onActileMessageAttach = React.useCallback((item: StarredMessageItem) => {
// get the message
const conversation = getConversation(item.conversationId);
const messageToAttach = conversation?.messages.find(m => m.id === item.messageId);
if (conversation && messageToAttach && messageToAttach.text) {
// Testing with this serialization for LLM. Note it will still be within a multi-part message,
// this could be in a titled markdown block. Don't know yet how this fares with different LLMs.
const chatTitle = conversationTitle(conversation);
const textPlain = `---\nitem id: ${messageToAttach.id}\ncontext title: ${chatTitle}\n---\n${messageToAttach.text.trim()}\n`;
void attachAppendEgoMessage('context-item', textPlain, `${chatTitle} > ${messageToAttach.text.slice(0, 10)}...`);
}
}, [attachAppendEgoMessage]);
const actileProviders = React.useMemo(() => {
return [providerCommands(onActileCommandPaste), providerStarredMessage(onActileMessageAttach)];
}, [onActileCommandPaste, onActileMessageAttach]);
const { actileComponent, actileInterceptKeydown, actileInterceptTextChange } = useActileManager(actileProviders, props.composerTextAreaRef);
@@ -257,9 +330,17 @@ export function Composer(props: {
// Enter: primary action
if (e.key === 'Enter') {
// Alt: append the message instead
// Alt (Windows) or Option (Mac) + Enter: append the message instead of sending it
if (e.altKey) {
handleSendAction('append-user', composeText);
if (handleSendAction('append-user', composeText))
touchAltEnter();
return e.preventDefault();
}
// Ctrl (Windows) or Command (Mac) + Enter: send for beaming
if ((isMacUser && e.metaKey && !e.ctrlKey) || (!isMacUser && e.ctrlKey && !e.metaKey)) {
if (handleSendAction('generate-text-beam', composeText))
touchCtrlEnter();
return e.preventDefault();
}
@@ -273,7 +354,7 @@ export function Composer(props: {
}
}
}, [actileInterceptKeydown, assistantAbortible, chatModeId, composeText, enterIsNewline, handleSendAction, touchShiftEnter]);
}, [actileInterceptKeydown, assistantAbortible, chatModeId, composeText, enterIsNewline, handleSendAction, touchAltEnter, touchCtrlEnter, touchShiftEnter]);
// Focus mode
@@ -331,7 +412,9 @@ export function Composer(props: {
toggleRecording();
}, [micContinuation, micIsRunning, toggleRecording]);
const handleToggleMicContinuation = () => setMicContinuation(continued => !continued);
const handleToggleMicContinuation = React.useCallback(() => {
setMicContinuation(continued => !continued);
}, []);
React.useEffect(() => {
// autostart the microphone if the assistant stopped typing
@@ -372,8 +455,8 @@ export function Composer(props: {
const handleAttachmentInlineText = React.useCallback((attachmentId: AttachmentId) => {
setComposeText(currentText => {
const attachmentOutputs = llmAttachments.getAttachmentOutputs(currentText, attachmentId);
const inlinedText = getTextBlockText(attachmentOutputs) || '';
const inlinedMultiPart = llmAttachments.collapseWithAttachment(currentText, attachmentId);
const inlinedText = getSingleTextBlockText(inlinedMultiPart) || '';
removeAttachment(attachmentId);
return inlinedText;
});
@@ -381,8 +464,8 @@ export function Composer(props: {
const handleAttachmentsInlineText = React.useCallback(() => {
setComposeText(currentText => {
const attachmentsOutputs = llmAttachments.getAttachmentsOutputs(currentText);
const inlinedText = getTextBlockText(attachmentsOutputs) || '';
const inlinedMultiPart = llmAttachments.collapseWithAttachments(currentText);
const inlinedText = getSingleTextBlockText(inlinedMultiPart) || '';
clearAttachments();
return inlinedText;
});
@@ -435,26 +518,54 @@ export function Composer(props: {
const isText = chatModeId === 'generate-text';
const isTextBeam = chatModeId === 'generate-text-beam';
const isAppend = chatModeId === 'append-user';
const isChat = isText || isAppend;
const isReAct = chatModeId === 'generate-react';
const isDraw = chatModeId === 'generate-image';
const buttonColor: ColorPaletteProp = assistantAbortible
? 'warning'
: isReAct ? 'success' : isDraw ? 'warning' : 'primary';
const showChatReplyTo = !!replyToGenerateText;
const showChatExtras = isText && !showChatReplyTo;
const buttonVariant: VariantProp = (isAppend || (isMobile && isTextBeam)) ? 'outlined' : 'solid';
const buttonColor: ColorPaletteProp =
assistantAbortible ? 'warning'
: isReAct ? 'success'
: isTextBeam ? 'primary'
: isDraw ? 'warning'
: 'primary';
const buttonText =
isAppend ? 'Write'
: isReAct ? 'ReAct'
: isTextBeam ? 'Beam'
: isDraw ? 'Draw'
: 'Chat';
const buttonIcon =
micContinuation ? <AutoModeIcon />
: isAppend ? <SendIcon sx={{ fontSize: 18 }} />
: isReAct ? <PsychologyIcon />
: isTextBeam ? <ChatBeamIcon /> /* <GavelIcon /> */
: isDraw ? <FormatPaintTwoToneIcon />
: <TelegramIcon />;
let textPlaceholder: string =
isDraw
? 'Describe an idea or a drawing...'
: isReAct
? 'Multi-step reasoning question...'
: props.isDeveloperMode
? 'Chat with me' + (isDesktop ? ' · drop source' : '') + ' · attach code...'
: props.capabilityHasT2I
? 'Chat · /react · /draw · drop files...'
: 'Chat · /react · drop files...';
if (isDesktop && explainShiftEnter)
textPlaceholder += !enterIsNewline ? '\nShift+Enter to add a new line' : '\nShift+Enter to send';
isDraw ? 'Describe an idea or a drawing...'
: isReAct ? 'Multi-step reasoning question...'
: isTextBeam ? 'Beam: combine the smarts of models...'
: showChatReplyTo ? 'Chat about this'
: props.isDeveloperMode ? 'Chat with me' + (isDesktop ? ' · drop source' : '') + ' · attach code...'
: props.capabilityHasT2I ? 'Chat · /beam · /draw · drop files...'
: 'Chat · /react · drop files...';
if (isDesktop && timeToShowTips) {
if (explainShiftEnter)
textPlaceholder += !enterIsNewline ? '\n\n💡 Shift + Enter to add a new line' : '\n\n💡 Shift + Enter to send';
else if (explainAltEnter)
textPlaceholder += platformAwareKeystrokes('\n\n💡 Tip: Alt + Enter to just append the message');
else if (explainCtrlEnter)
textPlaceholder += platformAwareKeystrokes('\n\n💡 Tip: Ctrl + Enter to beam');
}
return (
<Box aria-label='User Message' component='section' sx={props.sx}>
@@ -496,7 +607,7 @@ export function Composer(props: {
</Dropdown>
{/* [Mobile] MultiChat button */}
{props.isMulticast !== null && <ButtonMultiChat isMobile multiChat={props.isMulticast} onSetMultiChat={props.setIsMulticast} />}
{props.isMulticast !== null && <ButtonMultiChatMemo isMobile multiChat={props.isMulticast} onSetMultiChat={props.setIsMulticast} />}
</> : <>
@@ -521,9 +632,10 @@ export function Composer(props: {
{/* [ Textarea + Overlays + Mic | Attachments ] */}
<Box sx={{
minWidth: 200, // enable X-scrolling (resetting any possible minWidth due to the attachments)
flexGrow: 1,
display: 'grid', gap: 1,
// layout
display: 'flex', flexDirection: 'column', gap: 1,
minWidth: 200, // flex: enable X-scrolling (resetting any possible minWidth due to the attachments)
}}>
{/* Textarea + Mic buttons + Mic/Drag overlay */}
@@ -536,7 +648,7 @@ export function Composer(props: {
variant='outlined'
color={isDraw ? 'warning' : isReAct ? 'success' : undefined}
autoFocus
minRows={isMobile ? 4 : 5}
minRows={isMobile ? 4 : showChatReplyTo ? 4 : 5}
maxRows={isMobile ? 8 : 10}
placeholder={textPlaceholder}
value={composeText}
@@ -547,6 +659,7 @@ export function Composer(props: {
onPasteCapture={handleAttachCtrlV}
// onFocusCapture={handleFocusModeOn}
// onBlurCapture={handleFocusModeOff}
endDecorator={showChatReplyTo && <ReplyToBubble replyToText={replyToGenerateText} onClear={handleReplyToCleared} className='reply-to-bubble' />}
slotProps={{
textarea: {
enterKeyHint: enterIsNewline ? 'enter' : 'send',
@@ -559,16 +672,16 @@ export function Composer(props: {
}}
sx={{
backgroundColor: 'background.level1',
'&:focus-within': { backgroundColor: 'background.popup' },
lineHeight: lineHeightTextarea,
'&:focus-within': { backgroundColor: 'background.popup', '.reply-to-bubble': { backgroundColor: 'background.popup' } },
lineHeight: lineHeightTextareaMd,
}} />
{tokenLimit > 0 && (tokensComposer > 0 || (tokensHistory + tokensReponseMax) > 0) && (
<TokenProgressbarMemo direct={tokensComposer} history={tokensHistory} responseMax={tokensReponseMax} limit={tokenLimit} />
{!showChatReplyTo && tokenLimit > 0 && (tokensComposer > 0 || (tokensHistory + tokensReponseMax) > 0) && (
<TokenProgressbarMemo direct={tokensComposer} history={tokensHistory} responseMax={tokensReponseMax} limit={tokenLimit} tokenPriceIn={tokenPriceIn} tokenPriceOut={tokenPriceOut} />
)}
{!!tokenLimit && (
<TokenBadgeMemo direct={tokensComposer} history={tokensHistory} responseMax={tokensReponseMax} limit={tokenLimit} showExcess absoluteBottomRight />
{!showChatReplyTo && tokenLimit > 0 && (
<TokenBadgeMemo direct={tokensComposer} history={tokensHistory} responseMax={tokensReponseMax} limit={tokenLimit} tokenPriceIn={tokenPriceIn} tokenPriceOut={tokenPriceOut} showCost={labsShowCost} showExcess absoluteBottomRight />
)}
</Box>
@@ -577,7 +690,7 @@ export function Composer(props: {
{isSpeechEnabled && (
<Box sx={{
position: 'absolute', top: 0, right: 0,
zIndex: 21,
zIndex: zIndexComposerOverlayMic + 1,
mt: isDesktop ? 1 : 0.25,
mr: isDesktop ? 1 : 0.25,
display: 'flex', flexDirection: 'column', gap: isDesktop ? 1 : 0.25,
@@ -596,20 +709,32 @@ export function Composer(props: {
{/* overlay: Mic */}
{micIsRunning && (
<Card
color='primary' variant='soft' invertedColors
color='primary' variant='soft'
sx={{
display: 'flex',
position: 'absolute', bottom: 0, left: 0, right: 0, top: 0,
// alignItems: 'center', justifyContent: 'center',
border: '1px solid',
borderColor: 'primary.solidBg',
borderRadius: 'sm',
zIndex: 20,
px: 1.5, py: 1,
zIndex: zIndexComposerOverlayMic,
pl: 1.5,
pr: { xs: 1.5, md: 5 },
py: 0.625,
overflow: 'auto',
}}>
<Typography sx={{
color: 'primary.softColor',
lineHeight: lineHeightTextareaMd,
'& .interim': {
textDecoration: 'underline',
textDecorationThickness: '0.25em',
textDecorationColor: 'rgba(var(--joy-palette-primary-mainChannel) / 0.1)',
textDecorationSkipInk: 'none',
textUnderlineOffset: '0.25em',
},
}}>
<Typography>
{speechInterimResult.transcript}{' '}
<span style={{ opacity: 0.8 }}>{speechInterimResult.interimTranscript}</span>
<span className={speechInterimResult.interimTranscript !== 'Listening...' ? 'interim' : undefined}>{speechInterimResult.interimTranscript}</span>
</Typography>
</Card>
)}
@@ -617,16 +742,8 @@ export function Composer(props: {
{/* overlay: Drag & Drop*/}
{!isMobile && (
<Card
color='success' variant='soft' invertedColors
sx={{
display: isDragging ? 'flex' : 'none',
position: 'absolute', bottom: 0, left: 0, right: 0, top: 0,
alignItems: 'center', justifyContent: 'center', gap: 2,
border: '2px dashed',
borderRadius: 'xs',
boxShadow: 'none',
zIndex: 10,
}}
color={isDragging ? 'success' : undefined} variant={isDragging ? 'soft' : undefined} invertedColors={isDragging}
sx={isDragging ? dropppedCardDraggingSx : dropperCardSx}
onDragLeave={handleOverlayDragLeave}
onDragOver={handleOverlayDragOver}
onDrop={handleOverlayDrop}
@@ -654,14 +771,15 @@ export function Composer(props: {
<Grid xs={12} md={3}>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1, height: '100%' }}>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1, height: '100%' } as const}>
{/* This row is here only for the [mobile] bottom-start corner item */}
<Box sx={{ display: 'flex' }}>
{/* [mobile] This row is here only for the [mobile] bottom-start corner item */}
{/* [desktop] This column arrangement will have the [desktop] beam button right under call */}
<Box sx={isMobile ? { display: 'flex' } : { display: 'grid', gap: 1 }}>
{/* [mobile] bottom-corner secondary button */}
{isMobile && (isChat
? <ButtonCall isMobile disabled={!props.conversationId || !chatLLMId} onClick={handleCallClicked} sx={{ mr: { xs: 1, md: 2 } }} />
{isMobile && (showChatExtras
? <ButtonCallMemo isMobile disabled={!props.conversationId || !chatLLMId} onClick={handleCallClicked} />
: isDraw
? <ButtonOptionsDraw isMobile onClick={handleDrawOptionsClicked} sx={{ mr: { xs: 1, md: 2 } }} />
: <IconButton disabled sx={{ mr: { xs: 1, md: 2 } }} />
@@ -669,11 +787,12 @@ export function Composer(props: {
{/* Responsive Send/Stop buttons */}
<ButtonGroup
variant={isAppend ? 'outlined' : 'solid'}
variant={buttonVariant}
color={buttonColor}
sx={{
flexGrow: 1,
boxShadow: isMobile ? 'none' : `0 8px 24px -4px rgb(var(--joy-palette-${buttonColor}-mainChannel) / 20%)`,
backgroundColor: (isMobile && buttonVariant === 'outlined') ? 'background.popup' : undefined,
boxShadow: (isMobile && buttonVariant !== 'outlined') ? 'none' : `0 8px 24px -4px rgb(var(--joy-palette-${buttonColor}-mainChannel) / 20%)`,
}}
>
{!assistantAbortible ? (
@@ -681,16 +800,10 @@ export function Composer(props: {
key='composer-act'
fullWidth disabled={!props.conversationId || !chatLLMId || !llmAttachments.isOutputAttacheable}
onClick={handleSendClicked}
endDecorator={
micContinuation ? <AutoModeIcon /> :
isAppend ? <SendIcon sx={{ fontSize: 18 }} /> :
isReAct ? <PsychologyIcon /> :
isDraw ? <FormatPaintIcon />
: <TelegramIcon />
}
endDecorator={buttonIcon}
sx={{ '--Button-gap': '1rem' }}
>
{micContinuation && 'Voice '}
{isAppend ? 'Write' : isReAct ? 'ReAct' : isDraw ? 'Draw' : 'Chat'}
{micContinuation && 'Voice '}{buttonText}
</Button>
) : (
<Button
@@ -698,12 +811,19 @@ export function Composer(props: {
fullWidth variant='soft' disabled={!props.conversationId}
onClick={handleStopClicked}
endDecorator={<StopOutlinedIcon sx={{ fontSize: 18 }} />}
sx={{ animation: `${animationStopEnter} 0.1s ease-out` }}
sx={{ animation: `${animationEnterBelow} 0.1s ease-out` }}
>
Stop
</Button>
)}
{/* [Beam] Open Beam */}
{/*{isText && <Tooltip title='Open Beam'>*/}
{/* <IconButton variant='outlined' disabled={!props.conversationId || !chatLLMId} onClick={handleSendTextBeamClicked}>*/}
{/* <ChatBeamIcon />*/}
{/* </IconButton>*/}
{/*</Tooltip>}*/}
{/* [Draw] Imagine */}
{isDraw && !!composeText && <Tooltip title='Imagine a drawing prompt'>
<IconButton variant='outlined' disabled={!props.conversationId || !chatLLMId} onClick={handleTextImagineClicked}>
@@ -721,16 +841,25 @@ export function Composer(props: {
</IconButton>
</ButtonGroup>
{/* [desktop] secondary-top buttons */}
{isDesktop && showChatExtras && !assistantAbortible && (
<ButtonBeamMemo
disabled={!props.conversationId || !chatLLMId || !llmAttachments.isOutputAttacheable}
hasContent={!!composeText}
onClick={handleSendTextBeamClicked}
/>
)}
</Box>
{/* [desktop] Multicast switch (under the Chat button) */}
{isDesktop && props.isMulticast !== null && <ButtonMultiChat multiChat={props.isMulticast} onSetMultiChat={props.setIsMulticast} />}
{isDesktop && props.isMulticast !== null && <ButtonMultiChatMemo multiChat={props.isMulticast} onSetMultiChat={props.setIsMulticast} />}
{/* [desktop] secondary buttons (aligned to bottom for now, and mutually exclusive) */}
{isDesktop && <Box sx={{ mt: 'auto', display: 'grid', gap: 1 }}>
{/* [desktop] Call secondary button */}
{isChat && <ButtonCall disabled={!props.conversationId || !chatLLMId} onClick={handleCallClicked} />}
{showChatExtras && <ButtonCallMemo disabled={!props.conversationId || !chatLLMId} onClick={handleCallClicked} />}
{/* [desktop] Draw Options secondary button */}
{isDraw && <ButtonOptionsDraw onClick={handleDrawOptionsClicked} />}
@@ -745,6 +874,7 @@ export function Composer(props: {
{/* Mode selector */}
{!!chatModeMenuAnchor && (
<ChatModeMenu
isMobile={isMobile}
anchorEl={chatModeMenuAnchor} onClose={handleModeSelectorHide}
chatModeId={chatModeId} onSetChatModeId={handleModeChange}
capabilityHasTTI={props.capabilityHasT2I}
+110 -45
View File
@@ -3,41 +3,81 @@ import * as React from 'react';
import { Badge, Box, ColorPaletteProp, Tooltip } from '@mui/joy';
function alignRight(value: number, columnSize: number = 7) {
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): {
color: ColorPaletteProp, message: string, remainingTokens: number
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 usedTokens = directTokens + (historyTokens || 0) + (responseMaxTokens || 0);
const remainingTokens = tokenLimit - usedTokens;
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: ${usedTokens.toLocaleString()} tokens`;
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` +
`${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 + usedTokens).toLocaleString()} available tokens after deleting this\n\n` +
`${(tokenLimit + usedMaxTokens).toLocaleString()} available tokens after deleting this\n\n` +
` = Currently free: ${alignRight(tokenLimit)}\n` +
` + This message: ${alignRight(usedTokens)}`;
` + This message: ${alignRight(usedMaxTokens)}`;
}
const color: ColorPaletteProp =
@@ -47,23 +87,21 @@ export function tokensPrettyMath(tokenLimit: number | 0, directTokens: number, h
? 'warning'
: 'primary';
return { color, message, remainingTokens };
return { color, message, remainingTokens, costMax, costMin };
}
export const TokenTooltip = (props: { message: string | null, color: ColorPaletteProp, placement?: 'top' | 'top-end', children: React.JSX.Element }) =>
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
}
title={props.message ? <Box sx={{ p: 2, whiteSpace: 'pre' }}>{props.message}</Box> : null}
sx={{
fontFamily: 'code',
boxShadow: 'xl',
// fontSize: '0.8125rem',
border: '1px solid',
borderColor: `${props.color}.outlinedColor`,
boxShadow: 'md',
}}
>
{props.children}
@@ -76,38 +114,65 @@ export const TokenTooltip = (props: { message: string | null, color: ColorPalett
export const TokenBadgeMemo = React.memo(TokenBadge);
function TokenBadge(props: {
direct: number, history?: number, responseMax?: number, limit: number,
showExcess?: boolean, absoluteBottomRight?: boolean, inline?: boolean,
direct: number,
history?: number,
responseMax?: number,
limit: number,
tokenPriceIn?: number,
tokenPriceOut?: number,
showCost?: boolean
showExcess?: boolean,
absoluteBottomRight?: boolean,
inline?: boolean,
}) {
const { message, color, remainingTokens } = tokensPrettyMath(props.limit, props.direct, props.history, props.responseMax);
const { message, color, remainingTokens, costMax, costMin } =
tokensPrettyMath(props.limit, props.direct, props.history, props.responseMax, props.tokenPriceIn, props.tokenPriceOut);
// 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;
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 (
<Badge
variant='solid' color={color} max={100000}
invisible={!props.direct && remainingTokens >= 0}
badgeContent={
<TokenTooltip color={color} message={message}>
<span>{value.toLocaleString()}</span>
</TokenTooltip>
}
sx={{
...((props.absoluteBottomRight) && { position: 'absolute', bottom: 8, right: 8 }),
cursor: 'help',
}}
slotProps={{
badge: {
sx: {
fontFamily: 'code',
...((props.absoluteBottomRight || props.inline) && { position: 'static', transform: 'none' }),
<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>
);
}
@@ -12,7 +12,15 @@ import { tokensPrettyMath, TokenTooltip } from './TokenBadge';
*/
export const TokenProgressbarMemo = React.memo(TokenProgressbar);
function TokenProgressbar(props: { direct: number, history: number, responseMax: number, limit: number }) {
function TokenProgressbar(props: {
direct: number,
history: number,
responseMax: number,
limit: number,
tokenPriceIn?: number,
tokenPriceOut?: number,
}) {
// external state
const theme = useTheme();
@@ -40,7 +48,7 @@ function TokenProgressbar(props: { direct: number, history: number, responseMax:
const overflowColor = theme.palette.danger.softColor;
// tooltip message/color
const { message, color } = tokensPrettyMath(props.limit, props.direct, props.history, props.responseMax);
const { message, color } = tokensPrettyMath(props.limit, props.direct, props.history, props.responseMax, props.tokenPriceIn, props.tokenPriceOut);
// sizes
const containerHeight = 8;
@@ -49,7 +49,7 @@ export function ActilePopup(props: {
const labelNormal = item.label.slice(props.activePrefixLength);
return (
<ListItem
key={item.id}
key={item.key}
variant={isActive ? 'soft' : undefined}
color={isActive ? 'primary' : undefined}
onClick={() => props.onItemClick(item)}
@@ -64,7 +64,7 @@ export function ActilePopup(props: {
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Typography level='title-sm' color={isActive ? 'primary' : undefined}>
<span style={{ fontWeight: 600, textDecoration: 'underline' }}>{labelBold}</span>{labelNormal}
<span style={{ textDecoration: 'underline' }}><b>{labelBold}</b></span>{labelNormal}
</Typography>
{item.argument && <Typography level='body-sm'>
{item.argument}
@@ -1,22 +1,15 @@
import type { FunctionComponent } from 'react';
export interface ActileItem {
id: string;
key: string;
label: string;
argument?: string;
description?: string;
Icon?: FunctionComponent;
}
type ActileProviderIds = 'actile-commands' | 'actile-attach-reference';
export interface ActileProvider {
id: ActileProviderIds;
title: string;
searchPrefix: string;
checkTriggerText: (trailingText: string) => boolean;
fetchItems: () => Promise<ActileItem[]>;
export interface ActileProvider<TItem extends ActileItem = ActileItem> {
fastCheckTriggerText: (trailingText: string) => boolean;
fetchItems: () => Promise<{ title: string, searchPrefix: string, items: TItem[] }>;
onItemSelect: (item: ActileItem) => void;
}
@@ -1,24 +0,0 @@
//import { ActileItem, ActileProvider } from './ActileProvider';
/*export const providerAttachReference: ActileProvider = {
id: 'actile-attach-reference',
title: 'Attach Reference',
searchPrefix: '@',
checkTriggerText: (trailingText: string) =>
trailingText.endsWith(' @'),
fetchItems: async () => {
return [{
id: 'test-1',
label: 'Attach This',
description: 'Attach this to the message',
Icon: undefined,
}];
},
onItemSelect: (item: ActileItem) => {
console.log('Selected item:', item);
},
};*/
@@ -2,23 +2,25 @@ import { ActileItem, ActileProvider } from './ActileProvider';
import { findAllChatCommands } from '../../../commands/commands.registry';
export const providerCommands = (onItemSelect: (item: ActileItem) => void): ActileProvider => ({
id: 'actile-commands',
title: 'Chat Commands',
searchPrefix: '/',
export function providerCommands(onCommandSelect: (item: ActileItem) => void): ActileProvider {
return {
checkTriggerText: (trailingText: string) =>
trailingText.trim() === '/',
// only the literal '/' is a trigger
fastCheckTriggerText: (trailingText: string) => trailingText === '/',
fetchItems: async () => {
return findAllChatCommands().map((cmd) => ({
id: cmd.primary,
label: cmd.primary,
argument: cmd.arguments?.join(' ') ?? undefined,
description: cmd.description,
Icon: cmd.Icon,
}));
},
// 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)),
}),
onItemSelect,
});
onItemSelect: onCommandSelect,
};
}
@@ -0,0 +1,46 @@
import { conversationTitle, DConversationId, messageHasUserFlag, useChatStore } from '~/common/state/store-chats';
import { ActileItem, ActileProvider } from './ActileProvider';
export interface StarredMessageItem extends ActileItem {
conversationId: DConversationId,
messageId: string,
}
export function providerStarredMessage(onMessageSeelect: (item: StarredMessageItem) => void): ActileProvider<StarredMessageItem> {
return {
// 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 () => {
const { conversations } = useChatStore.getState();
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);
});
});
return {
title: 'Starred Messages',
searchPrefix: '',
items: starredMessages,
};
},
onItemSelect: item => onMessageSeelect(item as StarredMessageItem),
};
}
@@ -9,6 +9,7 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
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 [activeSearchString, setActiveSearchString] = React.useState<string>('');
const [activeItemIndex, setActiveItemIndex] = React.useState<number>(0);
@@ -17,7 +18,7 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
// derived state
const activeItems = React.useMemo(() => {
const search = activeSearchString.trim().toLowerCase();
return items.filter(item => item.label.toLowerCase().startsWith(search));
return items.filter(item => item.label?.toLowerCase().startsWith(search));
}, [items, activeSearchString]);
const activeItem = activeItemIndex >= 0 && activeItemIndex < activeItems.length ? activeItems[activeItemIndex] : null;
@@ -25,6 +26,7 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
const handleClose = React.useCallback(() => {
setPopupOpen(false);
setProvider(null);
setTitle('');
setItems([]);
setActiveSearchString('');
setActiveItemIndex(0);
@@ -42,13 +44,19 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
const actileInterceptTextChange = React.useCallback((trailingText: string) => {
for (const provider of providers) {
if (provider.checkTriggerText(trailingText)) {
setProvider(provider);
setPopupOpen(true);
setActiveSearchString(provider.searchPrefix);
if (provider.fastCheckTriggerText(trailingText)) {
provider
.fetchItems()
.then(items => setItems(items))
.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);
@@ -100,14 +108,14 @@ export const useActileManager = (providers: ActileProvider[], anchorRef: React.R
<ActilePopup
anchorEl={anchorRef.current}
onClose={handleClose}
title={provider?.title}
title={title}
items={activeItems}
activeItemIndex={activeItemIndex}
activePrefixLength={activeSearchString.length}
onItemClick={handlePopupItemClicked}
/>
);
}, [activeItemIndex, activeItems, activeSearchString.length, anchorRef, handleClose, handlePopupItemClicked, popupOpen, provider?.title]);
}, [activeItemIndex, activeItems, activeSearchString.length, anchorRef, handleClose, handlePopupItemClicked, popupOpen, title]);
return {
actileComponent,
@@ -6,6 +6,7 @@ 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';
@@ -73,6 +74,7 @@ const converterTypeToIconMap: { [key in AttachmentConverterType]: React.Componen
'pdf-images': PictureAsPdfIcon,
'image': ImageOutlinedIcon,
'image-ocr': AbcIcon,
'ego-message-md': TelegramIcon,
'unhandled': TextureIcon,
};
@@ -126,7 +128,7 @@ export function AttachmentItem(props: {
const handleToggleMenu = React.useCallback((event: React.MouseEvent<HTMLAnchorElement>) => {
event.stopPropagation();
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
onItemMenuToggle(attachment.id, event.currentTarget);
}, [attachment, onItemMenuToggle]);
@@ -179,12 +181,12 @@ export function AttachmentItem(props: {
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',
fontWeight: 'normal',
...ATTACHMENT_MIN_STYLE,
px: 1, py: 0.5,
display: 'flex', flexDirection: 'row', gap: 1,
@@ -153,7 +153,11 @@ export function AttachmentMenu(props: {
{/* 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() : '(base64 image)'} bytes`).join(' · ')}
🡒 {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
@@ -68,8 +68,10 @@ export function Attachments(props: {
const handleOverallMenuHide = () => setOverallMenuAnchor(null);
const handleOverallMenuToggle = (event: React.MouseEvent<HTMLAnchorElement>) =>
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
@@ -112,6 +114,7 @@ export function Attachments(props: {
{/* Overall Menu button */}
<IconButton
onClick={handleOverallMenuToggle}
onContextMenu={handleOverallMenuToggle}
sx={{
// borderRadius: 'sm',
borderRadius: 0,
@@ -150,7 +153,7 @@ export function Attachments(props: {
</MenuItem>
<MenuItem onClick={handleClearAttachments}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
Clear
Clear{attachments.length > 5 ? <span style={{ opacity: 0.5 }}> {attachments.length} attachments</span> : null}
</MenuItem>
</CloseableMenu>
)}
@@ -2,7 +2,7 @@ import { callBrowseFetchPage } from '~/modules/browse/browse.client';
import { createBase36Uid } from '~/common/util/textUtils';
import { htmlTableToMarkdown } from '~/common/util/htmlTableToMarkdown';
import { pdfToText } from '~/common/util/pdfUtils';
import { pdfToImageDataURLs, pdfToText } from '~/common/util/pdfUtils';
import type { Attachment, AttachmentConverter, AttachmentId, AttachmentInput, AttachmentSource } from './store-attachments';
import type { ComposerOutputMultiPart } from '../composer.types';
@@ -18,6 +18,7 @@ const PLAIN_TEXT_MIMETYPES: string[] = [
'text/markdown',
'text/csv',
'text/css',
'text/javascript',
'application/json',
];
@@ -57,16 +58,12 @@ export async function attachmentLoadInputAsync(source: Readonly<AttachmentSource
edit({ label: source.refUrl, ref: source.refUrl });
try {
const page = await callBrowseFetchPage(source.url);
if (page.content) {
edit({
input: {
mimeType: 'text/plain',
data: page.content,
dataSize: page.content.length,
},
});
} else
edit({ inputError: 'No content found at this link' });
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))}` });
}
@@ -131,6 +128,18 @@ export async function attachmentLoadInputAsync(source: Readonly<AttachmentSource
});
}
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 });
@@ -191,6 +200,11 @@ export function attachmentDefineConverters(sourceType: AttachmentSource['media']
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 });
@@ -279,7 +293,7 @@ export async function attachmentPerformConversion(attachment: Readonly<Attachmen
case 'pdf-text':
if (!(input.data instanceof ArrayBuffer)) {
console.log('Expected ArrayBuffer for PDF converter, got:', typeof input.data);
console.log('Expected ArrayBuffer for PDF text converter, got:', typeof input.data);
break;
}
// duplicate the ArrayBuffer to avoid mutation
@@ -294,7 +308,29 @@ export async function attachmentPerformConversion(attachment: Readonly<Attachmen
break;
case 'pdf-images':
// TODO: extract all pages as individual 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':
@@ -332,6 +368,15 @@ export async function attachmentPerformConversion(attachment: Readonly<Attachmen
}
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;
@@ -24,6 +24,12 @@ export type AttachmentSource = {
method: 'clipboard-read' | AttachmentSourceOriginDTO;
textPlain?: string;
textHtml?: string;
} | {
media: 'ego';
method: 'ego-message';
label: string;
blockTitle: string;
textPlain: string;
};
@@ -41,6 +47,7 @@ export type AttachmentConverterType =
| 'text' | 'rich-text' | 'rich-text-table'
| 'pdf-text' | 'pdf-images'
| 'image' | 'image-ocr'
| 'ego-message-md'
| 'unhandled';
export type AttachmentConverter = {
@@ -62,7 +69,7 @@ export type Attachment = {
readonly id: AttachmentId;
readonly source: AttachmentSource,
label: string;
ref: string;
ref: string; // will be used in ```ref\n...``` for instance
inputLoading: boolean;
inputError: string | null;
@@ -100,6 +100,16 @@ export const useAttachments = (enableLoadURLs: boolean) => {
}, [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
@@ -178,6 +188,7 @@ export const useAttachments = (enableLoadURLs: boolean) => {
// create attachments
attachAppendClipboardItems,
attachAppendDataTransfer,
attachAppendEgoMessage,
attachAppendFile,
// manage attachments
@@ -10,8 +10,8 @@ import type { ComposerOutputMultiPart, ComposerOutputPartType } from '../compose
export interface LLMAttachments {
attachments: LLMAttachment[];
getAttachmentOutputs: (initialTextBlockText: string | null, attachmentId: AttachmentId) => ComposerOutputMultiPart;
getAttachmentsOutputs: (initialTextBlockText: string | null) => ComposerOutputMultiPart;
collapseWithAttachment: (initialTextBlockText: string | null, attachmentId: AttachmentId) => ComposerOutputMultiPart;
collapseWithAttachments: (initialTextBlockText: string | null) => ComposerOutputMultiPart;
isOutputAttacheable: boolean;
isOutputTextInlineable: boolean;
tokenCountApprox: number;
@@ -37,13 +37,13 @@ export function useLLMAttachments(attachments: Attachment[], chatLLMId: DLLMId |
const llmAttachments = attachments.map(attachment => toLLMAttachment(attachment, supportedOutputPartTypes, chatLLMId));
const getAttachmentOutputs = (initialTextBlockText: string | null, attachmentId: AttachmentId): ComposerOutputMultiPart => {
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 getAttachmentsOutputs = (initialTextBlockText: string | null): ComposerOutputMultiPart => {
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);
@@ -51,8 +51,8 @@ export function useLLMAttachments(attachments: Attachment[], chatLLMId: DLLMId |
return {
attachments: llmAttachments,
getAttachmentOutputs,
getAttachmentsOutputs,
collapseWithAttachment,
collapseWithAttachments,
isOutputAttacheable: llmAttachments.every(a => a.isOutputAttachable),
isOutputTextInlineable: llmAttachments.every(a => a.isOutputTextInlineable),
tokenCountApprox: llmAttachments.reduce((acc, a) => acc + (a.tokenCountApprox || 0), 0),
@@ -60,7 +60,7 @@ export function useLLMAttachments(attachments: Attachment[], chatLLMId: DLLMId |
}, [attachments, chatLLMId]);
}
export function getTextBlockText(outputs: ComposerOutputMultiPart): string | null {
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;
}
@@ -131,11 +131,13 @@ function attachmentCollapseOutputs(initialTextBlockText: string | null, outputs:
// 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,
collapsible: false, // Wrong
});
} else {
accumulatedOutputs.push(output);
@@ -0,0 +1,50 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, Button, IconButton, Tooltip } from '@mui/joy';
import { ChatBeamIcon } from '~/common/components/icons/ChatBeamIcon';
import { KeyStroke } from '~/common/components/KeyStroke';
import { animationEnterBelow } from '~/common/util/animUtils';
const desktopLegend =
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
Combine the answers from multiple models<br />
<KeyStroke combo='Ctrl + Enter' sx={{ mt: 0.5, mb: 0.25 }} />
</Box>;
const desktopLegendNoContent =
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}>
Enter the text to Beam, then press this
</Box>;
const mobileSx: SxProps = {
mr: { xs: 1, md: 2 },
};
const desktopSx: SxProps = {
'--Button-gap': '1rem',
backgroundColor: 'background.popup',
// border: '1px solid',
// borderColor: 'primary.outlinedBorder',
boxShadow: '0 4px 16px -4px rgb(var(--joy-palette-primary-mainChannel) / 10%)',
animation: `${animationEnterBelow} 0.1s ease-out`,
};
export const ButtonBeamMemo = React.memo(ButtonBeam);
function ButtonBeam(props: { isMobile?: boolean, disabled?: boolean, hasContent?: boolean, onClick: () => void }) {
return props.isMobile ? (
<IconButton variant='soft' 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}>
Beam
</Button>
</Tooltip>
);
}
@@ -10,14 +10,25 @@ const callConversationLegend =
Quick call regarding this chat
</Box>;
export function ButtonCall(props: { isMobile?: boolean, disabled?: boolean, onClick: () => void, sx?: SxProps }) {
const mobileSx: SxProps = {
mr: { xs: 1, md: 2 },
} as const;
const desktopSx: SxProps = {
'--Button-gap': '1rem',
} as const;
export const ButtonCallMemo = React.memo(ButtonCall);
function ButtonCall(props: { isMobile?: boolean, disabled?: boolean, onClick: () => void }) {
return props.isMobile ? (
<IconButton variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} sx={props.sx}>
<IconButton variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} sx={mobileSx}>
<CallIcon />
</IconButton>
) : (
<Tooltip disableInteractive variant='solid' arrow placement='right' title={callConversationLegend}>
<Button variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} endDecorator={<CallIcon />} sx={props.sx}>
<Button variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} endDecorator={<CallIcon />} sx={desktopSx}>
Call
</Button>
</Tooltip>
@@ -6,6 +6,8 @@ import { ChatMulticastOnIcon } from '~/common/components/icons/ChatMulticastOnIc
import { ChatMulticastOffIcon } from '~/common/components/icons/ChatMulticastOffIcon';
export const ButtonMultiChatMemo = React.memo(ButtonMultiChat);
export function ButtonMultiChat(props: { isMobile?: boolean, multiChat: boolean, onSetMultiChat: (multiChat: boolean) => void }) {
const { multiChat } = props;
return props.isMobile ? (
@@ -20,7 +22,7 @@ export function ButtonMultiChat(props: { isMobile?: boolean, multiChat: boolean,
<FormControl orientation='horizontal' sx={{ minHeight: '2.25rem', justifyContent: 'space-between' }}>
<FormLabel sx={{ gap: 1, flexFlow: 'row nowrap' }}>
<Box sx={{ display: { xs: 'none', lg: 'inline-block' } }}>
{multiChat ? <ChatMulticastOnIcon sx={{ color: 'warning.solidBg' }} /> : <ChatMulticastOffIcon />}
{multiChat ? <ChatMulticastOnIcon color='primary' /> : <ChatMulticastOffIcon />}
</Box>
{multiChat ? 'Multichat · On' : 'Multichat'}
</FormLabel>
@@ -2,13 +2,13 @@ import * as React from 'react';
import { Button, IconButton } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
import FormatPaintIcon from '@mui/icons-material/FormatPaint';
import FormatPaintTwoToneIcon from '@mui/icons-material/FormatPaintTwoTone';
export function ButtonOptionsDraw(props: { isMobile?: boolean, onClick: () => void, sx?: SxProps }) {
return props.isMobile ? (
<IconButton variant='soft' color='warning' onClick={props.onClick} sx={props.sx}>
<FormatPaintIcon />
<FormatPaintTwoToneIcon />
</IconButton>
) : (
<Button variant='soft' color='warning' onClick={props.onClick} sx={props.sx}>
@@ -9,6 +9,13 @@ export type ComposerOutputPart = {
// TODO: not implemented yet
type: 'image-part',
base64Url: string,
metadata: {
title?: string,
generatedBy?: string,
altText?: string,
width?: number,
height?: number,
},
collapsible: false,
};
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Button, ListItem, ListItemDecorator } from '@mui/joy';
import { ListItem, ListItemButton, ListItemDecorator } from '@mui/joy';
import AddIcon from '@mui/icons-material/Add';
import FolderIcon from '@mui/icons-material/Folder';
@@ -31,41 +31,37 @@ export function AddFolderButton() {
};
return isAddingFolder ? (
<ListItem sx={{
'--ListItem-paddingLeft': '0.75rem',
'--ListItem-minHeight': '3rem', // --Folder-ListItem-height
display: 'flex', alignItems: 'center', gap: 1,
}}>
<ListItem>
<ListItemDecorator>
<FolderIcon style={{ color: newFolderColor || 'inherit' }} />
</ListItemDecorator>
<InlineTextarea
initialText='' placeholder='Folder Name'
initialText=''
placeholder='Folder Name'
onEdit={handleCreateFolder}
onCancel={handleCancelAddFolder}
sx={{
flexGrow: 1,
}} />
sx={{ ml: -1.5, mr: -0.5, flexGrow: 1, minWidth: 100 }}
/>
{/*<IconButton color='danger' onClick={handleCancelAddFolder}>*/}
{/* <CloseIcon />*/}
{/* <CloseRoundedIcon />*/}
{/*</IconButton>*/}
</ListItem>
) : (
<Button
color='neutral'
variant='plain'
startDecorator={<AddIcon />}
onClick={handleAddFolder}
sx={{
// display: 'flex', alignItems: 'center', justifyContent: 'flex-start',
// minHeight: '3rem', // --Folder-ListItem-height
// match the forder elements
paddingInline: '1.2rem',
gap: '0.75rem',
// fontWeight: 400,
}}
>
New folder
</Button>
<ListItem>
<ListItemButton
onClick={handleAddFolder}
sx={{
// equal to the 'new chat' button
fontSize: 'sm',
fontWeight: 'lg',
color: 'neutral.outlinedColor',
}}
>
<ListItemDecorator>
<AddIcon sx={{ '--Icon-fontSize': 'var(--joy-fontSize-xl)', pl: '0.125rem' }} />
</ListItemDecorator>
New folder
</ListItemButton>
</ListItem>
);
}
@@ -1,20 +1,24 @@
import * as React from 'react';
import { DragDropContext, Draggable, DropResult } from 'react-beautiful-dnd';
import { List, ListItem, ListItemButton, ListItemContent, ListItemDecorator, Sheet, Typography } from '@mui/joy';
import type { SxProps } from '@mui/joy/styles/types';
import { List, ListItem, ListItemButton, ListItemDecorator, Sheet } from '@mui/joy';
import FolderIcon from '@mui/icons-material/Folder';
import { ContentScaling, themeScalingMap } from '~/common/app.theme';
import { DFolder, useFolderStore } from '~/common/state/store-folders';
import { StrictModeDroppable } from '~/common/components/StrictModeDroppable';
import { AddFolderButton } from './AddFolderButton';
import { FolderListItem } from './FolderListItem';
import { StrictModeDroppable } from './StrictModeDroppable';
export function ChatFolderList(props: {
folders: DFolder[];
contentScaling: ContentScaling;
activeFolderId: string | null;
onFolderSelect: (folderId: string | null) => void;
sx?: SxProps;
}) {
// derived props
@@ -29,13 +33,18 @@ export function ChatFolderList(props: {
return (
<Sheet variant='soft' sx={{ p: 2 }}>
<Sheet variant='soft' sx={props.sx}>
<List
variant='plain'
sx={(theme) => ({
// added to be responsive to parent's layout sizing
height: '100%',
overflowY: 'auto',
// original list properties
'& ul': {
'--List-gap': '0px',
bgcolor: 'background.surface',
bgcolor: 'background.popup',
'& > li:first-of-type > [role="button"]': {
borderTopRightRadius: 'var(--List-radius)',
borderTopLeftRadius: 'var(--List-radius)',
@@ -47,8 +56,11 @@ export function ChatFolderList(props: {
},
// copied from the former PageDrawerList as this was contained
'--Icon-fontSize': 'var(--joy-fontSize-xl2)',
'--ListItemDecorator-size': '2.75rem',
'--ListItem-minHeight': '3rem', // --Folder-ListItem-height
// dynamic sizing
...themeScalingMap[props.contentScaling].chatDrawerItemFolderSx,
// '--ListItemDecorator-size': '2.75rem',
// '--ListItem-minHeight': '2.75rem',
'--List-radius': '8px',
'--List-gap': '1rem',
@@ -64,6 +76,7 @@ export function ChatFolderList(props: {
'--joy-palette-neutral-plainHoverBg': 'rgba(255 255 255 / 0.1)',
'--joy-palette-neutral-plainActiveBg': 'rgba(255 255 255 / 0.16)',
},
boxShadow: 'sm',
})}
>
<ListItem nested>
@@ -92,21 +105,12 @@ export function ChatFolderList(props: {
onFolderSelect(null);
}}
selected={!activeFolderId}
sx={{
border: 0,
justifyContent: 'space-between',
'&:hover .menu-icon': {
visibility: 'visible', // Hide delete icon for default folder
},
}}
sx={{ border: 0 }}
>
<ListItemDecorator>
<FolderIcon />
</ListItemDecorator>
<ListItemContent>
<Typography>All</Typography>
</ListItemContent>
All
</ListItemButton>
</ListItem>
@@ -123,7 +127,10 @@ export function ChatFolderList(props: {
)}
</Draggable>
))}
{provided.placeholder}
<AddFolderButton />
</List>
)}
</StrictModeDroppable>
@@ -131,7 +138,6 @@ export function ChatFolderList(props: {
</ListItem>
</List>
<AddFolderButton />
</Sheet>
</Sheet>
);
}
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
import type { DraggableProvided, DraggableStateSnapshot, DraggingStyle, NotDraggingStyle } from 'react-beautiful-dnd';
import { FormLabel, IconButton, ListItem, ListItemButton, ListItemContent, ListItemDecorator, MenuItem, Radio, radioClasses, RadioGroup, Sheet, Typography } from '@mui/joy';
import CloseIcon from '@mui/icons-material/Close';
import { FormLabel, IconButton, ListItem, ListItemButton, ListItemContent, ListItemDecorator, MenuItem, Radio, radioClasses, RadioGroup, Sheet } from '@mui/joy';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import Done from '@mui/icons-material/Done';
import EditIcon from '@mui/icons-material/Edit';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import FolderIcon from '@mui/icons-material/Folder';
import MoreVertIcon from '@mui/icons-material/MoreVert';
@@ -36,8 +36,9 @@ export function FolderListItem(props: {
// Menu
const handleMenuOpen = (event: React.MouseEvent<HTMLAnchorElement>) => {
setMenuAnchorEl(event.currentTarget);
const handleMenuToggle = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
setMenuAnchorEl(anchor => anchor ? null : event.currentTarget);
setDeleteArmed(false); // Reset delete armed state
};
@@ -182,17 +183,20 @@ export function FolderListItem(props: {
userSelect: 'none',
}}
>
<Typography>{folder.title}</Typography>
{folder.title}
</ListItemContent>
)}
{/* Icon to show the Popup menu */}
<IconButton
size='sm'
variant='outlined'
className='menu-icon'
onClick={handleMenuOpen}
onClick={handleMenuToggle}
onContextMenu={handleMenuToggle}
sx={{
visibility: 'hidden',
my: '-0.25rem', /* absorb the button padding */
}}
>
<MoreVertIcon />
@@ -213,7 +217,7 @@ export function FolderListItem(props: {
}}
>
<ListItemDecorator>
<EditIcon />
<EditRoundedIcon />
</ListItemDecorator>
Edit
</MenuItem>
@@ -229,7 +233,7 @@ export function FolderListItem(props: {
<>
<MenuItem onClick={handleDeleteCanceled}>
<ListItemDecorator>
<CloseIcon />
<CloseRoundedIcon />
</ListItemDecorator>
Cancel
</MenuItem>
@@ -256,7 +260,7 @@ export function FolderListItem(props: {
sx={{
mb: 1.5,
fontSize: 'xs',
fontWeight: 'xl',
fontWeight: 'xl', /* 700: this COLOR labels stands out positively */
letterSpacing: '0.1em',
textTransform: 'uppercase',
}}
@@ -1,22 +0,0 @@
import { useEffect, useState } from "react";
import { Droppable, DroppableProps } from "react-beautiful-dnd";
export const StrictModeDroppable = ({ children, ...props }: DroppableProps) => {
const [enabled, setEnabled] = useState(false);
useEffect(() => {
const animation = requestAnimationFrame(() => setEnabled(true));
return () => {
cancelAnimationFrame(animation);
setEnabled(false);
};
}, []);
if (!enabled) {
return null;
}
return <Droppable {...props}>{children}</Droppable>;
};
+454 -184
View File
@@ -1,64 +1,96 @@
import * as React from 'react';
import { shallow } from 'zustand/shallow';
import { useShallow } from 'zustand/react/shallow';
import { Avatar, Box, CircularProgress, IconButton, ListDivider, ListItem, ListItemDecorator, MenuItem, Switch, Tooltip, Typography } from '@mui/joy';
import AccountTreeIcon from '@mui/icons-material/AccountTree';
import type { SxProps } from '@mui/joy/styles/types';
import { Avatar, Box, ButtonGroup, CircularProgress, IconButton, ListDivider, ListItem, ListItemDecorator, MenuItem, Switch, Tooltip, Typography } from '@mui/joy';
import { ClickAwayListener, Popper } from '@mui/base';
import AccountTreeOutlinedIcon from '@mui/icons-material/AccountTreeOutlined';
import ClearIcon from '@mui/icons-material/Clear';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import DifferenceIcon from '@mui/icons-material/Difference';
import EditIcon from '@mui/icons-material/Edit';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import Face6Icon from '@mui/icons-material/Face6';
import ForkRightIcon from '@mui/icons-material/ForkRight';
import FormatPaintIcon from '@mui/icons-material/FormatPaint';
import FormatPaintOutlinedIcon from '@mui/icons-material/FormatPaintOutlined';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import RecordVoiceOverIcon from '@mui/icons-material/RecordVoiceOver';
import RecordVoiceOverOutlinedIcon from '@mui/icons-material/RecordVoiceOverOutlined';
import ReplayIcon from '@mui/icons-material/Replay';
import ReplyRoundedIcon from '@mui/icons-material/ReplyRounded';
import SettingsSuggestIcon from '@mui/icons-material/SettingsSuggest';
import SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';
import StarOutlineRoundedIcon from '@mui/icons-material/StarOutlineRounded';
import StarRoundedIcon from '@mui/icons-material/StarRounded';
import TelegramIcon from '@mui/icons-material/Telegram';
import VerticalAlignBottomIcon from '@mui/icons-material/VerticalAlignBottom';
import { SystemPurposeId, SystemPurposes } from '../../../../data';
import { BlocksRenderer, editBlocksSx } from '~/modules/blocks/BlocksRenderer';
import { useSanityTextDiffs } from '~/modules/blocks/RenderTextDiff';
import { ChatBeamIcon } from '~/common/components/icons/ChatBeamIcon';
import { CloseableMenu } from '~/common/components/CloseableMenu';
import { DMessage } from '~/common/state/store-chats';
import { DMessage, DMessageUserFlag, messageHasUserFlag } from '~/common/state/store-chats';
import { InlineTextarea } from '~/common/components/InlineTextarea';
import { KeyStroke } from '~/common/components/KeyStroke';
import { Link } from '~/common/components/Link';
import { SystemPurposeId, SystemPurposes } from '../../../../data';
import { adjustContentScaling, themeScalingMap, themeZIndexPageBar } from '~/common/app.theme';
import { animationColorRainbow } from '~/common/util/animUtils';
import { copyToClipboard } from '~/common/util/clipboardUtils';
import { cssRainbowColorKeyframes } from '~/common/app.theme';
import { prettyBaseModel } from '~/common/util/modelUtils';
import { useUIPreferencesStore } from '~/common/state/store-ui';
import { BlocksRenderer, editBlocksSx } from './blocks/BlocksRenderer';
import { ReplyToBubble } from './ReplyToBubble';
import { useChatShowTextDiff } from '../../store-app-chat';
import { useSanityTextDiffs } from './blocks/RenderTextDiff';
// Enable the menu on text selection
const ENABLE_SELECTION_RIGHT_CLICK_MENU: boolean = true;
const ENABLE_SELECTION_RIGHT_CLICK_MENU = false;
const ENABLE_SELECTION_TOOLBAR = true;
const SELECTION_TOOLBAR_MIN_LENGTH = 3;
// Enable the hover button to copy the whole message. The Copy button is also available in Blocks, or in the Avatar Menu.
const ENABLE_COPY_MESSAGE_OVERLAY: boolean = false;
export function messageBackground(messageRole: DMessage['role'] | string, wasEdited: boolean, unknownAssistantIssue: boolean): string {
export function messageBackground(messageRole: DMessage['role'] | string, wasEdited: boolean, isAssistantIssue: boolean): string {
switch (messageRole) {
case 'user':
return 'primary.plainHoverBg'; // was .background.level1
case 'assistant':
return unknownAssistantIssue ? 'danger.softBg' : 'background.surface';
return isAssistantIssue ? 'danger.softBg' : 'background.surface';
case 'system':
return wasEdited ? 'warning.softHoverBg' : 'background.surface';
return wasEdited ? 'warning.softHoverBg' : 'neutral.softBg';
default:
return '#ff0000';
}
}
const avatarIconSx = { width: 36, height: 36 };
const avatarIconSx = {
width: 36,
height: 36,
};
const personaSx: SxProps = {
// make this stick to the top of the screen
position: 'sticky',
top: 0,
// flexBasis: 0, // this won't let the item grow
minWidth: { xs: 50, md: 64 },
maxWidth: 80,
textAlign: 'center',
// layout
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
};
export function makeAvatar(messageAvatar: string | null, messageRole: DMessage['role'] | string, messageOriginLLM: string | undefined, messagePurposeId: SystemPurposeId | undefined, messageSender: string, messageTyping: boolean, size: 'sm' | undefined = undefined): React.JSX.Element {
if (typeof messageAvatar === 'string' && messageAvatar)
return <Avatar alt={messageSender} src={messageAvatar} />;
const mascotSx = size === 'sm' ? avatarIconSx : { width: 64, height: 64 };
switch (messageRole) {
case 'system':
@@ -69,36 +101,40 @@ export function makeAvatar(messageAvatar: string | null, messageRole: DMessage['
case 'assistant':
// typing gif (people seem to love this, so keeping it after april fools')
const isDownload = messageOriginLLM === 'web';
const isTextToImage = messageOriginLLM === 'DALL·E' || messageOriginLLM === 'Prodia';
const isReact = messageOriginLLM?.startsWith('react-');
if (messageTyping) {
// animation: message typing
if (messageTyping)
return <Avatar
alt={messageSender} variant='plain'
src={isTextToImage ? 'https://i.giphy.com/media/5t9ujj9cMisyVjUZ0m/giphy.webp'
: isReact ? 'https://i.giphy.com/media/l44QzsOLXxcrigdgI/giphy.webp'
: 'https://i.giphy.com/media/jJxaUysjzO9ri/giphy.webp'}
src={isDownload ? 'https://i.giphy.com/26u6dIwIphLj8h10A.webp' // hourglass: https://i.giphy.com/TFSxpAIYz5inJGuY8f.webp, small-lq: https://i.giphy.com/131tNuGktpXGhy.webp, floppy: https://i.giphy.com/RxR1KghIie2iI.webp
: isTextToImage ? 'https://i.giphy.com/media/5t9ujj9cMisyVjUZ0m/giphy.webp' // brush
: isReact ? 'https://i.giphy.com/media/l44QzsOLXxcrigdgI/giphy.webp' // mind
: 'https://i.giphy.com/media/jJxaUysjzO9ri/giphy.webp'} // typing
sx={{ ...mascotSx, borderRadius: 'sm' }}
/>;
}
// text-to-image: icon
// icon: text-to-image
if (isTextToImage)
return <FormatPaintIcon sx={{
return <FormatPaintOutlinedIcon sx={{
...avatarIconSx,
animation: `${cssRainbowColorKeyframes} 1s linear 2.66`,
animation: `${animationColorRainbow} 1s linear 2.66`,
}} />;
// purpose symbol (if present)
const symbol = SystemPurposes[messagePurposeId!]?.symbol;
if (symbol) return <Box sx={{
fontSize: '24px',
textAlign: 'center',
width: '100%',
minWidth: `${avatarIconSx.width}px`,
lineHeight: `${avatarIconSx.height}px`,
}}>
{symbol}
</Box>;
if (symbol)
return <Box sx={{
fontSize: '24px',
textAlign: 'center',
width: '100%',
minWidth: `${avatarIconSx.width}px`,
lineHeight: `${avatarIconSx.height}px`,
}}>
{symbol}
</Box>;
// default assistant avatar
return <SmartToyOutlinedIcon sx={avatarIconSx} />; // https://mui.com/static/images/avatar/2.jpg
@@ -177,38 +213,48 @@ export const ChatMessageMemo = React.memo(ChatMessage);
* or collapsing long user messages.
*
*/
function ChatMessage(props: {
export function ChatMessage(props: {
message: DMessage,
diffPreviousText?: string,
fitScreen: boolean,
isBottom?: boolean,
isMobile?: boolean,
isImagining?: boolean,
isSpeaking?: boolean,
blocksShowDate?: boolean,
onConversationBranch?: (messageId: string) => void,
onConversationRestartFrom?: (messageId: string, offset: number) => Promise<void>,
onConversationTruncate?: (messageId: string) => void,
showAvatar?: boolean, // auto if undefined
showBlocksDate?: boolean,
showUnsafeHtml?: boolean,
adjustContentScaling?: number,
topDecorator?: React.ReactNode,
onMessageAssistantFrom?: (messageId: string, offset: number) => Promise<void>,
onMessageBeam?: (messageId: string) => Promise<void>,
onMessageBranch?: (messageId: string) => void,
onMessageDelete?: (messageId: string) => void,
onMessageEdit?: (messageId: string, text: string) => void,
onMessageToggleUserFlag?: (messageId: string, flag: DMessageUserFlag) => void,
onMessageTruncate?: (messageId: string) => void,
onReplyTo?: (messageId: string, selectedText: string) => void,
onTextDiagram?: (messageId: string, text: string) => Promise<void>
onTextImagine?: (text: string) => Promise<void>
onTextSpeak?: (text: string) => Promise<void>
sx?: SxProps,
}) {
// state
const blocksRendererRef = React.useRef<HTMLDivElement>(null);
const [isHovering, setIsHovering] = React.useState(false);
const [opsMenuAnchor, setOpsMenuAnchor] = React.useState<HTMLElement | null>(null);
const [selMenuAnchor, setSelMenuAnchor] = React.useState<HTMLElement | null>(null);
const [selMenuText, setSelMenuText] = React.useState<string | null>(null);
const [selToolbarAnchor, setSelToolbarAnchor] = React.useState<HTMLElement | null>(null);
const [selText, setSelText] = React.useState<string | null>(null);
const [isEditing, setIsEditing] = React.useState(false);
// external state
const { cleanerLooks, doubleClickToEdit, messageTextSize, renderMarkdown } = useUIPreferencesStore(state => ({
cleanerLooks: state.zenMode === 'cleaner',
const { showAvatar, contentScaling, doubleClickToEdit, renderMarkdown } = useUIPreferencesStore(useShallow(state => ({
showAvatar: props.showAvatar !== undefined ? props.showAvatar : state.zenMode !== 'cleaner',
contentScaling: adjustContentScaling(state.contentScaling, props.adjustContentScaling),
doubleClickToEdit: state.doubleClickToEdit,
messageTextSize: state.messageTextSize,
renderMarkdown: state.renderMarkdown,
}), shallow);
})));
const [showDiff, setShowDiff] = useChatShowTextDiff();
const textDiffs = useSanityTextDiffs(props.message.text, props.diffPreviousText, showDiff);
@@ -222,20 +268,21 @@ function ChatMessage(props: {
role: messageRole,
purposeId: messagePurposeId,
originLLM: messageOriginLLM,
metadata: messageMetadata,
created: messageCreated,
updated: messageUpdated,
} = props.message;
const isUserStarred = messageHasUserFlag(props.message, 'starred');
const fromAssistant = messageRole === 'assistant';
const fromSystem = messageRole === 'system';
const wasEdited = !!messageUpdated;
const showAvatars = !cleanerLooks;
const textSel = selMenuText ? selMenuText : messageText;
const textSel = selText ? selText : messageText;
const isSpecialT2I = textSel.startsWith('https://images.prodia.xyz/') || textSel.startsWith('/draw ') || textSel.startsWith('/imagine ') || textSel.startsWith('/img ');
const couldDiagram = textSel?.length >= 100 && !isSpecialT2I;
const couldImagine = textSel?.length >= 2 && !isSpecialT2I;
const couldDiagram = textSel.length >= 100 && !isSpecialT2I;
const couldImagine = textSel.length >= 3 && !isSpecialT2I;
const couldSpeak = couldImagine;
@@ -248,33 +295,51 @@ function ChatMessage(props: {
// Operations Menu
const closeOpsMenu = () => setOpsMenuAnchor(null);
const { onMessageToggleUserFlag } = props;
const handleOpsMenuToggle = React.useCallback((event: React.MouseEvent<HTMLElement>) => {
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
setOpsMenuAnchor(anchor => anchor ? null : event.currentTarget);
}, []);
const handleCloseOpsMenu = React.useCallback(() => setOpsMenuAnchor(null), []);
const handleOpsCopy = (e: React.MouseEvent) => {
copyToClipboard(textSel, 'Text');
e.preventDefault();
closeOpsMenu();
handleCloseOpsMenu();
closeSelectionMenu();
closeToolbar();
};
const handleOpsEdit = React.useCallback((e: React.MouseEvent) => {
if (messageTyping && !isEditing) return; // don't allow editing while typing
setIsEditing(!isEditing);
e.preventDefault();
closeOpsMenu();
}, [isEditing, messageTyping]);
handleCloseOpsMenu();
}, [handleCloseOpsMenu, isEditing, messageTyping]);
const handleOpsConversationBranch = (e: React.MouseEvent) => {
const handleOpsToggleStarred = React.useCallback(() => {
onMessageToggleUserFlag?.(messageId, 'starred');
}, [messageId, onMessageToggleUserFlag]);
const handleOpsAssistantFrom = async (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation(); // to try to not steal the focus from the banched conversation
props.onConversationBranch && props.onConversationBranch(messageId);
closeOpsMenu();
handleCloseOpsMenu();
await props.onMessageAssistantFrom?.(messageId, fromAssistant ? -1 : 0);
};
const handleOpsConversationRestartFrom = async (e: React.MouseEvent) => {
const handleOpsBeamFrom = async (e: React.MouseEvent) => {
e.stopPropagation();
handleCloseOpsMenu();
await props.onMessageBeam?.(messageId);
};
const handleOpsBranch = (e: React.MouseEvent) => {
e.preventDefault();
closeOpsMenu();
props.onConversationRestartFrom && await props.onConversationRestartFrom(messageId, fromAssistant ? -1 : 0);
e.stopPropagation(); // to try to not steal the focus from the banched conversation
props.onMessageBranch?.(messageId);
handleCloseOpsMenu();
};
const handleOpsToggleShowDiff = () => setShowDiff(!showDiff);
@@ -283,8 +348,9 @@ function ChatMessage(props: {
e.preventDefault();
if (props.onTextDiagram) {
await props.onTextDiagram(messageId, textSel);
closeOpsMenu();
handleCloseOpsMenu();
closeSelectionMenu();
closeToolbar();
}
};
@@ -292,8 +358,19 @@ function ChatMessage(props: {
e.preventDefault();
if (props.onTextImagine) {
await props.onTextImagine(textSel);
closeOpsMenu();
handleCloseOpsMenu();
closeSelectionMenu();
closeToolbar();
}
};
const handleOpsReplyTo = (e: React.MouseEvent) => {
e.preventDefault();
if (props.onReplyTo && textSel.trim().length >= SELECTION_TOOLBAR_MIN_LENGTH) {
props.onReplyTo(messageId, textSel.trim());
handleCloseOpsMenu();
closeSelectionMenu();
closeToolbar();
}
};
@@ -301,18 +378,19 @@ function ChatMessage(props: {
e.preventDefault();
if (props.onTextSpeak) {
await props.onTextSpeak(textSel);
closeOpsMenu();
handleCloseOpsMenu();
closeSelectionMenu();
closeToolbar();
}
};
const handleOpsTruncate = (_e: React.MouseEvent) => {
props.onConversationTruncate && props.onConversationTruncate(messageId);
closeOpsMenu();
props.onMessageTruncate?.(messageId);
handleCloseOpsMenu();
};
const handleOpsDelete = (_e: React.MouseEvent) => {
props.onMessageDelete && props.onMessageDelete(messageId);
props.onMessageDelete?.(messageId);
};
@@ -343,17 +421,17 @@ function ChatMessage(props: {
document.body.appendChild(anchorEl);
setSelMenuAnchor(anchorEl);
setSelMenuText(selectedText);
setSelText(selectedText);
}, [removeSelectionAnchor]);
const closeSelectionMenu = React.useCallback(() => {
// window.getSelection()?.removeAllRanges?.();
removeSelectionAnchor();
setSelMenuAnchor(null);
setSelMenuText(null);
setSelText(null);
}, [removeSelectionAnchor]);
const handleMouseUp = React.useCallback((event: MouseEvent) => {
const handleContextMenu = React.useCallback((event: MouseEvent) => {
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
@@ -364,16 +442,74 @@ function ChatMessage(props: {
}, [openSelectionMenu]);
// Selection Toolbar
const closeToolbar = React.useCallback((anchorEl?: HTMLElement) => {
window.getSelection()?.removeAllRanges?.();
try {
const anchor = anchorEl || selToolbarAnchor;
anchor && document.body.removeChild(anchor);
} catch (e) {
// ignore...
}
setSelToolbarAnchor(null);
setSelText(null);
}, [selToolbarAnchor]);
const handleOpenToolbar = React.useCallback((_event: MouseEvent) => {
// check for selection
const selection = window.getSelection();
if (!selection || selection.rangeCount <= 0) return;
// check for enought selection
const selectionText = selection.toString().trim();
if (selectionText.length < SELECTION_TOOLBAR_MIN_LENGTH) return;
// check for the selection being inside the blocks renderer (core of the message)
const selectionRange = selection.getRangeAt(0);
const blocksElement = blocksRendererRef.current;
if (!blocksElement || !blocksElement.contains(selectionRange.commonAncestorContainer)) return;
const rangeRects = selectionRange.getClientRects();
if (rangeRects.length <= 0) return;
const firstRect = rangeRects[0];
const anchorEl = document.createElement('div');
anchorEl.style.position = 'fixed';
anchorEl.style.left = `${firstRect.left + window.scrollX}px`;
anchorEl.style.top = `${firstRect.top + window.scrollY}px`;
document.body.appendChild(anchorEl);
anchorEl.setAttribute('role', 'dialog');
// auto-close logic on unselect
const closeOnUnselect = () => {
const selection = window.getSelection();
if (!selection || selection.toString().trim() === '') {
closeToolbar(anchorEl);
document.removeEventListener('selectionchange', closeOnUnselect);
}
};
document.addEventListener('selectionchange', closeOnUnselect);
setSelToolbarAnchor(anchorEl);
setSelText(selectionText);
}, [closeToolbar]);
// Blocks renderer
const handleBlocksContextMenu = React.useCallback((event: React.MouseEvent) => {
handleMouseUp(event.nativeEvent);
}, [handleMouseUp]);
handleContextMenu(event.nativeEvent);
}, [handleContextMenu]);
const handleBlocksDoubleClick = React.useCallback((event: React.MouseEvent) => {
doubleClickToEdit && props.onMessageEdit && handleOpsEdit(event);
}, [doubleClickToEdit, handleOpsEdit, props.onMessageEdit]);
const handleBlocksMouseUp = React.useCallback((event: React.MouseEvent) => {
handleOpenToolbar(event.nativeEvent);
}, [handleOpenToolbar]);
// prettier upstream errors
const { isAssistantError, errorMessage } = React.useMemo(
@@ -386,94 +522,133 @@ function ChatMessage(props: {
// avatar
const avatarEl: React.JSX.Element | null = React.useMemo(
() => showAvatars ? makeAvatar(messageAvatar, messageRole, messageOriginLLM, messagePurposeId, messageSender, messageTyping) : null,
[messageAvatar, messageOriginLLM, messagePurposeId, messageRole, messageSender, messageTyping, showAvatars],
() => showAvatar ? makeAvatar(messageAvatar, messageRole, messageOriginLLM, messagePurposeId, messageSender, messageTyping) : null,
[messageAvatar, messageOriginLLM, messagePurposeId, messageRole, messageSender, messageTyping, showAvatar],
);
return (
<ListItem
role='chat-message'
onMouseUp={(ENABLE_SELECTION_TOOLBAR && !fromSystem && !isAssistantError) ? handleBlocksMouseUp : undefined}
sx={{
display: 'flex', flexDirection: !fromAssistant ? 'row-reverse' : 'row', alignItems: 'flex-start',
gap: { xs: 0, md: 1 },
px: { xs: 1, md: 2 },
py: 2,
backgroundColor,
borderBottom: '1px solid',
borderBottomColor: 'divider',
...(ENABLE_COPY_MESSAGE_OVERLAY && { position: 'relative' }),
// style
backgroundColor: backgroundColor,
px: { xs: 1, md: themeScalingMap[contentScaling]?.chatMessagePadding ?? 2 },
py: themeScalingMap[contentScaling]?.chatMessagePadding ?? 2,
// style: omit border if set externally
...(!('borderBottom' in (props.sx || {})) && {
borderBottom: '1px solid',
borderBottomColor: 'divider',
}),
// style: when starred
...(isUserStarred && {
outline: '3px solid',
outlineColor: 'primary.solidBg',
boxShadow: 'lg',
borderRadius: 'lg',
zIndex: 1,
}),
// style: make room for a top decorator if set
'&:hover > button': { opacity: 1 },
// layout
display: 'block', // this is Needed, otherwise there will be a horizontal overflow
...props.sx,
}}
>
{/* Avatar */}
{showAvatars && (
<Box
onMouseEnter={() => setIsHovering(true)} onMouseLeave={() => setIsHovering(false)}
onClick={event => setOpsMenuAnchor(event.currentTarget)}
sx={{
// flexBasis: 0, // this won't let the item grow
display: 'flex', flexDirection: 'column', alignItems: 'center',
minWidth: { xs: 50, md: 64 }, maxWidth: 80,
textAlign: 'center',
}}
>
{/* (Optional) underlayed top decorator */}
{props.topDecorator}
{isHovering ? (
<IconButton variant='soft' color={fromAssistant ? 'neutral' : 'primary'} sx={avatarIconSx}>
<MoreVertIcon />
</IconButton>
) : (
avatarEl
)}
{/* Message Row: Avatar, Blocks (1 text -> blocksRenderer) */}
<Box sx={{
display: 'flex',
flexDirection: !fromAssistant ? 'row-reverse' : 'row',
alignItems: 'flex-start',
gap: { xs: 0, md: 1 },
}}>
{/* Assistant model name */}
{fromAssistant && (
<Tooltip title={messageOriginLLM || 'unk-model'} variant='solid'>
<Typography level='body-xs' sx={{
overflowWrap: 'anywhere',
...(messageTyping ? { animation: `${cssRainbowColorKeyframes} 5s linear infinite` } : {}),
}}>
{prettyBaseModel(messageOriginLLM)}
</Typography>
</Tooltip>
)}
{/* Avatar (Persona) */}
{showAvatar && (
<Box sx={personaSx}>
</Box>
)}
{/* Persona Avatar or Menu Button */}
<Box
onClick={handleOpsMenuToggle}
onContextMenu={handleOpsMenuToggle}
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
sx={{ display: 'flex' }}
>
{(isHovering || opsMenuAnchor) ? (
<IconButton variant={opsMenuAnchor ? 'solid' : 'soft'} color={(fromAssistant || fromSystem) ? 'neutral' : 'primary'} sx={avatarIconSx}>
<MoreVertIcon />
</IconButton>
) : (
avatarEl
)}
</Box>
{/* Assistant model name */}
{fromAssistant && (
<Tooltip arrow title={messageTyping ? null : (messageOriginLLM || 'unk-model')} variant='solid'>
<Typography level='body-xs' sx={{
overflowWrap: 'anywhere',
...(messageTyping ? { animation: `${animationColorRainbow} 5s linear infinite` } : {}),
}}>
{prettyBaseModel(messageOriginLLM)}
</Typography>
</Tooltip>
)}
</Box>
)}
{/* Edit / Blocks */}
{isEditing ? (
{/* Edit / Blocks */}
{isEditing ? (
<InlineTextarea
initialText={messageText} onEdit={handleTextEdited}
sx={editBlocksSx}
/>
<InlineTextarea
initialText={messageText} onEdit={handleTextEdited}
sx={editBlocksSx}
/>
) : (
) : (
<BlocksRenderer
text={messageText}
fromRole={messageRole}
renderTextAsMarkdown={renderMarkdown}
messageTextSize={messageTextSize}
errorMessage={errorMessage}
isBottom={props.isBottom}
isMobile={props.isMobile}
showDate={props.blocksShowDate === true ? messageUpdated || messageCreated || undefined : undefined}
renderTextDiff={textDiffs || undefined}
wasUserEdited={wasEdited}
onContextMenu={(props.onMessageEdit && ENABLE_SELECTION_RIGHT_CLICK_MENU) ? handleBlocksContextMenu : undefined}
onDoubleClick={(props.onMessageEdit && doubleClickToEdit) ? handleBlocksDoubleClick : undefined}
/>
<BlocksRenderer
ref={blocksRendererRef}
text={messageText}
fromRole={messageRole}
contentScaling={contentScaling}
errorMessage={errorMessage}
fitScreen={props.fitScreen}
isBottom={props.isBottom}
renderTextAsMarkdown={renderMarkdown}
renderTextDiff={textDiffs || undefined}
showDate={props.showBlocksDate === true ? messageUpdated || messageCreated || undefined : undefined}
showUnsafeHtml={props.showUnsafeHtml}
wasUserEdited={wasEdited}
onContextMenu={(props.onMessageEdit && ENABLE_SELECTION_RIGHT_CLICK_MENU) ? handleBlocksContextMenu : undefined}
onDoubleClick={(props.onMessageEdit && doubleClickToEdit) ? handleBlocksDoubleClick : undefined}
optiAllowMemo={messageTyping}
/>
)}
)}
</Box>
{/* Reply-To Bubble */}
{!!messageMetadata?.inReplyToText && <ReplyToBubble inlineMessage replyToText={messageMetadata.inReplyToText} className='reply-to-bubble' />}
{/* Overlay copy icon */}
{ENABLE_COPY_MESSAGE_OVERLAY && !fromSystem && !isEditing && (
<Tooltip title={fromAssistant ? 'Copy message' : 'Copy input'} variant='solid'>
<Tooltip title={messageTyping ? null : (fromAssistant ? 'Copy message' : 'Copy input')} variant='solid'>
<IconButton
variant='outlined' onClick={handleOpsCopy}
sx={{
@@ -490,34 +665,47 @@ function ChatMessage(props: {
{!!opsMenuAnchor && (
<CloseableMenu
dense placement='bottom-end'
open anchorEl={opsMenuAnchor} onClose={closeOpsMenu}
open anchorEl={opsMenuAnchor} onClose={handleCloseOpsMenu}
sx={{ minWidth: 280 }}
>
{fromSystem && (
<ListItem>
<Typography level='body-sm'>
System message
</Typography>
</ListItem>
)}
{/* Edit / Copy */}
<Box sx={{ display: 'flex', alignItems: 'center' }}>
{/* Edit */}
{!!props.onMessageEdit && (
<MenuItem variant='plain' disabled={messageTyping} onClick={handleOpsEdit} sx={{ flex: 1 }}>
<ListItemDecorator><EditIcon /></ListItemDecorator>
<ListItemDecorator><EditRoundedIcon /></ListItemDecorator>
{isEditing ? 'Discard' : 'Edit'}
{/*{!isEditing && <span style={{ opacity: 0.5, marginLeft: '8px' }}>{doubleClickToEdit ? '(double-click)' : ''}</span>}*/}
</MenuItem>
)}
{/* Copy */}
<MenuItem onClick={handleOpsCopy} sx={{ flex: 1 }}>
<ListItemDecorator><ContentCopyIcon /></ListItemDecorator>
Copy
</MenuItem>
{/* Starred */}
{!!onMessageToggleUserFlag && (
<MenuItem onClick={handleOpsToggleStarred} sx={{ flexGrow: 0, px: 1 }}>
{isUserStarred
? <StarRoundedIcon color='primary' sx={{ fontSize: 'xl2' }} />
: <StarOutlineRoundedIcon sx={{ fontSize: 'xl2' }} />
}
</MenuItem>
)}
</Box>
{/* Delete / Branch / Truncate */}
{!!props.onMessageDelete && <ListDivider />}
{!!props.onMessageDelete && (
<MenuItem onClick={handleOpsDelete} disabled={false /*fromSystem*/}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
Delete
<span style={{ opacity: 0.5 }}>message</span>
</MenuItem>
)}
{!!props.onConversationBranch && (
<MenuItem onClick={handleOpsConversationBranch} disabled={fromSystem}>
{!!props.onMessageBranch && <ListDivider />}
{!!props.onMessageBranch && (
<MenuItem onClick={handleOpsBranch} disabled={fromSystem}>
<ListItemDecorator>
<ForkRightIcon />
</ListItemDecorator>
@@ -525,13 +713,40 @@ function ChatMessage(props: {
{!props.isBottom && <span style={{ opacity: 0.5 }}>from here</span>}
</MenuItem>
)}
{!!props.onConversationTruncate && (
{!!props.onMessageDelete && (
<MenuItem onClick={handleOpsDelete} disabled={false /*fromSystem*/}>
<ListItemDecorator><ClearIcon /></ListItemDecorator>
Delete
<span style={{ opacity: 0.5 }}>message</span>
</MenuItem>
)}
{!!props.onMessageTruncate && (
<MenuItem onClick={handleOpsTruncate} disabled={props.isBottom}>
<ListItemDecorator><VerticalAlignBottomIcon /></ListItemDecorator>
Truncate
<span style={{ opacity: 0.5 }}>after this</span>
</MenuItem>
)}
{/* Diagram / Draw / Speak */}
{!!props.onTextDiagram && <ListDivider />}
{!!props.onTextDiagram && (
<MenuItem onClick={handleOpsDiagram} disabled={!couldDiagram}>
<ListItemDecorator><AccountTreeOutlinedIcon /></ListItemDecorator>
Auto-Diagram ...
</MenuItem>
)}
{!!props.onTextImagine && (
<MenuItem onClick={handleOpsImagine} disabled={!couldImagine || props.isImagining}>
<ListItemDecorator>{props.isImagining ? <CircularProgress size='sm' /> : <FormatPaintOutlinedIcon />}</ListItemDecorator>
Auto-Draw
</MenuItem>
)}
{!!props.onTextSpeak && (
<MenuItem onClick={handleOpsSpeak} disabled={!couldSpeak || props.isSpeaking}>
<ListItemDecorator>{props.isSpeaking ? <CircularProgress size='sm' /> : <RecordVoiceOverOutlinedIcon />}</ListItemDecorator>
Speak
</MenuItem>
)}
{/* Diff Viewer */}
{!!props.diffPreviousText && <ListDivider />}
{!!props.diffPreviousText && (
@@ -541,44 +756,98 @@ function ChatMessage(props: {
<Switch checked={showDiff} onChange={handleOpsToggleShowDiff} sx={{ ml: 'auto' }} />
</MenuItem>
)}
{/* Diagram / Draw / Speak */}
{!!props.onTextDiagram && <ListDivider />}
{!!props.onTextDiagram && (
<MenuItem onClick={handleOpsDiagram} disabled={!couldDiagram}>
<ListItemDecorator><AccountTreeIcon color='success' /></ListItemDecorator>
Diagram ...
</MenuItem>
)}
{!!props.onTextImagine && (
<MenuItem onClick={handleOpsImagine} disabled={!couldImagine || props.isImagining}>
<ListItemDecorator>{props.isImagining ? <CircularProgress size='sm' /> : <FormatPaintIcon color='success' />}</ListItemDecorator>
Draw ...
</MenuItem>
)}
{!!props.onTextSpeak && (
<MenuItem onClick={handleOpsSpeak} disabled={!couldSpeak || props.isSpeaking}>
<ListItemDecorator>{props.isSpeaking ? <CircularProgress size='sm' /> : <RecordVoiceOverIcon color='success' />}</ListItemDecorator>
Speak
</MenuItem>
)}
{/* Restart/try */}
{!!props.onConversationRestartFrom && <ListDivider />}
{!!props.onConversationRestartFrom && (
<MenuItem onClick={handleOpsConversationRestartFrom}>
{/* Beam/Restart */}
{(!!props.onMessageAssistantFrom || !!props.onMessageBeam) && <ListDivider />}
{!!props.onMessageAssistantFrom && (
<MenuItem disabled={fromSystem} onClick={handleOpsAssistantFrom}>
<ListItemDecorator>{fromAssistant ? <ReplayIcon color='primary' /> : <TelegramIcon color='primary' />}</ListItemDecorator>
{!fromAssistant
? <>Restart <span style={{ opacity: 0.5 }}>from here</span></>
: !props.isBottom
? <>Retry <span style={{ opacity: 0.5 }}>from here</span></>
: <Box sx={{ flexGrow: 1, display: 'flex', justifyContent: 'space-between', gap: 1 }}>
Retry
<KeyStroke combo='Ctrl + Shift + R' />
</Box>}
: <Box sx={{ flexGrow: 1, display: 'flex', justifyContent: 'space-between', gap: 1 }}>Retry<KeyStroke combo='Ctrl + Shift + R' /></Box>}
</MenuItem>
)}
{!!props.onMessageBeam && (
<MenuItem disabled={fromSystem} onClick={handleOpsBeamFrom}>
<ListItemDecorator>
<ChatBeamIcon color={fromSystem ? undefined : 'primary'} />
</ListItemDecorator>
{!fromAssistant
? <>Beam <span style={{ opacity: 0.5 }}>from here</span></>
: !props.isBottom
? <>Beam <span style={{ opacity: 0.5 }}>this message</span></>
: <Box sx={{ flexGrow: 1, display: 'flex', justifyContent: 'space-between', gap: 1 }}>Beam<KeyStroke combo='Ctrl + Shift + B' /></Box>}
</MenuItem>
)}
</CloseableMenu>
)}
{/* Selection Toolbar */}
{ENABLE_SELECTION_TOOLBAR && !!selToolbarAnchor && (
<Popper placement='top-start' open anchorEl={selToolbarAnchor} slotProps={{
root: { style: { zIndex: themeZIndexPageBar + 1 } },
}}>
<ClickAwayListener onClickAway={() => closeToolbar()}>
<ButtonGroup
variant='plain'
sx={{
'--ButtonGroup-separatorColor': 'none !important',
'--ButtonGroup-separatorSize': 0,
borderRadius: '0',
backgroundColor: 'background.popup',
border: '1px solid',
borderColor: 'primary.outlinedBorder',
boxShadow: '0px 4px 12px -4px rgb(var(--joy-palette-neutral-darkChannel) / 50%)',
mb: 1,
ml: -1,
alignItems: 'center',
'& > button': {
'--Icon-fontSize': '1rem',
minHeight: '2.5rem',
minWidth: '2.75rem',
},
}}
>
{!!props.onReplyTo && fromAssistant && <Tooltip disableInteractive arrow placement='top' title='Reply'>
<IconButton color='primary' onClick={handleOpsReplyTo}>
<ReplyRoundedIcon sx={{ fontSize: 'xl' }} />
</IconButton>
</Tooltip>}
{/*{!!props.onMessageBeam && fromAssistant && <Tooltip disableInteractive arrow placement='top' title='Beam'>*/}
{/* <IconButton color='primary'>*/}
{/* <ChatBeamIcon sx={{ fontSize: 'xl' }} />*/}
{/* </IconButton>*/}
{/*</Tooltip>}*/}
{!!props.onReplyTo && fromAssistant && <MoreVertIcon sx={{ color: 'neutral.outlinedBorder', fontSize: 'md' }} />}
<Tooltip disableInteractive arrow placement='top' title='Copy'>
<IconButton onClick={handleOpsCopy}>
<ContentCopyIcon />
</IconButton>
</Tooltip>
{(!!props.onTextDiagram || !!props.onTextSpeak) && <MoreVertIcon sx={{ color: 'neutral.outlinedBorder', fontSize: 'md' }} />}
{!!props.onTextDiagram && <Tooltip disableInteractive arrow placement='top' title={couldDiagram ? 'Auto-Diagram...' : 'Too short to Auto-Diagram'}>
<IconButton onClick={couldDiagram ? handleOpsDiagram : undefined}>
<AccountTreeOutlinedIcon sx={{ color: couldDiagram ? 'primary' : 'neutral.plainDisabledColor' }} />
</IconButton>
</Tooltip>}
{/*{!!props.onTextImagine && <Tooltip disableInteractive arrow placement='top' title='Auto-Draw'>*/}
{/* <IconButton onClick={handleOpsImagine} disabled={!couldImagine || props.isImagining}>*/}
{/* {!props.isImagining ? <FormatPaintOutlinedIcon /> : <CircularProgress sx={{ '--CircularProgress-size': '16px' }} />}*/}
{/* </IconButton>*/}
{/*</Tooltip>}*/}
{!!props.onTextSpeak && <Tooltip disableInteractive arrow placement='top' title='Speak'>
<IconButton onClick={handleOpsSpeak} disabled={!couldSpeak || props.isSpeaking}>
{!props.isSpeaking ? <RecordVoiceOverOutlinedIcon /> : <CircularProgress sx={{ '--CircularProgress-size': '16px' }} />}
</IconButton>
</Tooltip>}
</ButtonGroup>
</ClickAwayListener>
</Popper>
)}
{/* Selection (Contextual) Menu */}
{!!selMenuAnchor && (
<CloseableMenu
@@ -586,20 +855,21 @@ function ChatMessage(props: {
open anchorEl={selMenuAnchor} onClose={closeSelectionMenu}
sx={{ minWidth: 220 }}
>
<MenuItem onClick={handleOpsCopy} sx={{ flex: 1 }}>
<MenuItem onClick={handleOpsCopy} sx={{ flex: 1, alignItems: 'center' }}>
<ListItemDecorator><ContentCopyIcon /></ListItemDecorator>
Copy <span style={{ opacity: 0.5 }}>selection</span>
Copy
</MenuItem>
{!!props.onTextDiagram && <ListDivider />}
{!!props.onTextDiagram && <MenuItem onClick={handleOpsDiagram} disabled={!couldDiagram || props.isImagining}>
<ListItemDecorator><AccountTreeIcon color='success' /></ListItemDecorator>
Diagram ...
<ListItemDecorator><AccountTreeOutlinedIcon /></ListItemDecorator>
Auto-Diagram ...
</MenuItem>}
{!!props.onTextImagine && <MenuItem onClick={handleOpsImagine} disabled={!couldImagine || props.isImagining}>
<ListItemDecorator>{props.isImagining ? <CircularProgress size='sm' /> : <FormatPaintIcon color='success' />}</ListItemDecorator>
Imagine
<ListItemDecorator>{props.isImagining ? <CircularProgress size='sm' /> : <FormatPaintOutlinedIcon />}</ListItemDecorator>
Auto-Draw
</MenuItem>}
{!!props.onTextSpeak && <MenuItem onClick={handleOpsSpeak} disabled={!couldSpeak || props.isSpeaking}>
<ListItemDecorator>{props.isSpeaking ? <CircularProgress size='sm' /> : <RecordVoiceOverIcon color='success' />}</ListItemDecorator>
<ListItemDecorator>{props.isSpeaking ? <CircularProgress size='sm' /> : <RecordVoiceOverOutlinedIcon />}</ListItemDecorator>
Speak
</MenuItem>}
</CloseableMenu>
@@ -16,7 +16,7 @@ import { makeAvatar, messageBackground } from './ChatMessage';
export const MessagesSelectionHeader = (props: { hasSelected: boolean, sumTokens: number, onClose: () => void, onSelectAll: (selected: boolean) => void, onDeleteMessages: () => void }) =>
<Sheet color='warning' variant='solid' invertedColors sx={{
display: 'flex', flexDirection: 'row', alignItems: 'center',
position: 'fixed', top: 0, left: 0, right: 0, zIndex: 101,
position: 'fixed', top: 0, left: 0, right: 0, zIndex: 101 /* Cleanup Selection Header on top of messages */,
boxShadow: 'md',
gap: { xs: 1, sm: 2 }, px: { xs: 1, md: 2 }, py: 1,
}}>
@@ -0,0 +1,85 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, IconButton, Tooltip, Typography } from '@mui/joy';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import ReplyRoundedIcon from '@mui/icons-material/ReplyRounded';
// configuration
const INLINE_COLOR = 'primary';
const bubbleComposerSx: SxProps = {
// contained
width: '100%',
zIndex: 2, // stays on top of the 'tokens' bubble in the composer
// style
backgroundColor: 'background.surface',
border: '1px solid',
borderColor: 'neutral.outlinedBorder',
borderRadius: 'sm',
boxShadow: 'xs',
padding: '0.5rem 0.25rem 0.5rem 0.5rem',
// layout
display: 'flex',
alignItems: 'start',
};
const inlineMessageSx: SxProps = {
...bubbleComposerSx,
// redefine
// border: 'none',
mt: 1,
borderColor: `${INLINE_COLOR}.outlinedColor`,
borderRadius: 'sm',
boxShadow: 'xs',
width: undefined,
padding: '0.375rem 0.25rem 0.375rem 0.5rem',
// self-layout (parent: 'block', as 'grid' was not working and the user would scroll the app on the x-axis on mobile)
// ml: 'auto',
float: 'inline-end',
mr: { xs: 7.75, md: 10.5 }, // personaSx.minWidth + gap (md: 1) + 1.5 (text margin)
};
export function ReplyToBubble(props: {
replyToText: string | null,
inlineMessage?: boolean
onClear?: () => void,
className?: string,
}) {
return (
<Box className={props.className} sx={!props.inlineMessage ? bubbleComposerSx : inlineMessageSx}>
<Tooltip disableInteractive arrow title='Referring to this assistant text' placement='top'>
<ReplyRoundedIcon sx={{
color: props.inlineMessage ? `${INLINE_COLOR}.outlinedColor` : 'primary.solidBg',
fontSize: 'xl',
mt: 0.125,
}} />
</Tooltip>
<Typography level='body-sm' sx={{
flex: 1,
ml: 1,
mr: 0.5,
overflow: 'auto',
maxHeight: '5.75rem',
lineHeight: 'xl',
color: /*props.inlineMessage ? 'text.tertiary' :*/ 'text.secondary',
whiteSpace: 'break-spaces', // 'balance'
}}>
{props.replyToText}
</Typography>
{!!props.onClear && (
<IconButton size='sm' onClick={props.onClear} sx={{ my: -0.5, background: 'none' }}>
<CloseRoundedIcon />
</IconButton>
)}
</Box>
);
}
@@ -1,141 +0,0 @@
import * as React from 'react';
import { Alert, Box, IconButton, Tooltip, Typography } from '@mui/joy';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import ReplayIcon from '@mui/icons-material/Replay';
import { Link } from '~/common/components/Link';
import type { ImageBlock } from './blocks';
import { overlayButtonsSx } from './code/RenderCode';
const mdImageReferenceRegex = /^!\[([^\]]*)]\(([^)]+)\)$/;
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|svg)/i;
/**
* Checks if the entire content consists solely of Markdown image references.
* If so, returns an array of ImageBlock objects for each image reference.
* If any non-image content is present or if there are no image references, returns null.
*/
export function heuristicMarkdownImageReferenceBlocks(fullText: string) {
// Check if all lines are valid Markdown image references with image URLs
const imageBlocks: ImageBlock[] = [];
for (const line of fullText.split('\n')) {
if (line.trim() === '') continue; // skip empty lines
const match = mdImageReferenceRegex.exec(line);
if (match && imageExtensions.test(match[2])) {
const alt = match[1];
const url = match[2];
imageBlocks.push({ type: 'image', url, alt });
} else {
// if there is any outlier line, return null
return null;
}
}
// Return the image blocks if all lines are image references with valid image URLs
return imageBlocks.length > 0 ? imageBlocks : null;
}
const prodiaUrlRegex = /^(https?:\/\/images\.prodia\.\S+)$/i;
/**
* Legacy heuristic for detecting images from "images.prodia." URLs.
*/
export function heuristicLegacyImageBlocks(fullText: string): ImageBlock[] | null {
// Check if all lines are URLs starting with "http://images.prodia." or "https://images.prodia."
const imageBlocks: ImageBlock[] = [];
for (const line of fullText.split('\n')) {
const match = prodiaUrlRegex.exec(line);
if (match) {
const url = match[1];
imageBlocks.push({ type: 'image', url });
} else {
// if there is any outlier line, return null
return null;
}
}
// Return the image blocks if all lines are URLs from "images.prodia."
return imageBlocks.length > 0 ? imageBlocks : null;
}
export const RenderImage = (props: { imageBlock: ImageBlock, isFirst: boolean, allowRunAgain: boolean, onRunAgain?: (e: React.MouseEvent) => void }) => {
const { url, alt } = props.imageBlock;
const imageUrls = url.split('\n');
return imageUrls.map((url, index) => {
// display a notice for temporary images DallE
const isTempDalleUrl = url.startsWith('https://oaidalle');
return <Box
key={'gen-img-' + index}
sx={{
display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', position: 'relative',
mx: 1.5, mb: 1.5, // mt: (index > 0 || !props.isFirst) ? 1.5 : 0,
// p: 1, border: '1px solid', borderColor: 'divider', borderRadius: 1,
minWidth: 128, minHeight: 128,
boxShadow: 'md',
backgroundColor: 'neutral.solidBg',
'& picture': { display: 'flex' },
'& img': { maxWidth: '100%', maxHeight: '100%' },
'&:hover > .overlay-buttons': { opacity: 1 },
}}
>
{/* External Image */}
{alt ? (
<Tooltip
variant='outlined' color='neutral'
title={
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
{isTempDalleUrl && <Alert variant='soft' color='warning' sx={{ flexDirection: 'column', alignItems: 'start' }}>
<Typography level='title-sm'> Temporary Image</Typography>
<Typography level='body-sm'>
This image will be deleted from the OpenAI servers in one hour. <b>Please save it to your device</b>.
</Typography>
{/*<Typography level='body-xs'>*/}
{/* The following is the re-written DALL·E prompt that generated this image.*/}
{/*</Typography>*/}
</Alert>}
<Typography level='title-sm' sx={{ p: 2 }}>
{alt}
</Typography>
</Box>
}
placement='top-start'
sx={{
maxWidth: { sm: '90vw', md: '70vw' },
boxShadow: 'md',
}}
>
<picture><img src={url} alt={`Generated Image: ${alt}`} /></picture>
</Tooltip>
) : (
<picture><img src={url} alt='Generated Image' /></picture>
)}
{/* Image Buttons */}
<Box className='overlay-buttons' sx={{ ...overlayButtonsSx, pt: 0.5, px: 0.5, gap: 0.5 }}>
{props.allowRunAgain && !!props.onRunAgain && (
<Tooltip title='Draw again' variant='solid'>
<IconButton variant='solid' onClick={props.onRunAgain}>
<ReplayIcon />
</IconButton>
</Tooltip>
)}
<Tooltip title='Open in new tab'>
<IconButton component={Link} href={url} download={alt || 'image'} target='_blank' variant='solid'>
<OpenInNewIcon />
</IconButton>
</Tooltip>
</Box>
</Box>;
});
};
@@ -1,28 +0,0 @@
import * as React from 'react';
import { Box } from '@mui/joy';
import { SxProps } from '@mui/joy/styles/types';
import type { LatexBlock } from './blocks';
// Dynamically import the Katex functions
const RenderLatexDynamic = React.lazy(async () => {
const { InlineMath } = await import('react-katex');
return {
default: (props: { latex: string }) => <InlineMath math={props.latex} />,
};
});
export const RenderLatex = (props: { latexBlock: LatexBlock; sx?: SxProps; }) =>
<Box
sx={{
mx: 1.5,
my: '0.5em',
textAlign: 'center',
...props.sx,
}}>
<React.Suspense fallback={<div />}>
<RenderLatexDynamic latex={props.latexBlock.latex} />
</React.Suspense>
</Box>;
@@ -1,134 +0,0 @@
import * as React from 'react';
import { CSVLink } from 'react-csv';
import type { SxProps } from '@mui/joy/styles/types';
import { Box, Button, styled } from '@mui/joy';
import DownloadIcon from '@mui/icons-material/Download';
import { lineHeightChatText } from '~/common/app.theme';
import type { TextBlock } from './blocks';
/*
* For performance reasons, we style this component here and copy the equivalent of 'props.sx' (the lineHeight) locally.
*/
const RenderMarkdownBox = styled(Box)({
// same look as the other RenderComponents
marginInline: '0.75rem !important', // margin: 1.5 like other blocks
lineHeight: lineHeightChatText,
// patch the CSS
// fontFamily: `inherit !important`, // (not needed anymore, as CSS is under our control) use the default font family
// '--color-canvas-default': 'transparent !important', // (not needed anymore) remove the default background color
'& table': { width: 'inherit !important' }, // un-break auto-width (tables have 'max-content', which overflows)
});
// Dynamically import ReactMarkdown using React.lazy
const DynamicReactGFM = React.lazy(async () => {
const [markdownModule, remarkGfmModule] = await Promise.all([
import('react-markdown'),
import('remark-gfm'),
]);
// NOTE: extracted here instead of inline as a large performance optimization
const remarkPlugins = [remarkGfmModule.default];
//Extracts table data from jsx element in table renderer
const extractTableData = (children: React.JSX.Element) => {
// Function to extract text from a React element or component
const extractText = (element: any): String => {
// Base case: if the element is a string, return it
if (typeof element === 'string') {
return element;
}
// If the element has children, recursively extract text from them
if (element.props && element.props.children) {
if (Array.isArray(element.props.children)) {
return element.props.children.map(extractText).join('');
}
return extractText(element.props.children);
}
return '';
};
// Function to traverse and extract data from table rows and cells
const traverseAndExtract = (elements: any, tableData: any[] = []) => {
React.Children.forEach(elements, (element) => {
if (element.type === 'tr') {
const rowData = React.Children.map(element.props.children, (cell) => {
// Extract and return the text content of each cell
return extractText(cell);
});
tableData.push(rowData);
} else if (element.props && element.props.children) {
traverseAndExtract(element.props.children, tableData);
}
});
return tableData;
};
return traverseAndExtract(children);
};
interface TableRendererProps {
children: React.JSX.Element;
node?: any; // an optional field we want to not pass to the <table/> element
}
// Define a custom table renderer
const TableRenderer = ({ children, node, ...props }: TableRendererProps) => {
// Apply custom styles or modifications here
const tableData = extractTableData(children);
return (
<>
<table style={{ borderCollapse: 'collapse', width: '100%', marginBottom: '0.5rem' }} {...props}>
{children}
</table>
<CSVLink filename='big-agi-export' data={tableData}>
<Button variant='outlined' color='neutral' size='md' endDecorator={<DownloadIcon />} sx={{
mb: '1rem',
backgroundColor: 'background.popup', // make this button 'pop' a bit from the page
}}>
Download table as .csv
</Button>
</CSVLink>
</>
);
};
// Use the custom renderer for tables
const components = {
table: TableRenderer,
// Add custom renderers for other elements if needed
};
// Pass the dynamically imported remarkGfm as children
const ReactMarkdownWithRemarkGfm = (props: any) =>
<markdownModule.default
remarkPlugins={remarkPlugins}
{...props}
components={components}
/>;
return { default: ReactMarkdownWithRemarkGfm };
});
function RenderMarkdown(props: { textBlock: TextBlock; sx?: SxProps; }) {
return (
<RenderMarkdownBox
className='markdown-body' /* NODE: see GithubMarkdown.css for the dark/light switch, synced with Joy's */
sx={props.sx}
>
<React.Suspense fallback={<div>Loading...</div>}>
<DynamicReactGFM>
{props.textBlock.content}
</DynamicReactGFM>
</React.Suspense>
</RenderMarkdownBox>
);
}
export const RenderMarkdownMemo = React.memo(RenderMarkdown);
@@ -1,50 +0,0 @@
import * as React from 'react';
import { Button, Tooltip } from '@mui/joy';
interface CodeBlockProps {
codeBlock: {
code: string;
language?: string;
};
}
export function ButtonCodepen({ codeBlock }: CodeBlockProps): React.JSX.Element {
const { code, language } = codeBlock;
const hasCSS = language === 'css';
const hasJS = ['javascript', 'json', 'typescript'].includes(language || '');
const hasHTML = !hasCSS && !hasJS; // use HTML as fallback if an unanticipated frontend language is used
const handleOpenInCodepen = () => {
const data = {
title: `GPT ${new Date().toISOString()}`, // eg "GPT 2021-08-31T15:00:00.000Z"
css: hasCSS ? code : '',
html: hasHTML ? code : '',
js: hasJS ? code : '',
editors: `${hasHTML ? 1 : 0}${hasCSS ? 1 : 0}${hasJS ? 1 : 0}` // eg '101' for HTML, JS
};
const form = document.createElement('form');
form.method = 'POST';
form.action = 'https://codepen.io/pen/define';
form.target = '_blank';
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'data';
input.value = JSON.stringify(data);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
};
return (
<Tooltip title='Open in Codepen' variant='solid'>
<Button variant='outlined' color='neutral' onClick={handleOpenInCodepen}>
Codepen
</Button>
</Tooltip>
);
}

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