In a chat opened in a tab beside another chat, the Reference Chats list left out the chat in the main view and offered the tab's own chat, so a chat could be attached to itself. The list now leaves out the chat you are typing in, whether it is open in the main view or in a tab.
Fixes#34203
* refac: chat input reads its terminal from the chat it belongs to
The message input with its menus, skills dialog and command lists read the selected terminal and the terminal's skills from one page-wide place. They now get both from the chat they are part of. Every chat still hands over the same page-wide selection, so nothing changes for users. This prepares for chats that run next to the main chat and keep their own terminal; the text editor inside the input, the message list, the model list and the current side chat's own request still look the terminal up page-wide.
* refac: the chat builds the key for its unsent input in one place
The chat spelled out the storage key for its unsent input in six places. One function builds it now, with the same keys as before, so nothing changes for users. This prepares for chats that run next to the main chat and keep their unsent input apart.
* fix: two chats on one page take each other's unsent text, input requests and regenerate shortcut
With a chat open next to a note, three things reached the wrong chat. Text typed into a new chat next to a note replaced the unsent text of a new main chat. An input request from a tool was answered as cancelled by the other chat on the page before its dialog could show. The regenerate shortcut, pressed in the main chat's input, regenerated the note chat's answer. Each chat now keeps its own unsent text and leaves the other chat's input requests alone, and the shortcut takes the main chat's last answer.
* refac: let the chat run inside a side chat tab
A second copy of the chat can already run on the same page, next to a note. This prepares it to run in a side chat tab too: it can be opened with a given conversation, unsent input and first message, and it sends the parent chat's messages to the model as context while showing only what was written in the side chat. A chat in a side tab keeps away from what belongs to the main chat: it uses the main chat's terminal without changing it, and it leaves the last used model, sign-in redirects and prompts sent by embeds to the main chat. Nothing opens a chat in a side tab yet, so the main chat and the chat next to a note behave as before.
* refac: side chat uses the same chat as the main view
The side chat was a separate, reduced version of the chat with its own code for sending, streaming and loading, so many chat features were missing or behaved differently there. A side chat tab now runs the same chat as the main view and the separate version is removed. Message buttons, sources, token usage, follow-ups, slash commands, queued messages, chat variables and tool events such as code execution and input requests now work in a side chat. Chats saved by the old side chat still open, and in most places where the old side chat had its own rules it now follows the main chat, for example it can answer with several models at once and shows errors as notifications. A new chat opened in a tab on its own, for example from a pinned model, no longer gets the neighbouring chat's system prompt and the side conversation instruction saved as its own.
Fixes#34029
Opened by an address such as http://192.168.1.20:8080 (no HTTPS, not localhost), the browser gives the page no direct clipboard access, and several things broke. Copy link on a comment and in search, Copy Share Link in Shared Chats, the webhook Copy URL, the Chat ID in the chat status bar, Copy branch name and Copy commit hash in the Git panel and the copy button of spreadsheet previews copied nothing, Copy Formatted Text pasted the ** and # symbols instead of the formatting, copied text lost its last line break, prompts using {{CLIPBOARD}} could not be inserted, and switching on Auto-Copy Response did nothing and was not saved. These copies now work on such addresses with the exact text and formatting, and {{CLIPBOARD}} prompts insert with the "Failed to read clipboard contents" message shown whenever the browser refuses clipboard access. Auto-Copy Response cannot work there, since the browser only lets a page copy right after a click, so the switch now stays off and shows its clipboard permission message.
Fixes#33927Fixes#33934Fixes#33935Fixes#33937Fixes#33938
On a phone, closing the + menu put the cursor back in the message box, so the on-screen keyboard popped up every time someone switched on Web Search, picked a tool or just opened and closed the menu. The old Integrations menu already skipped this on phones, but that was lost when the integrations moved into the + menu. Now the + menu leaves the message box alone on a phone too, and on a desktop it still puts the cursor back in the message box.
Fixes#33881
On a wide screen a voice call opens as a Voice tab next to the chat. After switching to the chat tab during the call, the voice button in the message box changes to Return to call, but clicking it did nothing and the call kept running out of view. Return to call now shows the Voice tab again, the same as clicking it in the tab bar.
Fixes#33884
Turning Temporary Chat on or off on a folder's page, with the button at the top or with /temporary, sent you to the home page. The next chat was then not saved in the folder and did not get the folder's system prompt, default model or knowledge. You now stay on the folder page and only Temporary Chat switches.
Fixes#33448
Prompts could use the user's name and email but not their role, so role-aware system prompts needed a custom Filter function. Model system prompts, the user's own system prompt, saved prompts used with a slash command and chat requests through the API now replace {{USER_ROLE}} with the role, such as admin or user. Requested in #4765.
* fix: knowledge, note and chat attach entries open while file upload is off
When a user may not attach files (no file upload permission, or a selected model without "File Upload"), the "+" menu greys out "Attach Knowledge", "Reference Chats" and "Attach Notes", but they still opened, and the picked item vanished from the input without a message. Knowledge picked from the "#" and "@" lists vanished the same way, and the "#" list offered a pasted link to users without the web upload permission, which only answered "You do not have permission to upload web content". The greyed entries now do nothing on click, like "Attach Files" next to them, and the "#" and "@" lists leave out what the user cannot attach.
Refs #32830
* refac: drop type annotations on the upload flag to match neighbours
The new upload flag declarations now follow the untyped style of the lines around them.
* fix: hide attach entries in the # and @ lists from the first keystroke
The chat input now works out on its own whether files can be attached, so the lists no longer wait for the + menu to report it.
* fix: Call button shows while speech-to-text is unavailable
Unless realtime voice is set up, a call needs the server to turn the user's speech into text. The Call button still showed when the speech-to-text engine is "Web API", where clicking it only answered "Call feature is not supported when using Web STT engine", and to users without the speech-to-text permission, where the call opened but nothing they said was transcribed. The button now shows only when a call can work: realtime voice is on, a call is already running, or the engine is not "Web API" and the user has the speech-to-text permission.
Refs #32830
* fix: keyboard shortcut also needs the speech-to-text permission for calls
The call shortcut and call links now follow the same speech-to-text rule as the Call button.
* refac: keep the whole Call button condition in one place
Also drops the Web API speech-to-text message from the Call button, since the button no longer shows for that engine.
* refac: keep the call permission check unchanged in the call shortcut
The speech-to-text rule for the call shortcut is now its own check after the existing call permission check, which stays as it was.
* fix: /skills:create shows for models that cannot create skills
"/skills:create" showed when the model had the "Builtin Tools" capability or its "Skills" built-in tool turned off, and the model then answered that skill creation is disabled. The command now shows only when every selected model has both turned on.
Refs #32830
* refac: keep the skill creation check with the other model capability checks
Moves the check next to the other per-model capability checks so it reads like them.
* refac: add type annotations to the skill creation check
Restores the type on the new option and types the new check.