refactor(aisidebar): restructure project and implement reasoning mode toggle

- Reorganize project structure and file locations
- Add ReasoningController to manage model selection and reasoning mode
- Update design and requirements for reasoning mode toggle
- Implement model switching between Qwen3-4B-Instruct and Qwen3-4B-Thinking models
- Remove deprecated files and consolidate project layout
- Add new steering and specification documentation
- Clean up and remove unnecessary files and directories
- Prepare for enhanced AI sidebar functionality with more flexible model handling
This commit is contained in:
Melvin Ragusa
2025-10-26 09:10:31 +01:00
parent 58bd935af0
commit 239242e2fc
73 changed files with 3094 additions and 2348 deletions

View File

@@ -102,6 +102,39 @@ class ConversationManager:
self._state.updated_at = now
self._write_state()
def clear_messages(self) -> None:
"""Clear all messages and reset the conversation state."""
timestamp = datetime.now(timezone.utc).isoformat()
self._state = ConversationState(
conversation_id=self._conversation_id,
created_at=timestamp,
updated_at=timestamp,
messages=[],
)
self._write_state()
def trim_to_recent(self, keep_count: int = 20) -> List[Dict[str, str]]:
"""Trim conversation to keep only recent messages, return removed messages.
Args:
keep_count: Number of recent messages to keep
Returns:
List of messages that were removed (older messages)
"""
if len(self._state.messages) <= keep_count:
return []
# Split messages into old and recent
removed_messages = self._state.messages[:-keep_count]
self._state.messages = self._state.messages[-keep_count:]
# Update state and persist
self._state.updated_at = datetime.now(timezone.utc).isoformat()
self._write_state()
return removed_messages
# ------------------------------------------------------------------ persistence
def _load_state(self) -> ConversationState:
"""Load the transcript from disk or create a fresh default."""