clean up chatStore

This commit is contained in:
2024-12-27 18:02:14 +08:00
parent 092ac46c15
commit 66a6f263a5
9 changed files with 70 additions and 91 deletions

View File

@@ -1,8 +1,13 @@
import { ChatStore } from "@/types/chatstore";
import { Tr } from "@/translate";
import { useContext } from "react";
import { AppContext } from "@/pages/App";
const VersionHint = (props: { chatStore: ChatStore }) => {
const { chatStore } = props;
const VersionHint = () => {
const ctx = useContext(AppContext);
if (!ctx) return <div>error</div>;
const { chatStore } = ctx;
return (
<>
{chatStore.chatgpt_api_web_version < "v1.3.0" && (

View File

@@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef, useContext } from "react";
import { ChatStore } from "@/types/chatstore";
import { useEffect, useState, Dispatch } from "react";
@@ -10,13 +10,17 @@ import {
MicIcon,
VoicemailIcon,
} from "lucide-react";
import { AppContext } from "@/pages/App";
const WhisperButton = (props: {
chatStore: ChatStore;
inputMsg: string;
setInputMsg: Dispatch<string>;
}) => {
const { chatStore, inputMsg, setInputMsg } = props;
const ctx = useContext(AppContext);
if (!ctx) return <div>error</div>;
const { chatStore } = ctx;
const { inputMsg, setInputMsg } = props;
const mediaRef = createRef();
const [isRecording, setIsRecording] = useState("Mic");
return (