had
This commit is contained in:
@@ -9,7 +9,7 @@ from pydantic import BaseModel, Field
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
from agentui.pipeline.executor import PipelineExecutor
|
||||
from agentui.pipeline.defaults import default_pipeline
|
||||
from agentui.pipeline.storage import load_pipeline, save_pipeline, list_presets, load_preset, save_preset
|
||||
from agentui.pipeline.storage import load_pipeline, save_pipeline, list_presets, load_preset, save_preset, load_var_store
|
||||
from agentui.common.vendors import detect_vendor
|
||||
|
||||
|
||||
@@ -213,6 +213,16 @@ async def execute_pipeline_echo(u: UnifiedChatRequest) -> Dict[str, Any]:
|
||||
rendered_prompt = jinja_render(prompt_template, macro_ctx)
|
||||
# LLMInvoke (echo, т.к. без реального провайдера в MVP)
|
||||
llm_response_text = f"[echo by {u.model}]\n" + rendered_prompt
|
||||
# Дополняем эхо человекочитаемым трейсом выполнения пайплайна (если есть)
|
||||
try:
|
||||
pid = (load_pipeline().get("id", "pipeline_editor"))
|
||||
store = load_var_store(pid) or {}
|
||||
snap = store.get("snapshot") or {}
|
||||
trace_text = str(snap.get("EXEC_TRACE") or "").strip()
|
||||
if trace_text:
|
||||
llm_response_text = llm_response_text + "\n\n[Execution Trace]\n" + trace_text
|
||||
except Exception:
|
||||
pass
|
||||
# VendorFormatter
|
||||
if u.vendor_format == "openai":
|
||||
return {
|
||||
@@ -594,6 +604,38 @@ def create_app() -> FastAPI:
|
||||
return JSONResponse(result)
|
||||
app.mount("/ui", StaticFiles(directory="static", html=True), name="ui")
|
||||
|
||||
# Variable store API (per-pipeline)
|
||||
@app.get("/admin/vars")
|
||||
async def get_vars() -> JSONResponse:
|
||||
try:
|
||||
p = load_pipeline()
|
||||
pid = p.get("id", "pipeline_editor")
|
||||
except Exception:
|
||||
p = default_pipeline()
|
||||
pid = p.get("id", "pipeline_editor")
|
||||
store = {}
|
||||
try:
|
||||
from agentui.pipeline.storage import load_var_store
|
||||
store = load_var_store(pid)
|
||||
except Exception:
|
||||
store = {}
|
||||
return JSONResponse({"pipeline_id": pid, "store": store})
|
||||
|
||||
@app.delete("/admin/vars")
|
||||
async def clear_vars() -> JSONResponse:
|
||||
try:
|
||||
p = load_pipeline()
|
||||
pid = p.get("id", "pipeline_editor")
|
||||
except Exception:
|
||||
p = default_pipeline()
|
||||
pid = p.get("id", "pipeline_editor")
|
||||
try:
|
||||
from agentui.pipeline.storage import clear_var_store
|
||||
clear_var_store(pid)
|
||||
except Exception:
|
||||
pass
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
# Admin API для пайплайна
|
||||
@app.get("/admin/pipeline")
|
||||
async def get_pipeline() -> JSONResponse:
|
||||
|
||||
Reference in New Issue
Block a user