Merge branch 'hotfix_slow_message_sending' into develop

This commit is contained in:
Sakamoto Shiina
2025-10-10 09:27:34 +09:00
2 changed files with 9 additions and 1 deletions

View File

@@ -1,10 +1,13 @@
import {
useStore_MessageLogs,
useStore_MessageInputValue,
store,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
const COOLDOWN = 2000; // 2 seconds
export const useMessage = () => {
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
const { currentMessageInputValue, updateMessageInputValue } = useStore_MessageInputValue();
@@ -65,7 +68,11 @@ export const useMessage = () => {
};
const startTyping = () => {
asyncStdoutToPython("/run/typing_message_box");
const now = Date.now();
if (now - store.last_executed_time_startTyping >= 2000) {
store.last_executed_time_startTyping = now;
asyncStdoutToPython("/run/typing_message_box");
}
};
const stopTyping = () => {

View File

@@ -22,6 +22,7 @@ export const store = {
is_initialized_load_plugin: false,
is_fetched_plugins_info_already: false,
is_initialized_fetched_plugin_info: false,
last_executed_time_startTyping: 0,
};
const generatePropertyNames = (base_name) => ({