Merge branch 'developing' into staging

This commit is contained in:
朱潮 2026-05-14 17:15:34 +08:00
commit adbe5b5c65
2 changed files with 14 additions and 7 deletions

View File

@ -234,16 +234,23 @@ class AgentConfig:
from utils.settings import LANGFUSE_ENABLED
if LANGFUSE_ENABLED:
from langfuse.langchain import CallbackHandler as LangfuseCallbackHandler
trace_context = {"trace_id": self.trace_id} if self.trace_id else None
langfuse_handler = LangfuseCallbackHandler(
trace_id=self.trace_id,
session_id=self.session_id,
user_id=self.user_identifier,
metadata={"bot_id": self.bot_id, "model": self.model_name},
trace_context=trace_context,
)
callbacks.append(langfuse_handler)
langfuse_metadata = {}
if LANGFUSE_ENABLED:
if self.session_id:
langfuse_metadata["langfuse_session_id"] = self.session_id
if self.user_identifier:
langfuse_metadata["langfuse_user_id"] = self.user_identifier
if callbacks:
config["callbacks"] = callbacks
if langfuse_metadata:
config["metadata"] = langfuse_metadata
if self.session_id:
config["configurable"] = {"thread_id": self.session_id}
return config

View File

@ -61,12 +61,12 @@ def _list_local_changed_files(workspace_path: Path) -> tuple[bool, list[str]]:
def _tar_workspace_entries(workspace_path: Path, entries: list[Path]) -> bytes:
buf = io.BytesIO()
with tarfile.open(fileobj=buf, mode="w:gz") as tar:
with tarfile.open(fileobj=buf, mode="w:gz", dereference=True) as tar:
for entry in entries:
if entry.is_absolute():
tar.add(str(entry), arcname=entry.relative_to(workspace_path).as_posix(), dereference=True)
tar.add(str(entry), arcname=entry.relative_to(workspace_path).as_posix())
else:
tar.add(str(workspace_path / entry), arcname=entry.as_posix(), dereference=True)
tar.add(str(workspace_path / entry), arcname=entry.as_posix())
buf.seek(0)
return buf.read()