* Check if a session has meaningful content for saving
(session: Session)
| 262 | * Check if a session has meaningful content for saving |
| 263 | */ |
| 264 | function hasSessionContent(session: Session): boolean { |
| 265 | if (!session.history || session.history.length === 0) { |
| 266 | return false; |
| 267 | } |
| 268 | |
| 269 | const nonSystemMessages = session.history.filter( |
| 270 | (item) => item.message.role !== "system", |
| 271 | ); |
| 272 | |
| 273 | return nonSystemMessages.length > 0; |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Save the current session to file |