feat: Enhance AgentChatWidget with Improved Message Handling and UI Updates

- Updated the AgentChatWidget to manage AI response states, including a new mechanism for handling pending messages and a thinking animation indicator.
- Improved the initialization of embedded labels for resource tools, ensuring labels are loaded only when necessary, enhancing performance and user experience.
- Refined the chat history synchronization process to ensure timely updates in the chat history popup.
- Enhanced the UI layout for better readability and interaction, including adjustments to button styles and spacing for a more polished appearance.
This commit is contained in:
scawful
2025-10-05 12:08:11 -04:00
parent 8b9f838054
commit a7c384a37d
4 changed files with 561 additions and 402 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -235,6 +235,11 @@ public:
// History synchronization
void SyncHistoryToPopup();
// AI response state
bool waiting_for_response_ = false;
float thinking_animation_ = 0.0f;
std::string pending_message_;
// Chat session management
struct ChatSession {
std::string id;

View File

@@ -112,14 +112,19 @@ absl::Status HandleResourceListCommand(
rom = &rom_storage;
}
// Initialize embedded labels if not already loaded
if (rom->resource_label() && !rom->resource_label()->labels_loaded_) {
core::YazeProject project;
auto labels_status = project.InitializeEmbeddedLabels();
if (labels_status.ok()) {
rom->resource_label()->labels_ = project.resource_labels;
rom->resource_label()->labels_loaded_ = true;
// Initialize embedded labels if needed
if (rom->resource_label()) {
if (!rom->resource_label()->labels_loaded_ || rom->resource_label()->labels_.empty()) {
core::YazeProject project;
project.use_embedded_labels = true;
auto labels_status = project.InitializeEmbeddedLabels();
if (labels_status.ok()) {
rom->resource_label()->labels_ = project.resource_labels;
rom->resource_label()->labels_loaded_ = true;
}
}
} else {
return absl::FailedPreconditionError("ROM has no resource label manager");
}
ResourceContextBuilder context_builder(rom);

View File

@@ -205,7 +205,11 @@ ResourceContextBuilder::GetLabels(const std::string& category) {
}
auto* label_mgr = rom_->resource_label();
if (!label_mgr || !label_mgr->labels_loaded_) {
if (!label_mgr) {
return absl::FailedPreconditionError("No resource label manager");
}
if (!label_mgr->labels_loaded_) {
return absl::FailedPreconditionError("No labels file loaded");
}