INNER CODE UNIT · Python

reset_conversation

tomtommyyuan/spmind · gradio_app.py:30

    def reset_conversation(self):
        """Reset the agent session and clear chat history."""
        if self.agent:
            self.agent.reset_session()
        return [], ""

    def chat_response(self, message: str, history: list):
        """Process user message and return agent response."""
        if not self.agent:
            history.append({"role": "user", "content": message})
            history.append({"role": "assistant", "content": "Agent not initialized. Check server logs."})
            return history, ""

        if not message.strip():
            return history, ""

        history.append({"role": "user", "content": message})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…