ai_done() {
                if (is_thinking) {
                    is_thinking = false;
                    toggleButton.textContent = 'Thought for ' + ((performance.now() - g_thought_start_time) / 1000).toFixed(2) + ' s';
                }
            }

            function reset() {
                g_md_src = "";
                g_thought_src = "";
                is_thinking = false;
                g_thought_start_time = 0;
                chat_container.innerHTML = "";
                is_ai_turn = fal