This PR adds code_executions as an array of code execution statuses to chat messages. The intent of this data is to be displayed in a similar manner as citations: at the bottom of the message, with buttons that open a modal for more info. As a point of reference, here is how similar data looks in ChatGPT when it executes code:
ChatGPT code execution status:
ChatGPT code execution modal:
Why not use the existing "citations" modals? Code execution data doesn't fit well in that, because it fundamentally differs in its formatting. Code execution status includes the code that was run (which benefits from being syntax-highlighted), and the output and generated files. This differs from citations which are just list of document names and links.
Additionally, code execution is a process, whereas citations are only emitted once. This is why code execution data uses an ID-based approach, where each code execution instance is identified by a unique ID and can be updated by emitting a new code_execution message with the same ID. This allows the code execution status to be updated as code runs.
Pull Request Checklist
Before submitting, make sure you've checked the following:
Target branch:dev
Description: See above.
Changelog: OK.
Documentation: No documentation to update.
Dependencies: No new dependencies.
Testing: Manually tested to produce buttons similar to citations at the bottom of messages.
Code review: OK.
Prefix:feat
Changelog Entry
Description
Citation messages can now be used to convey code execution status.
Added
New type of citation to display code execution status.
Screenshots or Videos
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/5955
**Author:** [@EtiennePerot](https://github.com/EtiennePerot)
**Created:** 10/7/2024
**Status:** ✅ Merged
**Merged:** 10/14/2024
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `code-execution-message`
---
### 📝 Commits (1)
- [`9fbff16`](https://github.com/open-webui/open-webui/commit/9fbff16a08f4435a07b3c2fbd932df5d41ccc1d6) feat: add code execution status to chat messages.
### 📊 Changes
**5 files changed** (+250 additions, -4 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/components/chat/Chat.svelte` (+23 -3)
📝 `src/lib/components/chat/Messages/CodeBlock.svelte` (+2 -1)
➕ `src/lib/components/chat/Messages/CodeExecutionModal.svelte` (+115 -0)
➕ `src/lib/components/chat/Messages/CodeExecutions.svelte` (+95 -0)
📝 `src/lib/components/chat/Messages/ResponseMessage.svelte` (+15 -0)
</details>
### 📄 Description
This PR adds `code_executions` as an array of code execution statuses to chat messages. The intent of this data is to be displayed in a similar manner as citations: at the bottom of the message, with buttons that open a modal for more info. As a point of reference, here is how similar data looks in ChatGPT when it executes code:
**ChatGPT code execution status**:

**ChatGPT code execution modal**:

**Why not use the existing "citations" modals?** Code execution data doesn't fit well in that, because it fundamentally differs in its formatting. Code execution status includes the code that was run (which benefits from being syntax-highlighted), and the output and generated files. This differs from citations which are just list of document names and links.
Additionally, code execution is a process, whereas citations are only emitted once. This is why code execution data uses an ID-based approach, where each code execution instance is identified by a unique ID and can be updated by emitting a new `code_execution` message with the same ID. This allows the code execution status to be updated as code runs.
# Pull Request Checklist
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** `dev`
- [x] **Description:** See above.
- [x] **Changelog:** OK.
- [x] **Documentation:** No documentation to update.
- [x] **Dependencies:** No new dependencies.
- [x] **Testing:** Manually tested to produce buttons similar to citations at the bottom of messages.
- [x] **Code review:** OK.
- [x] **Prefix:** `feat`
# Changelog Entry
### Description
Citation messages can now be used to convey code execution status.
### Added
* New type of citation to display code execution status.
### Screenshots or Videos

---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/5955
Author: @EtiennePerot
Created: 10/7/2024
Status: ✅ Merged
Merged: 10/14/2024
Merged by: @tjbck
Base:
dev← Head:code-execution-message📝 Commits (1)
9fbff16feat: add code execution status to chat messages.📊 Changes
5 files changed (+250 additions, -4 deletions)
View changed files
📝
src/lib/components/chat/Chat.svelte(+23 -3)📝
src/lib/components/chat/Messages/CodeBlock.svelte(+2 -1)➕
src/lib/components/chat/Messages/CodeExecutionModal.svelte(+115 -0)➕
src/lib/components/chat/Messages/CodeExecutions.svelte(+95 -0)📝
src/lib/components/chat/Messages/ResponseMessage.svelte(+15 -0)📄 Description
This PR adds
code_executionsas an array of code execution statuses to chat messages. The intent of this data is to be displayed in a similar manner as citations: at the bottom of the message, with buttons that open a modal for more info. As a point of reference, here is how similar data looks in ChatGPT when it executes code:ChatGPT code execution status:
ChatGPT code execution modal:
Why not use the existing "citations" modals? Code execution data doesn't fit well in that, because it fundamentally differs in its formatting. Code execution status includes the code that was run (which benefits from being syntax-highlighted), and the output and generated files. This differs from citations which are just list of document names and links.
Additionally, code execution is a process, whereas citations are only emitted once. This is why code execution data uses an ID-based approach, where each code execution instance is identified by a unique ID and can be updated by emitting a new
code_executionmessage with the same ID. This allows the code execution status to be updated as code runs.Pull Request Checklist
Before submitting, make sure you've checked the following:
devfeatChangelog Entry
Description
Citation messages can now be used to convey code execution status.
Added
Screenshots or Videos
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.