diff --git a/web/screens/LocalServer/LocalServerRightPanel/index.tsx b/web/screens/LocalServer/LocalServerRightPanel/index.tsx
index 8cb2af350..a59e83e7e 100644
--- a/web/screens/LocalServer/LocalServerRightPanel/index.tsx
+++ b/web/screens/LocalServer/LocalServerRightPanel/index.tsx
@@ -95,7 +95,7 @@ const LocalServerRightPanel = () => {
{
clipboard.copy(selectedModel?.id)
diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx
index 87ea4e08f..096ef51e0 100644
--- a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx
+++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx
@@ -132,20 +132,6 @@ const RichTextEditor = ({
if (Editor.isBlock(editor, node) && node.type === 'paragraph') {
node.children.forEach((child: { text: any }, childIndex: number) => {
const text = child.text
- const { selection } = editor
-
- if (selection) {
- const selectedNode = Editor.node(editor, selection)
-
- if (Editor.isBlock(editor, selectedNode[0] as CustomElement)) {
- const isNodeEmpty = Editor.string(editor, selectedNode[1]) === ''
-
- if (isNodeEmpty) {
- // Reset language when a node is cleared
- currentLanguage.current = 'plaintext'
- }
- }
- }
// Match code block start and end
const startMatch = text.match(/^```(\w*)$/)
@@ -346,6 +332,14 @@ const RichTextEditor = ({
.join('\n')
setCurrentPrompt(combinedText)
+ if (combinedText.trim() === '') {
+ currentLanguage.current = 'plaintext'
+ }
+ const hasCodeBlockStart = combinedText.match(/^```(\w*)/m)
+ // Set language to plaintext if no code block with language identifier is found
+ if (!hasCodeBlockStart) {
+ currentLanguage.current = 'plaintext'
+ }
}}
>