feat: NewAPI稳定性方案 — Agnes接入(cron/distill/巡检优先) + palace-prompts提示词体系完善

- config.yaml: 新增 agnes provider (agnes-2.0/2.5-flash, key从.env读)
- model-health.py: 巡检优先测 Agnes (独立端点+质量探针), agnes-2.0探针100分
- agnes-ai skill: 更新 key 状态为已恢复
- comfyui-rtx3050: 大场景全景三件套 + 双管线对比结论
- prompt-engineering: 管线选择规则(大场景用Agnes/写实人像用ComfyUI)
This commit is contained in:
小唯 A06 2026-08-17 22:25:20 +08:00
parent d1f238097a
commit 994cebccf6
6 changed files with 254 additions and 91 deletions

View File

@ -9,10 +9,10 @@ providers:
cost_factor: 0.0
default_model: nvidia/nemotron-3-super-120b-a12b
models:
- nvidia/nemotron-mini-4b-instruct
- openai/gpt-oss-120b
- nvidia/nvidia-nemotron-nano-9b-v2
- meta/llama-3.1-8b-instruct
- nvidia/nemotron-mini-4b-instruct
- openai/gpt-oss-120b
- nvidia/nvidia-nemotron-nano-9b-v2
- meta/llama-3.1-8b-instruct
rate_limit: 1000
timeout: 30
omniroute-local:
@ -21,9 +21,9 @@ providers:
cost_factor: 0.0
default_model: auto/chat
models:
- auto/chat
- auto/best-free
- auto/coding
- auto/chat
- auto/best-free
- auto/coding
rate_limit: 1000
timeout: 30
deepseek:
@ -32,14 +32,24 @@ providers:
cost_factor: 0.0
default_model: deepseek-v4-flash
models:
- deepseek-v4-flash
- deepseek-v4-pro
- deepseek-v4-flash
- deepseek-v4-pro
rate_limit: 1000
timeout: 30
agnes:
key_env: AGNES_API_KEY
base_url: https://apihub.agnes-ai.com/v1
cost_factor: 0.0
default_model: agnes-2.0-flash
models:
- agnes-2.0-flash
- agnes-2.5-flash
rate_limit: 1000
timeout: 60
fallback_providers: '["deepseek"]'
toolsets:
- hermes-cli
- web
- hermes-cli
- web
agent:
max_turns: 90
gateway_timeout: 1800
@ -264,9 +274,9 @@ display:
ephemeral_system_ttl: 0
runtime_footer:
fields:
- model
- context_pct
- cwd
- model
- context_pct
- cwd
copy_shortcut: auto
tool_progress: all
tool_progress_style: accumulate
@ -357,12 +367,12 @@ moa:
presets:
expert-panel:
reference_models:
- provider: newapi-local
model: openai/gpt-oss-120b
- provider: newapi-local
model: nvidia/llama-3.3-nemotron-super-49b-v1
- provider: newapi-local
model: mistralai/mistral-large-3-675b-instruct-2512
- provider: newapi-local
model: openai/gpt-oss-120b
- provider: newapi-local
model: nvidia/llama-3.3-nemotron-super-49b-v1
- provider: newapi-local
model: mistralai/mistral-large-3-675b-instruct-2512
aggregator:
provider: newapi-local
model: openai/gpt-oss-120b
@ -420,37 +430,38 @@ approvals:
mcp_reload_confirm: true
destructive_slash_confirm: false
command_allowlist:
- kill process via pgrep expansion (self-termination)
- pipe remote content to shell
- sudo with privilege flag (stdin/askpass/shell/list)
- git force push (rewrites remote history)
- kill hermes/gateway process (self-termination)
- overwrite system config
- SQL TRUNCATE
- find -delete
- copy/move file into /etc/
- script execution via -e/-c flag
- stop/restart system service
- shell command via -c/-lc flag
- script execution via heredoc
- world/other-writable permissions
- delete in root path
- copy/move file into system config path
- overwrite system file via redirection
- in-place edit of Hermes config/env
- force kill processes
- hermes update (restarts gateway, kills running agents)
- in-place edit of system config
- start gateway outside systemd (use 'systemctl --user restart hermes-gateway')
- git force push short flag (rewrites remote history)
- overwrite system file via tee
- sudo with combined-flag privilege escalation
- overwrite project env/config via redirection
- disk copy
- force kill processes (killall -KILL)
- stop/restart hermes gateway (kills running agents)
- command parser limit or malformed executable payload
- recursive delete
- find -delete
- force kill processes (killall -KILL)
- script execution via -e/-c flag
- overwrite project env/config file
- git force push short flag (rewrites remote history)
- in-place edit of Hermes config/env
- SQL TRUNCATE
- recursive delete
- in-place edit of system config
- shell command via -c/-lc flag
- copy/move file into /etc/
- overwrite system file via redirection
- hermes update (restarts gateway, kills running agents)
- world/other-writable permissions
- disk copy
- kill process via pgrep expansion (self-termination)
- kill hermes/gateway process (self-termination)
- delete in root path
- start gateway outside systemd (use 'systemctl --user restart hermes-gateway')
- stop/restart system service
- force kill processes
- overwrite system config
- overwrite system file via tee
- copy/move file into system config path
- git force push (rewrites remote history)
- pipe remote content to shell
- sudo with combined-flag privilege escalation
- script execution via heredoc
- stop/restart hermes gateway (kills running agents)
- command parser limit or malformed executable payload
- overwrite project env/config via redirection
- sudo with privilege flag (stdin/askpass/shell/list)
hooks_auto_accept: false
security:
allow_private_urls: false
@ -547,16 +558,16 @@ _config_version: 33
mcp_servers:
codegraph:
args:
- serve
- --mcp
- serve
- --mcp
command: codegraph
connect_timeout: 60
enabled: true
timeout: 120
github:
args:
- -y
- '@modelcontextprotocol/server-github'
- -y
- '@modelcontextprotocol/server-github'
command: npx
enabled: true
env:
@ -565,8 +576,8 @@ mcp_servers:
openclaw:
command: openclaw
args:
- mcp
- serve
- mcp
- serve
connect_timeout: 60
timeout: 300
codebase-memory-mcp:
@ -575,30 +586,30 @@ mcp_servers:
dbx:
command: npx
args:
- -y
- '@dbx-app/mcp-server'
- -y
- '@dbx-app/mcp-server'
enabled: true
timeout: 120
connect_timeout: 60
platform_toolsets:
cli:
- browser
- clarify
- code_execution
- computer_use
- cronjob
- delegation
- file
- image_gen
- memory
- session_search
- skills
- terminal
- todo
- tts
- vision
- web
- mcp-codegraph
- browser
- clarify
- code_execution
- computer_use
- cronjob
- delegation
- file
- image_gen
- memory
- session_search
- skills
- terminal
- todo
- tts
- vision
- web
- mcp-codegraph
platforms:
webhook:
enabled: true
@ -612,9 +623,9 @@ platforms:
plugins:
disabled: []
enabled:
- agentic-sms-gateway
- cronalytics
- rtk-rewrite
- agentic-sms-gateway
- cronalytics
- rtk-rewrite
weixin:
enabled: true
extra:
@ -627,4 +638,26 @@ weixin:
session_reset: {}
known_plugin_toolsets:
cli:
- spotify
- spotify
# ── Fallback Model ────────────────────────────────────────────────────
# Automatic provider failover when primary is unavailable.
# Uncomment and configure to enable. Triggers on rate limits (429),
# overload (529), service errors (503), or connection failures.
#
# Supported providers:
# openrouter (OPENROUTER_API_KEY) — routes to any model
# openai-codex (OAuth — hermes auth) — OpenAI Codex
# nous (OAuth — hermes auth) — Nous Portal
# zai (ZAI_API_KEY) — Z.AI / GLM
# kimi-coding (KIMI_API_KEY) — Kimi / Moonshot
# kimi-coding-cn (KIMI_CN_API_KEY) — Kimi / Moonshot (China)
# minimax (MINIMAX_API_KEY) — MiniMax
# minimax-cn (MINIMAX_CN_API_KEY) — MiniMax (China)
# bedrock (AWS IAM / boto3) — AWS Bedrock (Converse API)
#
# For custom OpenAI-compatible endpoints, add base_url and key_env.
#
# fallback_model:
# provider: openrouter
# model: anthropic/claude-sonnet-4

View File

@ -19,6 +19,31 @@ API = "http://127.0.0.1:3000/v1"
KEY = "0ExNiLblJvIWBDpkS50fwOBw4MmqLyKdHJK5iQtlw9dOMWBP"
OUTPUT = os.path.expanduser("~/.hermes/model-health.json")
# ============ Agnes 模型2026-08-17 新增:优先巡检) ============
# Agnes 是稳定备用 LLMcron/distill 已切换),巡检必须优先
AGNES_API = "https://apihub.agnes-ai.com/v1"
AGNES_KEY = ""
for _l in open(os.path.expanduser("~/.hermes/.env"), encoding="utf-8"):
if _l.startswith("AGNES_API_KEY=") and not _l.startswith("#"):
AGNES_KEY = _l.strip().split("=", 1)[1]
break
# Agnes 模型(排最前 = 优先巡检)
AGNES_MODELS = [
"agnes-2.0-flash", # 稳定主力cron/distill 在用)
"agnes-2.5-flash", # 新版备用
]
# Agnes 上下文长度K
CONTEXT_LENGTHS_AGNES = {
"agnes-2.0-flash": 128,
"agnes-2.5-flash": 128,
}
def _get_endpoint(model: str) -> dict:
"""返回 (base_url, headers) — agnes 模型走独立端点,其余走 NewAPI"""
if model.startswith("agnes-"):
return AGNES_API, {"Authorization": f"Bearer {AGNES_KEY}", "Content-Type": "application/json"}
return API, HEADERS
# ============ 配置自愈 ============
CONFIG_PATH = os.path.expanduser("~/.hermes/config.yaml")
# 配置中声明的模型 — 巡检会交叉验证
@ -104,10 +129,15 @@ OPENCLAW_MODELS = [
"qwen/qwen3-next-80b-a3b-thinking",
]
ALL_MODELS = [m for m in (
CONFIG_DECLARED_MODELS + [m for m in CANDIDATE_POOL if m not in CONFIG_DECLARED_MODELS]
+ [m for m in OPENCLAW_MODELS if m not in CONFIG_DECLARED_MODELS and m not in CANDIDATE_POOL]
) if m not in KNOWN_PAID]
# Agnes 优先测试(排在 ALL_MODELS 最前);后面的非 agnes 模型才做去重过滤
_OTHER_MODELS = [
m for m in (
CONFIG_DECLARED_MODELS
+ [m for m in CANDIDATE_POOL if m not in CONFIG_DECLARED_MODELS]
+ [m for m in OPENCLAW_MODELS if m not in CONFIG_DECLARED_MODELS and m not in CANDIDATE_POOL]
) if m not in KNOWN_PAID and m not in AGNES_MODELS
]
ALL_MODELS = AGNES_MODELS + _OTHER_MODELS
HEADERS = {
"Authorization": f"Bearer {KEY}",
@ -197,7 +227,7 @@ def _speed_score(latency_ms: int, fastest_latency: int) -> float:
def _context_score(model: str) -> float:
"""上下文长度分:越长越高 256K→100, 128K→80, 64K→60, 32K→40, 8K→10"""
ctx = CONTEXT_LENGTHS.get(model, 128) # 未知默认128
ctx = CONTEXT_LENGTHS_AGNES.get(model, CONTEXT_LENGTHS.get(model, 128)) # 未知默认128
if ctx >= 256:
return 100
if ctx >= 128:
@ -224,10 +254,11 @@ def _run_quality_probe(model: str, trials: int = 3) -> dict:
"max_tokens": 200,
"temperature": 0.1,
}).encode()
base_url, hdrs = _get_endpoint(model)
req = urllib.request.Request(
f"{API}/chat/completions",
f"{base_url}/chat/completions",
data=payload,
headers=HEADERS,
headers=hdrs,
method="POST",
)
try:
@ -309,10 +340,11 @@ def test_model(model: str, fastest_latency: int = None) -> dict:
"max_tokens": 20,
}).encode()
base_url, hdrs = _get_endpoint(model)
req = urllib.request.Request(
f"{API}/chat/completions",
f"{base_url}/chat/completions",
data=payload,
headers=HEADERS,
headers=hdrs,
method="POST",
)
@ -415,8 +447,9 @@ def _verify_model_usable(model: str) -> bool:
"messages": [{"role": "user", "content": "hi"}],
"max_tokens": 5,
}).encode()
base_url, hdrs = _get_endpoint(model)
req = urllib.request.Request(
f"{API}/chat/completions", data=payload, headers=HEADERS, method="POST"
f"{base_url}/chat/completions", data=payload, headers=hdrs, method="POST"
)
try:
with urllib.request.urlopen(req, timeout=20) as resp:

View File

@ -17,7 +17,7 @@ homepage: https://platform.agnes-ai.com
|------|-----|
| **Base URL** | `https://apihub.agnes-ai.com/v1` |
| **国内新域名** | `https://agnes-ai.cn`2026-08-15 文章宣布,**实测 HTTP 403 需要 API key**,作为备用入口;主入口仍是 apihub.agnes-ai.com|
| **API Key** | ⚠️ **2026-08-15 实测:`~/.hermes/.env` 无 AGNES_API_KEYkey 已丢失**(织忆只留 sk-7k9e9... 前段)。需要牧尘从 https://platform.agnes-ai.com 个人中心重新获取 |
| **API Key** | **2026-08-17 已恢复**:完整 51 字符 key 在 `~/.hermes/.env``AGNES_API_KEY=sk-7k9e...2ikW`),来源 obsidian `/home/muc/mc/牧尘/claw/key.md`。⚠️ 注意Hermes 工具输出会把 key 显示成脱敏版sk-7k9...2ikW 带省略号),但文件里存的是完整 key——显示脱敏≠存储脱敏别误判"key 丢失" |
| **鉴权方式** | `Authorization: Bearer {key}` |
| **日额限制** | 文本 50万 token/天,图像 500张/天,视频 150条/天 |
| **2.5 Pro Alpha 定价** | 输入缓存命中 0.025元/百万token未命中 3元/百万token输出 6元/百万token≈DeepSeek V4 涨价前)|

View File

@ -162,6 +162,7 @@ cp ~/ComfyUI/models/ultralytics/face_yolov8m.onnx ~/ComfyUI/models/onnx/
5. Impact Pack 加载时 `SAM2 functionality unavailable` 是正常警告(只影响 SAM 高级分割FaceDetailer 的 YOLO 路径不受影响)
> 📎 相关文件:`references/face-detailer-workflow-20260801.md`FaceDetailer 完整可执行工作流 + 坑速查表)
> 📎 相关文件:`references/dual-pipeline-comfyui-vs-agnes-20260817.md`ComfyUI vs Agnes 双管线对比 + Agnes 2.0/2.1 稳定性 + SD 人影实化坑)
## ControlNet OpenPose2026-08-01 已验证)
@ -239,6 +240,51 @@ rm models/checkpoints/xxx.safetensors
- **背景**:月光海边/城市夜景,统一色调 `cool blue and teal tones`
- **禁止**`monochrome, grayscale`(压制色彩),`warm colors, orange, yellow, sunset`(色调混乱)
## 生成场景/建筑概念图MajicMIX v62026-08-17 实测 12.7s
国风建筑/场景类需求(宫殿/水乡/古城/仙宫)同样可用 ComfyUI 出**写实概念图**,与 Agnes 云端对比各有优势:
- 参数与人物相同MajicMIX v6 + 512×768 + dpmpp_2m/karras 25 步 cfg 7 → **~12.7s3.16 it/s**
- 中文提示词直接可用urllib JSON 自动编码),来自 palace-prompts / prompt-cli 的成品词直接喂
- 负向必加建筑类词:`distorted architecture, duplicate buildings, readable text, logo, low detail, flat image`
⚠️ **「人影」实化坑2026-08-17 实测)**SD 模型会把提示词里「阴影中的人影」「远景人影」「人物剪影」实化成**画面主角**暗黑诡城图前景多了一位红衣女子Agnes 版则正确保持纯场景)。纯场景出图必须:删掉人影类词,或改「空无一人/无人物」;人物只做尺度锚点时用「极小背影、占画面 1-4%」。
### 双管线选择ComfyUI vs Agnes2026-08-17 实测对比)
| 需求 | 管线 | 依据 |
|------|------|------|
| 写实质感/材质细节 | **ComfyUI MajicMIX v6** | 纹理真实,建筑/材质表现强 |
| 大场景概念/构图大胆 | **Agnes 云端** | 想象力放得开,氛围宏大 |
| 人物四视图一致性 | **Agnes** | SD 多视图/人物一致性弱(易实化、变形) |
| 免费额度 | ComfyUI 本地免费 | Agnes 500张/天 |
| 速度 | ComfyUI ~13s | Agnes ~30-60s |
> 结论:互补使用。要真实感走本地,要概念氛围走云端。交付后立即 kill ComfyUI资源铁律见下
## 大场景全景三件套2026-08-17 实测SD1.5 默认出局部特写+人影实化)
> 用户反馈「comfyui出的图都是局部体现不了大场景」「第一张出的是人物」。SD1.5 的 512x768 竖构图天然偏局部特写;「阴影中的人影」会被实化成人物主角。修复三件套:
1. **横版 768x512**:全景/场景图用横版(竖版适合人物/单体建筑)
2. **全景引导词**(正向加):
```
ultra-wide aerial panoramic establishing shot, vast sprawling cityscape,
entire city/town visible in frame, high aerial view looking down, wide angle,
endless layers of rooftops extending to the horizon
```
3. **去人物**(负向加):
```
person, people, woman, man, human, figure, character, portrait, close-up,
single building, zoomed in, closeup, macro, isolated building, head and shoulders
```
⚠️ 正向里**不要写**「人影/人物剪影/阴影中的人影」——SD 会把它当主角画出来要写「no people, empty streets」。
- 效果鸟瞰全景、整座城尽收眼底、无人物、无文字水印2026-08-17 实测两张全过)
- 参数steps 28, cfg 7.5比默认略高场景更稳dpmpp_2m + karras
> ⚠️ **牧尘最终结论2026-08-17**:即使三件套修好局部/人物问题,**大场景图也别用 ComfyUI 出**——SD1.5 上限就在 512-768px宏大感与 Agnes 云端差太远(牧尘原话"比起Agnes出图还是差太远")。三件套只在"快速本地示意/离线"时用;**大场景/概念图默认走 Agnes 云端**ComfyUI 正确定位 = **写实人物/半身/网红脸**MajicMIX v6 强项)。
## 生成国风/汉服美女MajicMIX v62026-08-03 实测 9s 无缺陷)
用户点名"小红书风格美女图,国风"时的标准姿势。**MajicMIX v6 + 512×768 竖版**小红书比例dpmpp_2m + karras 25 步9 秒出图vision_analyze 自评无手部/脸部缺陷。

View File

@ -0,0 +1,40 @@
# 双管线出图对比ComfyUI vs Agnes— 2026-08-17 实测
> 场景:用户让同一批 palace-prompts 提示词分别走 ComfyUI 和 Agnes 出图对比。
> 结论:**互补使用**,不是替代关系。
## 对比结果(同 prompt暗黑东方诡城 / 江南水乡古城)
| 维度 | ComfyUI (MajicMIX v6) | Agnes (agnes-image-2.0-flash) |
|------|----------------------|------------------------------|
| 写实质感 | ✅ 强(纹理/材质真实) | 偏概念插画 |
| 场景氛围 | 构图略保守 | 大场景/概念氛围更宏大 |
| 速度 | ~12.7s3.16 it/s | ~30-60s |
| 成本 | 本地免费 | 免费 500张/天 |
| 中文提示词 | ✅ 直接可用 | ✅ 直接可用 |
| 模型理解 | 字面实化(见坑) | 抽象氛围还原好 |
## 管线选择规则
- **要真实感/写实** → ComfyUIMajicMIX v6 亚洲写实最强)
- **要大场景/概念氛围** → Agnes云端想象力放得开
- **人物四视图一致性** → AgnesSD 多视图/人物一致性弱)
- **批量/要快** → ComfyUI本地快
## ⚠️ SD「人影实化」坑关键
SD 1.5 系模型会把提示词里「阴影中的人影」「远景人影」「人物剪影」等词**实化成画面主角**。
- 实测:暗黑诡城 prompt 含「阴影中的人影」→ ComfyUI 版前景多了一位红衣女子Agnes 版正确保持纯场景。
- **修法**:纯场景出图删掉人影类词,或改成「空无一人/无人物」;人物只做尺度锚点时用「极小背影、占画面 1-4%」。
## Agnes 模型稳定性实测
- `agnes-image-2.1-flash`1/2 成功,另 1 次 read timeout长 prompt 更明显)
- `agnes-image-2.0-flash`4/4 成功,稳定
- **图像生成默认用 2.0-flash**;超时重试时 timeout 提到 180s
## 操作注意
- ComfyUI 用 `HF_ENDPOINT=https://hf-mirror.com` 启动(防 ControlNet aux 卡死)
- ComfyUI 交付后**立即 kill**(占 ~2.2GB 内存 + 1.1GB 显存,长期挂着触发系统看门狗告警)
- 生成产物统一存 `~/projects/quark-prompts/实测/`

View File

@ -72,6 +72,17 @@ prompt-cli stats # 统计
| 人物过大抢戏 | 尺度锚点失效 | 锁 1-4% 画面占比 |
| 颜色全橙金污染 | 色彩预算失控 | 选择性高饱和,不全局 |
## 管线选择2026-08-17 实测结论,牧尘确认)
| 需求 | 用哪个 | 原因 |
|------|--------|------|
| **大场景/概念图/全景**(国风古城/仙宫/现代建筑群) | **Agnes 云端** | 本地 SD1.5 出 512-768px 局部特写宏大感差太远Agnes 1024px+ 构图想象力碾压 |
| **写实人物/半身/网红脸**(四视图角色卡/穿搭) | **ComfyUI + MajicMIX v6** | 本地写实亚洲脸最强免费12-14s/张 |
| **任何要惊艳感的人像** | ComfyUI + Hires Fix | 见 comfyui-rtx3050 skill 三招 |
| 快速出图不想等 | Agnes 2.0-flash | ~30-60s免费 500 张/天 |
⚠️ 铁律:**大场景图别用 ComfyUI 出**(牧尘 2026-08-17 实测结论"比起Agnes出图还是差太远"ComfyUI 定位 = 写实人物/细节。
## 资源
- 领域 skills`char-palace-prompts` / `guofeng-palace-prompts` / `modern-palace-prompts` / `xian-palace-prompts` / `prompt-template-kit`