# Folder structure initialization
LOGS_FOLDER = "logs"
CHATS_FOLDER = "chats"
TASKS_FOLDER = "task_lists"
def create_log_folders() -> None:
def create_chat_folders() -> None:
Key Features:
- Early logging setup
- Structured folder creation
- Error handling during startup
- Path validation
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(funcName)s:%(lineno)d - %(message)s',
handlers=[
logging.FileHandler(Path(get_project_root()) / LOGS_FOLDER / 'async_chat_stream.log'),
logging.StreamHandler()
]
)
- Centralized logging
- Detailed formatting
- Multi-handler output
- Debug capabilities
-
Enhanced Task and Chat Management System
def get_available_lists() -> List[Path]: def display_available_lists() -> Optional[str]: def save_conversation_as_tasks(conversation: List[Dict[str, str]], filename: str, append: bool = False) -> None:
- List discovery and selection
- Append functionality for existing lists
- Automatic index continuation
- Metadata preservation
-
Interactive Chat Interface
def display_chat_menu() -> str: async def chat_mode(client: ollama.AsyncClient, model: str) -> None:
- Enhanced save options
- Append to existing chats/lists
- Context preservation
- State management
-
File System Organization
LOGS_FOLDER = "logs" CHATS_FOLDER = "chats" TASKS_FOLDER = "task_lists"
- Structured logging system
- Organized chat storage
- Task list management
- Automatic folder creation
-
Logging System
logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(funcName)s:%(lineno)d - %(message)s', handlers=[ logging.FileHandler(Path(get_project_root()) / LOGS_FOLDER / 'async_chat_stream.log'), logging.StreamHandler() ] )
- Centralized logging location
- Enhanced format with line numbers
- Dual output streams
- Contextual error tracking
-
List Management
def get_available_lists() -> List[Path]: task_path = get_project_root() / TASKS_FOLDER return sorted(task_path.glob('*.csv'))
- Automatic list discovery
- Sorted presentation
- Path validation
- Error handling
-
Append Functionality
def save_conversation_as_tasks(conversation, filename, append=False): mode = 'a' if append else 'w' # Get last index from existing file if appending last_index = 0 if append and task_path.exists(): # Index continuation logic
- Seamless content addition
- Index continuation
- Content separation
- Format preservation
-
Chat State Management
- Conversation context preservation
- Multiple save points
- Append capabilities
- History recovery
-
File Operations
- Atomic write operations
- Append mode handling
- Index tracking
- Error recovery
-
Storage Efficiency
- Optimized append operations
- Index management
- Content organization
- Resource cleanup
-
User Experience
- List selection interface
- Clear append options
- Progress feedback
- Error notifications
-
Task Management
- Basic append functionality
- Simple index tracking
- Limited content merging
- File-based storage
-
Chat System
- Sequential processing
- Basic state management
- Limited search capabilities
- Local storage only
-
Short-term Enhancements
- Enhanced append options
- Content deduplication
- Index optimization
- Backup system
-
Long-term Architectural Changes
- Database integration
- Advanced merging
- Cloud synchronization
- Multi-user support
-
Type Safety
- Path type validation
- Index type checking
- Return type verification
- Optional handling
-
Error Handling
- Append operation errors
- Index conflicts
- File access issues
- State recovery
-
Storage Requirements
- Append operation space
- Index tracking
- Backup storage
- Log files
-
Software Dependencies
- Python 3.8+
- File system access
- CSV handling
- JSON processing
-
Task List Management
- Index optimization
- Content verification
- Backup creation
- Storage cleanup
-
System Updates
- Format migration
- Index rebuilding
- Content validation
- Performance monitoring
-
Common Issues
- Append failures
- Index conflicts
- Content corruption
- Permission problems
-
Resolution Steps
- Index reconstruction
- Content recovery
- Permission repair
- Backup restoration
- Path sanitization
- Content validation
- Index verification
- Type checking
- Atomic writes
- Permission checks
- Resource locking
- Error isolation
- Smart content merging
- Advanced search
- Content categorization
- Version control
- Real-time collaboration
- Cloud integration
- Advanced indexing
- Performance optimization
- Smart content merging
- Advanced search
- Content categorization
- Version control