import { ChatStore, ChatStoreMessage } from "@/types/chatstore"; import { isVailedJSON } from "@/utils/isVailedJSON"; import { calculate_token_length } from "@/chatgpt"; import { Tr } from "@/translate"; import { Textarea } from "@/components/ui/textarea"; import { useContext } from "react"; import { AppChatStoreContext, AppContext } from "../pages/App"; interface Props { chat: ChatStoreMessage; setShowEdit: (se: boolean) => void; } export function EditMessageString({ chat, setShowEdit }: Props) { const { chatStore, setChatStore } = useContext(AppChatStoreContext); if (typeof chat.content !== "string") return
error
; return (
{chat.tool_call_id && ( { chat.tool_call_id = event.target.value; setChatStore({ ...chatStore }); }} /> )} {chat.tool_calls && chat.tool_calls.map((tool_call) => (
Vailed JSON:{" "} {isVailedJSON(tool_call.function.arguments) ? "🆗" : "❌"}
))}