ignore ctx is null early return

This commit is contained in:
2025-01-07 23:52:48 +08:00
parent 001eca79f6
commit 20a152b899
14 changed files with 3 additions and 25 deletions

View File

@@ -172,7 +172,6 @@ export function TTSPlay(props: TTSPlayProps) {
function TTSButton(props: TTSProps) {
const [generating, setGenerating] = useState(false);
const ctx = useContext(AppContext);
if (!ctx) return <div>error</div>;
return (
<Button
@@ -237,7 +236,6 @@ function TTSButton(props: TTSProps) {
export default function Message(props: { messageIndex: number }) {
const ctx = useContext(AppContext);
if (ctx === null) return <></>;
const { messageIndex } = props;
const { chatStore, setChatStore } = ctx;
@@ -303,7 +301,8 @@ export default function Message(props: { messageIndex: number }) {
<Markdown>{getMessageText(chat)}</Markdown>
) : (
<div className="message-content">
{chat.content &&
{ctx &&
chat.content &&
(chat.logprobs && renderColor
? chat.logprobs.content
.filter((c) => c.token)