mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 07:00:48 +08:00
将附件/多模态查询与编辑工具从 generalist 迁移到 public。
同时移除 network_ops 的转发壳文件,统一工具入口并更新对应测试引用,降低重复维护成本。 Made-with: Cursor
This commit is contained in:
parent
5d67303d22
commit
1c71a29ec1
10 changed files with 84 additions and 126 deletions
|
|
@ -1,41 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from oclaw.platform.files.text_attachment_store import query_text_document
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def query_text_attachment_tool() -> ToolSpec:
|
||||
def handler(args: dict[str, Any]) -> dict[str, Any]:
|
||||
text_id = str(args.get("text_id") or "").strip()
|
||||
if not text_id:
|
||||
return {"ok": False, "error": "text_id_required"}
|
||||
return query_text_document(
|
||||
text_id=text_id,
|
||||
query=str(args.get("query") or "").strip() or None,
|
||||
top_k=int(args.get("top_k") or 5),
|
||||
offset=int(args.get("offset") or 0),
|
||||
)
|
||||
|
||||
return ToolSpec(
|
||||
name="query_text_attachment",
|
||||
description="Query long text attachment chunks by text_id with optional keyword search.",
|
||||
parameters={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"text_id": {"type": "string"},
|
||||
"query": {"type": "string"},
|
||||
"top_k": {"type": "integer", "minimum": 1, "maximum": 50},
|
||||
"offset": {"type": "integer", "minimum": 0},
|
||||
},
|
||||
"required": ["text_id"],
|
||||
"additionalProperties": False,
|
||||
},
|
||||
handler=handler,
|
||||
read_only=True,
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["query_text_attachment_tool"]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue