(edited)
The AI speech should be written quickly and not in this way, so that the site stops for about 5 seconds until the AI finishes its speech in a strange way, as I will attach in the video. This is a very annoying reality. I have been in this problem for a week and I cannot find a solution. I am even starting to lose hope in the project. I will attach all the codes and all the pictures that are posted. What is happening?
[image]

/* eslint-disable @typescript-eslint/no-unused-vars */"use client"import { Chat } from "@/components/ui/chat";import { AppSidebar } from "../components/app-sidebar"import { Icon } from "@iconify/react";import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,} from "@/components/ui/breadcrumb"import { Separator } from "@/components/ui/separator"import { Form } from '@heroui/form';import { Badge } from '@heroui/badge'import { Button, Card, CardBody, CardFooter, CardHeader, Divider, Link } from '@heroui/react';import Image from "next/image";import { Input, Textarea } from '@heroui/input'import { Avatar } from '@heroui/avatar';import { Tooltip } from '@heroui/tooltip';import ProseMirrorMarkdownEditor from "@/components/ProseMirrorMarkdownEditor";import { SidebarInset, SidebarProvider, SidebarTrigger, useSidebar } from "@/components/ui/sidebar"import { useChat } from "ai/react"import { useSession } from "next-auth/react";import { Spinner } from "@heroui/spinner"import Cookies from "js-cookie";import { useEffect, useState } from "react";import { Logo, SideBarPhoneIcon, SideBarPhoneIcon2 } from "@/components/icons";MarkDown
import React, { useEffect, useRef } from "react";import { EditorState } from "prosemirror-state";import { EditorView } from "prosemirror-view";import { schema } from "prosemirror-schema-basic";import { defaultMarkdownParser } from "prosemirror-markdown";import hljs from "highlight.js"; // Import highlight.jsimport "highlight.js/styles/github-dark.css"; // Choose any theme// Function to apply syntax highlighting to code blocksfunction addCodeHighlighting(view) { const codeBlocks = view.dom.querySelectorAll("pre code"); codeBlocks.forEach((block) => { hljs.highlightElement(block); // Apply syntax highlighting });}// Create a ProseMirror statefunction createEditorState(markdownContent) { const doc = defaultMarkdownParser.parse(markdownContent); return EditorState.create({ doc });}// React component for a read-only ProseMirror Markdown viewerfunction ProseMirrorMarkdownViewer({ initialMarkdown }) { const editorRef = useRef(null); const viewRef = useRef(null); useEffect(() => { // Initialize the editor const state = createEditorState(initialMarkdown);{ "name": "egpyt-gpt-chat", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@ai-sdk/deepseek": "^0.1.8", "@ai-sdk/fal": "^0.0.2", "@ai-sdk/fireworks": "^0.1.8", "@ai-sdk/google": "^1.1.8", "@ai-sdk/groq": "^1.1.7", "@ai-sdk/openai": "^1.1.9", "@codemirror/highlight": "^0.19.8", "@codemirror/lang-python": "^6.1.7", "@codemirror/theme-one-dark": "^6.1.2", "@fal-ai/client": "^1.2.3", "@heroui/react": "^2.6.14", "@iconify/react": "^5.2.0", "@mdx-js/loader": "^3.1.0", "@mdx-js/react": "^3.1.0", "@nanostores/react": "github:ai/react", "@next/env": "^15.1.6", "@next/mdx": "^15.1.6", "@prose-ui/core": "^1.0.4", "@prose-ui/next": "^1.0.4",