| | """ |
| | id: assess |
| | title: Assessment Helper |
| | author: admin |
| | description: Save the first attached file, read full content, and return it for analysis. |
| | version: 0.1.0 |
| | license: Proprietary |
| | """ |
| |
|
| | from typing import List, Dict, Any, Optional |
| |
|
| |
|
| | class Tools: |
| | def run( |
| | self, |
| | dest_path: str = "/data/adaptai/input/attached.txt", |
| | file_id: Optional[str] = None, |
| | __files__: List[Dict[str, Any]] = [], |
| | ) -> dict: |
| | """ |
| | Save the first attachment (or provided file_id) to dest_path, then read and return full content. |
| | Returns: { ok, path, bytes, content } |
| | """ |
| | |
| | from open_webui.utils.plugin import load_tool_module_by_id |
| |
|
| | |
| | attachments, _ = load_tool_module_by_id("attachments") |
| | save_args = {"dest_path": dest_path} |
| | if file_id: |
| | save_args["file_id"] = file_id |
| | saved = attachments.save(__files__=__files__, **save_args) |
| | if not saved.get("ok"): |
| | return {"ok": False, "error": saved.get("error", "save failed")} |
| | |
| | files, _ = load_tool_module_by_id("files") |
| | read = files.read(path=dest_path) |
| | if "content" not in read: |
| | return {"ok": False, "error": read} |
| | return { |
| | "ok": True, |
| | "path": dest_path, |
| | "bytes": len(read.get("content", "").encode("utf-8")), |
| | "content": read.get("content", ""), |
| | } |
| |
|
| | def scaffold(self) -> dict: |
| | """ |
| | Return a standard assessment scaffold (section headings) the LLM can fill in. |
| | """ |
| | sections = [ |
| | "Executive Summary", |
| | "Objectives & Scope", |
| | "Assumptions & Dependencies", |
| | "Strengths & Gaps", |
| | "Risks & Mitigations", |
| | "Stakeholders & Roles", |
| | "Architecture / Workflow", |
| | "Timeline & Acceptance Criteria", |
| | "Resource Estimate (skills, tools, infra)", |
| | "Quick Wins (next 48h)", |
| | "Open Questions", |
| | "Recommended 1–2 Week Plan", |
| | ] |
| | template = "\n\n".join([f"## {h}\n- " for h in sections]) |
| | return {"template": template} |
| |
|