mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-03 03:55:12 +00:00
WebSocket merge
This commit is contained in:
parent
6ca84022d8
commit
4932e12546
124 changed files with 12072 additions and 757 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import uuid
|
||||
from typing import TYPE_CHECKING
|
||||
from python.helpers import guids
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from agent import AgentContext
|
||||
|
|
@ -41,7 +42,12 @@ def _sync_output(context: "AgentContext"):
|
|||
context.set_output_data(QUEUE_KEY, truncated)
|
||||
|
||||
|
||||
def add(context: "AgentContext", text: str, attachments: list[str] | None = None) -> dict:
|
||||
def add(
|
||||
context: "AgentContext",
|
||||
text: str,
|
||||
attachments: list[str] | None = None,
|
||||
item_id: str | None = None,
|
||||
) -> dict:
|
||||
"""Add message to queue. Attachments should be filenames, will be converted to full paths."""
|
||||
queue = get_queue(context)
|
||||
|
||||
|
|
@ -54,7 +60,7 @@ def add(context: "AgentContext", text: str, attachments: list[str] | None = None
|
|||
full_paths.append(f"{UPLOAD_FOLDER}/{att}")
|
||||
|
||||
item = {
|
||||
"id": str(uuid.uuid4())[:8],
|
||||
"id": item_id or guids.generate_id(),
|
||||
"seq": _get_next_seq(context),
|
||||
"text": text,
|
||||
"attachments": full_paths,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue