[PR #5955] [MERGED] feat: add code execution status to chat messages. #8593

Closed
opened 2025-11-11 18:00:35 -06:00 by GiteaMirror · 0 comments
Owner

📋 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: devHead: code-execution-message


📝 Commits (1)

  • 9fbff16 feat: 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_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:

Screenshot from 2024-09-10 23-08-47

ChatGPT code execution modal:

Screenshot from 2024-09-10 23-09-06

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

Code execution video


🔄 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**: ![Screenshot from 2024-09-10 23-08-47](https://github.com/user-attachments/assets/ecb2cd32-5192-4792-9534-563a12f75935) **ChatGPT code execution modal**: ![Screenshot from 2024-09-10 23-09-06](https://github.com/user-attachments/assets/1f29ec2c-d082-4c0d-b756-d395259cd57a) **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 ![Code execution video](https://raw.githubusercontent.com/EtiennePerot/safe-code-execution/refs/heads/code-execution-status/res/code-execution-tool.gif) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 18:00:35 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#8593