mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 00:40:45 +08:00
Simplify oclaw product surface: drop niche specialists and admin noise.
Remove stock/image/video specialists, Gmail watcher, CocoLoop market, desktop packaging, and extra memory plugins; disable dynamic agents and hide Session Monitor / API grants / Admin Audit from nav. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
efa72df362
commit
cf31fd104d
290 changed files with 127 additions and 64576 deletions
|
|
@ -1191,199 +1191,14 @@ def _execute_tool_step(
|
|||
return int((time.perf_counter() - t0) * 1000), results_by_id
|
||||
|
||||
|
||||
def _maybe_image_specialist_legacy_gateway_turn(
|
||||
*,
|
||||
store: Any,
|
||||
session_id: str,
|
||||
turn_uuid: str,
|
||||
lang: str,
|
||||
model: ChatModel,
|
||||
user_text: str,
|
||||
attachments: list[dict[str, Any]] | None,
|
||||
skill_binding_role: str | None,
|
||||
on_token: Optional[Callable[[str], None]],
|
||||
on_progress: Optional[Callable[[str], None]],
|
||||
) -> TurnRunOutcome | None:
|
||||
"""When the UI selects **image** specialist, skip Responses/chat-model transports.
|
||||
|
||||
Vision/gen HTTP goes through :func:`svc.llm.image_legacy_client.send_legacy_image_messages`
|
||||
(``/chat/completions`` lane). Disable with ``AIA_IMAGE_SPECIALIST_DISABLE_LEGACY_GATEWAY_LANE=1``.
|
||||
|
||||
End-to-end notes and safe edit boundaries: ``docs/IMAGE_SPECIALIST_LANE.md``.
|
||||
"""
|
||||
if str(os.getenv("AIA_IMAGE_SPECIALIST_DISABLE_LEGACY_GATEWAY_LANE") or "").strip().lower() in (
|
||||
"1",
|
||||
"true",
|
||||
"yes",
|
||||
"on",
|
||||
):
|
||||
return None
|
||||
if str(skill_binding_role or "").strip().lower() != "image":
|
||||
return None
|
||||
|
||||
from svc.llm.image_legacy_client import (
|
||||
IMAGE_SPECIALIST_DEFAULT_PROMPT_ZH,
|
||||
collect_legacy_lane_images_with_session_fallback,
|
||||
legacy_image_assistant_body_with_placeholder,
|
||||
legacy_image_turn_bundle,
|
||||
send_legacy_image_messages,
|
||||
)
|
||||
|
||||
imgs, legacy_img_src = collect_legacy_lane_images_with_session_fallback(
|
||||
store=store,
|
||||
session_id=session_id,
|
||||
attachments=attachments,
|
||||
)
|
||||
if not imgs:
|
||||
hint_en = "Image specialist received no image input. Attach an image and try again."
|
||||
hint_zh = "图片专家未收到可用的图片输入;请先上传或附上图片后再试。"
|
||||
hint = hint_en if str(lang or "").startswith("en") else hint_zh
|
||||
store.add_message(
|
||||
session_id=session_id,
|
||||
role="assistant",
|
||||
content=hint,
|
||||
turn_uuid=turn_uuid,
|
||||
event_type="assistant_text",
|
||||
)
|
||||
return TurnRunOutcome(
|
||||
final_text=hint,
|
||||
tool_traces=tuple(),
|
||||
handoff_note="image_specialist_legacy_missing_attachment",
|
||||
turn_uuid=turn_uuid,
|
||||
)
|
||||
|
||||
if on_progress:
|
||||
if legacy_img_src.endswith("_history"):
|
||||
if str(lang or "").startswith("en"):
|
||||
on_progress("oclaw: reusing earlier session images (no new upload this turn)…")
|
||||
else:
|
||||
on_progress("oclaw: 本轮未上传新图,使用会话中较早的图片作为输入…")
|
||||
on_progress("oclaw: image specialist (legacy multimodal HTTP)…")
|
||||
|
||||
prompt_plain = str(user_text or "").strip()
|
||||
if not prompt_plain:
|
||||
prompt_plain = IMAGE_SPECIALIST_DEFAULT_PROMPT_ZH
|
||||
|
||||
resp = send_legacy_image_messages(
|
||||
images=imgs,
|
||||
prompt=prompt_plain,
|
||||
model=str(getattr(model, "model", "") or "").strip() or None,
|
||||
api_key=str(getattr(model, "api_key", "") or "").strip() or None,
|
||||
base_url=str(getattr(model, "base_url", "") or "").strip() or None,
|
||||
)
|
||||
ok, body_text, produced = legacy_image_turn_bundle(resp)
|
||||
body_text = legacy_image_assistant_body_with_placeholder(
|
||||
lang=lang,
|
||||
body_text=body_text,
|
||||
produced=produced if ok else None,
|
||||
)
|
||||
store.add_message(
|
||||
session_id=session_id,
|
||||
role="assistant",
|
||||
content=body_text,
|
||||
turn_uuid=turn_uuid,
|
||||
event_type="assistant_text",
|
||||
attachments=(produced or None) if ok else None,
|
||||
)
|
||||
if ok and on_token and body_text:
|
||||
on_token(body_text)
|
||||
return TurnRunOutcome(
|
||||
final_text=body_text,
|
||||
tool_traces=tuple(),
|
||||
handoff_note="image_specialist_legacy_http" if ok else "image_specialist_legacy_upstream_failed",
|
||||
turn_uuid=turn_uuid,
|
||||
)
|
||||
def _maybe_image_specialist_legacy_gateway_turn(**_kwargs: Any) -> TurnRunOutcome | None:
|
||||
"""Image specialist lane removed; OCR remains via query_image_attachment."""
|
||||
return None
|
||||
|
||||
|
||||
def _maybe_video_specialist_legacy_gateway_turn(
|
||||
*,
|
||||
store: Any,
|
||||
session_id: str,
|
||||
turn_uuid: str,
|
||||
lang: str,
|
||||
model: ChatModel,
|
||||
user_text: str,
|
||||
attachments: list[dict[str, Any]] | None,
|
||||
skill_binding_role: str | None,
|
||||
on_token: Optional[Callable[[str], None]],
|
||||
on_progress: Optional[Callable[[str], None]],
|
||||
should_stop: Optional[Callable[[], bool]] = None,
|
||||
) -> TurnRunOutcome | None:
|
||||
"""When the UI selects **video** specialist, skip Responses/chat-model transports.
|
||||
|
||||
Uses DashScope async ``video-synthesis`` (see :mod:`svc.llm.video_generation_client`).
|
||||
With a user image (or session image fallback), sends ``input.img_url`` for **image-to-video**;
|
||||
otherwise **text-to-video**. Disable with ``AIA_VIDEO_SPECIALIST_DISABLE_LEGACY_GATEWAY_LANE=1``.
|
||||
"""
|
||||
if str(os.getenv("AIA_VIDEO_SPECIALIST_DISABLE_LEGACY_GATEWAY_LANE") or "").strip().lower() in (
|
||||
"1",
|
||||
"true",
|
||||
"yes",
|
||||
"on",
|
||||
):
|
||||
return None
|
||||
if str(skill_binding_role or "").strip().lower() != "video":
|
||||
return None
|
||||
|
||||
from svc.llm.image_legacy_client import collect_legacy_lane_images_with_session_fallback
|
||||
from svc.llm.video_generation_client import (
|
||||
VIDEO_SPECIALIST_DEFAULT_PROMPT_ZH,
|
||||
legacy_video_assistant_body_with_placeholder,
|
||||
legacy_video_turn_bundle,
|
||||
send_video_generation_request,
|
||||
)
|
||||
|
||||
frames, frame_src = collect_legacy_lane_images_with_session_fallback(
|
||||
store=store,
|
||||
session_id=session_id,
|
||||
attachments=attachments,
|
||||
max_images=1,
|
||||
)
|
||||
frame_url = str(frames[0]).strip() if frames else None
|
||||
|
||||
if on_progress:
|
||||
if frame_url:
|
||||
if frame_src.endswith("_history"):
|
||||
if str(lang or "").startswith("en"):
|
||||
on_progress("oclaw: reusing an earlier session image as first frame…")
|
||||
else:
|
||||
on_progress("oclaw: 使用会话中较早的图片作为图生视频首帧…")
|
||||
on_progress("oclaw: video specialist (DashScope image-to-video)…")
|
||||
else:
|
||||
on_progress("oclaw: video specialist (DashScope text-to-video)…")
|
||||
|
||||
prompt_plain = str(user_text or "").strip() or VIDEO_SPECIALIST_DEFAULT_PROMPT_ZH
|
||||
resp = send_video_generation_request(
|
||||
prompt=prompt_plain,
|
||||
model=str(getattr(model, "model", "") or "").strip() or None,
|
||||
api_key=str(getattr(model, "api_key", "") or "").strip() or None,
|
||||
base_url=str(getattr(model, "base_url", "") or "").strip() or None,
|
||||
img_url=frame_url,
|
||||
on_progress=on_progress,
|
||||
should_stop=should_stop,
|
||||
)
|
||||
ok, body_text, produced = legacy_video_turn_bundle(resp)
|
||||
body_text = legacy_video_assistant_body_with_placeholder(
|
||||
lang=lang,
|
||||
body_text=body_text,
|
||||
produced=produced if ok else None,
|
||||
)
|
||||
store.add_message(
|
||||
session_id=session_id,
|
||||
role="assistant",
|
||||
content=body_text,
|
||||
turn_uuid=turn_uuid,
|
||||
event_type="assistant_text",
|
||||
attachments=(produced or None) if ok else None,
|
||||
)
|
||||
if ok and on_token and body_text:
|
||||
on_token(body_text)
|
||||
return TurnRunOutcome(
|
||||
final_text=body_text,
|
||||
tool_traces=tuple(),
|
||||
handoff_note="video_specialist_legacy_http" if ok else "video_specialist_legacy_upstream_failed",
|
||||
turn_uuid=turn_uuid,
|
||||
)
|
||||
def _maybe_video_specialist_legacy_gateway_turn(**_kwargs: Any) -> TurnRunOutcome | None:
|
||||
"""Video specialist lane removed from product surface."""
|
||||
return None
|
||||
|
||||
|
||||
def run_oclaw_direct_loop(
|
||||
|
|
@ -1434,35 +1249,7 @@ def run_oclaw_direct_loop(
|
|||
turn_uuid=turn_uuid,
|
||||
event_type="user_text",
|
||||
)
|
||||
legacy_early = _maybe_image_specialist_legacy_gateway_turn(
|
||||
store=store,
|
||||
session_id=session_id,
|
||||
turn_uuid=turn_uuid,
|
||||
lang=lang,
|
||||
model=model,
|
||||
user_text=str(user_text or ""),
|
||||
attachments=attachments,
|
||||
skill_binding_role=skill_binding_role,
|
||||
on_token=on_token,
|
||||
on_progress=on_progress,
|
||||
)
|
||||
if legacy_early is not None:
|
||||
return legacy_early
|
||||
video_early = _maybe_video_specialist_legacy_gateway_turn(
|
||||
store=store,
|
||||
session_id=session_id,
|
||||
turn_uuid=turn_uuid,
|
||||
lang=lang,
|
||||
model=model,
|
||||
user_text=str(user_text or ""),
|
||||
attachments=attachments,
|
||||
skill_binding_role=skill_binding_role,
|
||||
on_token=on_token,
|
||||
on_progress=on_progress,
|
||||
should_stop=should_stop,
|
||||
)
|
||||
if video_early is not None:
|
||||
return video_early
|
||||
# Image/video specialist early-exit lanes removed; OCR remains via query_image_attachment.
|
||||
|
||||
skill_exec = SkillExecutor(config=ToolExecutionConfig(max_workers=max(1, min(int(max_tool_workers or 8), 32))))
|
||||
tool_traces: list[dict[str, Any]] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue