Update asset metadata and enhance Agent class functionality in SUI
- Updated modification times for various asset files in bindata.go to reflect recent changes. - Enhanced the Agent class in libsui/agent.ts by adding type tracking for message processing, improving message creation logic based on type changes. - Improved event handling in the Agent class to streamline message processing and enhance user interactions.
This commit is contained in:
parent
54e291b804
commit
afc2971830
2 changed files with 91 additions and 85 deletions
168
data/bindata.go
168
data/bindata.go
File diff suppressed because one or more lines are too long
|
|
@ -211,6 +211,7 @@ class Agent {
|
|||
};
|
||||
|
||||
try {
|
||||
let last_type: string | null = null;
|
||||
const es = new EventSource(endpoint, { withCredentials: true });
|
||||
this.es = es;
|
||||
|
||||
|
|
@ -226,10 +227,10 @@ class Agent {
|
|||
const {
|
||||
tool_id,
|
||||
begin,
|
||||
type,
|
||||
end,
|
||||
text,
|
||||
props,
|
||||
type,
|
||||
done,
|
||||
assistant_id,
|
||||
assistant_name,
|
||||
|
|
@ -271,11 +272,16 @@ class Agent {
|
|||
|
||||
// Check if we need to create a new message
|
||||
const shouldCreateNewMessage =
|
||||
(type !== last_type &&
|
||||
(!done || (done === true && (text || props)))) || // if type changed or done is true and there is text or props
|
||||
messages.length === 0 ||
|
||||
(assistant_id &&
|
||||
messages[messages.length - 1].assistant_id !== assistant_id) ||
|
||||
(is_new && !delta); // Only create new message if it's new and not a delta update
|
||||
|
||||
// Update last type
|
||||
last_type = type;
|
||||
|
||||
// Update assistant information
|
||||
if (assistant_id) lastAssistant.assistant_id = assistant_id;
|
||||
if (assistant_name) lastAssistant.assistant_name = assistant_name;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue