|
8 | 8 |
|
9 | 9 | from textual.app import ComposeResult
|
10 | 10 | from textual.containers import VerticalScroll
|
11 |
| -from textual.widgets import Static, Select, TextArea, Input, Collapsible |
| 11 | +from textual.widgets import Static, Select, TextArea, Input, Collapsible, Button, Checkbox, ListView |
12 | 12 | #
|
13 | 13 | # Local Imports
|
14 | 14 | from ..config import get_providers_and_models
|
| 15 | + |
15 | 16 | #
|
16 | 17 | #######################################################################################################################
|
17 | 18 | #
|
|
20 | 21 | # Sidebar visual constants ---------------------------------------------------
|
21 | 22 | SIDEBAR_WIDTH = "30%"
|
22 | 23 |
|
| 24 | + |
23 | 25 | def create_settings_sidebar(id_prefix: str, config: dict) -> ComposeResult:
|
24 | 26 | """Yield the widgets for the settings sidebar.
|
25 | 27 |
|
@@ -131,6 +133,68 @@ def create_settings_sidebar(id_prefix: str, config: dict) -> ComposeResult:
|
131 | 133 | classes="sidebar-input",
|
132 | 134 | )
|
133 | 135 |
|
| 136 | + # =================================================================== |
| 137 | + # NEW: Conversation Details (only for chat tab) |
| 138 | + # =================================================================== |
| 139 | + if id_prefix == "chat": # Assuming "chat" is the id_prefix for the main chat tab |
| 140 | + with Collapsible(title="Conversation Details", collapsed=False): |
| 141 | + yield Static("Current Conversation Title:", classes="sidebar-label") |
| 142 | + yield Input( |
| 143 | + id=f"{id_prefix}-conversation-title-input", |
| 144 | + placeholder="Enter conversation title...", |
| 145 | + classes="sidebar-input" |
| 146 | + ) |
| 147 | + yield Static("Conversation Keywords:", classes="sidebar-label") |
| 148 | + yield TextArea( |
| 149 | + id=f"{id_prefix}-conversation-keywords-input", |
| 150 | + classes="sidebar-textarea" # Use existing class for basic styling |
| 151 | + ) |
| 152 | + # Set initial height for TextArea via styles property if not handled by class |
| 153 | + # Example: self.query_one(f"#{id_prefix}-conversation-keywords-input", TextArea).styles.height = 5 |
| 154 | + yield Button( |
| 155 | + "Save Title & Keywords", |
| 156 | + id=f"{id_prefix}-save-conversation-details-button", |
| 157 | + variant="primary", |
| 158 | + classes="sidebar-button" # Add a class if you have specific button styling |
| 159 | + ) |
| 160 | + |
| 161 | + # NEW: Saved Conversations (only for chat tab) |
| 162 | + with Collapsible(title="Saved Conversations", collapsed=True): |
| 163 | + yield Input( |
| 164 | + id=f"{id_prefix}-conversation-search-bar", |
| 165 | + placeholder="Search all chats...", |
| 166 | + classes="sidebar-input" |
| 167 | + ) |
| 168 | + yield Checkbox( |
| 169 | + "Include Character Chats", |
| 170 | + id=f"{id_prefix}-conversation-search-include-character-checkbox" |
| 171 | + # value=False by default for Checkbox |
| 172 | + ) |
| 173 | + yield Select( |
| 174 | + [], # Empty options initially |
| 175 | + id=f"{id_prefix}-conversation-search-character-filter-select", |
| 176 | + allow_blank=True, # User can select nothing to clear filter |
| 177 | + prompt="Filter by Character...", |
| 178 | + classes="sidebar-select" # Assuming a general class for selects or use default |
| 179 | + ) |
| 180 | + yield Checkbox( |
| 181 | + "All Characters", |
| 182 | + id=f"{id_prefix}-conversation-search-all-characters-checkbox", |
| 183 | + value=True # Default to True |
| 184 | + ) |
| 185 | + yield ListView( |
| 186 | + id=f"{id_prefix}-conversation-search-results-list", |
| 187 | + classes="sidebar-listview" # Add specific styling if needed |
| 188 | + ) |
| 189 | + # Set initial height for ListView via styles property if not handled by class |
| 190 | + # Example: self.query_one(f"#{id_prefix}-conversation-search-results-list", ListView).styles.height = 10 |
| 191 | + yield Button( |
| 192 | + "Load Selected Chat", |
| 193 | + id=f"{id_prefix}-conversation-load-selected-button", |
| 194 | + variant="default", # Or "primary" |
| 195 | + classes="sidebar-button" # Use existing class or new one |
| 196 | + ) |
| 197 | + |
134 | 198 | # ===================================================================
|
135 | 199 | # 3. Media Settings – placeholders
|
136 | 200 | # ===================================================================
|
|
0 commit comments