feat: Add collaborative chat sessions and multimodal vision support in Z3ED
This commit is contained in:
@@ -40,12 +40,19 @@ std::filesystem::path ExpandUserPath(std::string path) {
|
||||
return std::filesystem::path(path);
|
||||
}
|
||||
|
||||
std::filesystem::path ResolveHistoryPath() {
|
||||
std::filesystem::path ResolveHistoryPath(const std::string& session_id = "") {
|
||||
std::filesystem::path base = ExpandUserPath(yaze::core::GetConfigDirectory());
|
||||
if (base.empty()) {
|
||||
base = ExpandUserPath(".yaze");
|
||||
}
|
||||
auto directory = base / "agent";
|
||||
|
||||
// If in a collaborative session, use shared history
|
||||
if (!session_id.empty()) {
|
||||
directory = directory / "sessions";
|
||||
return directory / (session_id + "_history.json");
|
||||
}
|
||||
|
||||
return directory / "chat_history.json";
|
||||
}
|
||||
|
||||
@@ -802,5 +809,45 @@ void AgentChatWidget::MarkHistoryDirty() {
|
||||
}
|
||||
}
|
||||
|
||||
void AgentChatWidget::SwitchToSharedHistory(const std::string& session_id) {
|
||||
// Save current local history before switching
|
||||
if (history_loaded_ && history_dirty_) {
|
||||
PersistHistory();
|
||||
}
|
||||
|
||||
// Switch to shared history path
|
||||
history_path_ = ResolveHistoryPath(session_id);
|
||||
history_loaded_ = false;
|
||||
|
||||
// Load shared history
|
||||
EnsureHistoryLoaded();
|
||||
|
||||
if (toast_manager_) {
|
||||
toast_manager_->Show(
|
||||
absl::StrFormat("Switched to shared chat history for session %s",
|
||||
session_id),
|
||||
ToastType::kInfo, 3.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void AgentChatWidget::SwitchToLocalHistory() {
|
||||
// Save shared history before switching
|
||||
if (history_loaded_ && history_dirty_) {
|
||||
PersistHistory();
|
||||
}
|
||||
|
||||
// Switch back to local history
|
||||
history_path_ = ResolveHistoryPath("");
|
||||
history_loaded_ = false;
|
||||
|
||||
// Load local history
|
||||
EnsureHistoryLoaded();
|
||||
|
||||
if (toast_manager_) {
|
||||
toast_manager_->Show("Switched to local chat history",
|
||||
ToastType::kInfo, 3.0f);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
@@ -80,6 +80,8 @@ class AgentChatWidget {
|
||||
|
||||
void EnsureHistoryLoaded();
|
||||
void PersistHistory();
|
||||
void SwitchToSharedHistory(const std::string& session_id);
|
||||
void SwitchToLocalHistory();
|
||||
void RenderHistory();
|
||||
void RenderMessage(const cli::agent::ChatMessage& msg, int index);
|
||||
void RenderProposalQuickActions(const cli::agent::ChatMessage& msg,
|
||||
|
||||
Reference in New Issue
Block a user