forked from XiaoMo/ChatGPT-Next-Web
fix: #1612 fill empty message with a placeholder
This commit is contained in:
parent
1a8cb877db
commit
6cf2fa02e5
@ -487,18 +487,26 @@ export function Chat() {
|
|||||||
|
|
||||||
// stop response
|
// stop response
|
||||||
const onUserStop = (messageId: number) => {
|
const onUserStop = (messageId: number) => {
|
||||||
|
ChatControllerPool.stop(sessionIndex, messageId);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
chatStore.updateCurrentSession((session) => {
|
chatStore.updateCurrentSession((session) => {
|
||||||
const stopTiming = Date.now() - REQUEST_TIMEOUT_MS;
|
const stopTiming = Date.now() - REQUEST_TIMEOUT_MS;
|
||||||
session.messages.forEach((m) => {
|
session.messages.forEach((m) => {
|
||||||
// check if should stop all stale messages
|
// check if should stop all stale messages
|
||||||
if (m.streaming && new Date(m.date).getTime() < stopTiming) {
|
if (new Date(m.date).getTime() < stopTiming) {
|
||||||
m.isError = false;
|
if (m.streaming) {
|
||||||
m.streaming = false;
|
m.streaming = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.content.length === 0) {
|
||||||
|
m.content = "No content in this message.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ChatControllerPool.stop(sessionIndex, messageId);
|
}, []);
|
||||||
};
|
|
||||||
|
|
||||||
// check if should send message
|
// check if should send message
|
||||||
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user