8000 feat(acp): support attachments and align chat interactions by akazwz · Pull Request #811 · felinics/Memoh · GitHub
[go: up one dir, main page]

Skip to content

feat(acp): support attachments and align chat interactions - #811

Merged
sheepbox8646 merged 3 commits into
felinics:mainfrom
akazwz:feat/acp-optimization
Jul 16, 2026
Merged

sheepbox8646 merged 3 commits into
felinics:mainfrom
akazwz:feat/acp-optimization

Conversation

@akazwz
@akazwz akazwz commented Jul 15, 2026 •
Copy link
Copy Markdown
Member

这次改了什么

这次补齐 ACP 会话的附件能力,并统一 ACP 与 Memoh Agent 在聊天页上的主要交互。用户继续使用原有的附件入口和模型选择器,不新增“上传图片”入口,也不增加功能开关。

附件

  • ACP 会话现在可以发送图片、普通文件和由长文本粘贴生成的附件,也支持引用消息中的附件。
  • 可内联图片会在外部 Agent 支持图片输入时作为 ACP 图片内容发送。
  • 普通文件、公开 URL,以及需要降级的图片,会通过 Agent 可访问的路径或 URL 放入当前轮上下文。
  • 外部 Agent 不支持图片输入时,只要图片存在可访问引用,就会自动改用附件引用;无法提供引用时返回明确错误。
  • 支持只发送附件,不要求同时输入文本。
  • ACP 会话中的附件无效、不可用或无法让 Agent 访问时,会返回结构化、本地化错误,不再静默丢失。

聊天界面

  • ACP 与 Memoh Agent 复用同一个输入框、附件入口和模型选择器。
  • ACP 模型使用现有模型列表样式,并展示 Agent 返回的模型描述(description)。
  • 本 PR 不提供 ACP 推理强度选择;这部分将在 [Feature]: ACP 支持独立配置推理强度 #812 中单独实现。

默认 Agent

  • 将原来的“默认外部 Agent”开关和 Agent 选择合并为一个“默认 Agent”下拉框,可以直接选择 Memoh 或已启用并完成配置的 ACP Agent。
  • 内置对话模型只供 Memoh Agent 使用。即使没有配置内置对话模型,也可以把 ACP Agent 设为默认 Agent。
  • 默认 Agent 只影响之后新建的一对一聊天会话;已有会话和群聊 Discuss 会话保持原来的运行时。
  • 已保存的默认 Agent 不可用时,设置页会明确提示,并要求切换到 Memoh 或其他可用 Agent 后再保存。

实现说明

  • 当前消息和引用消息中的附件统一进入 ACP 附件准备流程,非图片附件不再被忽略。
  • 已持久化附件会从 content_hash 解析 Agent 可访问的引用;落入备用存储的文件会按需提升到工作区可访问的主存储。
  • 容器工作区和受信任的本地工作区(trusted local workspace)分别返回各自命名空间中的可访问路径。
  • workspace bridge 写文件时先写同目录临时文件,再通过 rename 原子提交,避免暴露未写完的文件。
  • ACP runtime 根据 Agent 的图片能力选择图片内容或附件引用;无效输入通过 acpfeedback 返回对应错误码和 i18n key。

测试

  • go test ./...
  • pnpm exec vitest run --project web:79 个测试文件、845 个测试全部通过
  • pnpm --filter @memohai/web build
  • mise run lint

Closes #805
Closes #789

Follow-up: #812

@akazwz akazwz changed the title feat(acp): support attachments and unify chat controls feat(acp): 支持附件并统一聊天交互 Jul 15, 2026
@akazwz akazwz changed the title feat(acp): 支持附件并统一聊天交互 feat(acp): support attachments and align chat interactions Jul 15, 2026
@akazwz
akazwz marked this pull request as ready for review July 15, 2026 13:49
@akazwz
akazwz requested review from a team July 15, 2026 13:49
@akazwz
akazwz force-pushed the feat/acp-optimization branch from d3adfce to 366edfa Compare July 16, 2026 05:05
@sheepbox8646
sheepbox8646 merged commit 7ade26b into felinics:main Jul 16, 2026
14 checks passed
@akazwz
akazwz deleted the feat/acp-optimization branch July 16, 2026 05:14
ChrAlpha added a commit to ChrAlpha/Memoh that referenced this pull request Jul 24, 2026
…tion

Mechanical layer: accepted directory-rename relocations
(conversation/flow -> agent/application, contextfrag -> agent/context/
fragment, historyfrag -> agent/context/history, compaction -> agent/
context/compaction, contextlimit -> agent/context/limit, pipeline ->
chat/timeline, acpagent -> agent/runtime/acp, conversation -> agent/turn,
message -> chat/message, session -> chat/thread), moved the 17 restack
files left at the old internal/agent root into runtime/native, and swept
import paths/identifiers (Resolver->Service, req.SessionID->ThreadID,
conversation aliases) across 109+ files.

Semantic resolutions:
- application/service.go: restack's resolve() semantics under felinics#856 naming;
  kept felinics#847 ForkContextSourceMessageIDs and felinics#808/felinics#845 workspace-target
  notice as unions; ResolveRunConfigResult regains ContextBudgetMaxTokens.
- prepareRunConfig: query materialization stays OWNED by the context view
  (ContextQueryMaterialized contract) — main's eager append-to-Messages
  block was not adopted; hook texts + system sections restored.
- service_acp: union of restack's ContextView ACP sections/lifecycle/
  budget with upstream felinics#811 attachments, felinics#821 reasoning effort and
  leading-user cleanup; busy-turn gate ordered before attachment
  resolution; persistACPRound keeps the lifecycle parameter.
- continuation/user-input/tool-approval: resumeAgentSession abstraction
  kept, workspace-target threading added (ctx + ChatRequest); stage-1
  budget-trim signals ported into service_continuation.go.
- Broke two illegal layer edges introduced by relocation: turn no longer
  imports chat/timeline (forwardedFromValue inlined) and agent/context/
  fragment no longer imports turn (kind literals inlined); moved
  DiscussContextBuilder/DiscussContextInput from chat/timeline into
  contextview to satisfy the timeline-only-depends-on-turn arch guard.
- cmd/internal/core/providers.go now wires ContextViewApplier and
  LoopReselectMode (previously silently unwired in composition); discuss
  path gained ContextBudgetMaxTokens/lifecycle/tool-exchange threading
  with stale ContextSourceFrags cleared before pumpDiscussNative.
- Known gap carried forward: the discuss ContextView builder cannot attach
  at the turn.Service transport boundary (RC/TR richness is flattened
  before the command); discuss ACP keeps the designed fallback prompt.
- sqlc/swagger/sdk regenerated; deltas vs main are restack's net additions
  (context lifecycle queries/API/types, messages session_mode columns).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP 支持文件上传 UI: 模型选择/输入框样式不统一,模型列表缺少 description 字段

2 participants

0