调整 workflow 执行逻辑:每个 action 完成后统一进入 LLM/规则审核,审核开始/结果可播报,审核阻断时自动暂停并给出建议 增强 chat 交互:支持执行中 Ctrl+C 中断并保存 checkpoint,后续可 resume 继续 增加运行时热更新能力:支持 set KEY=VALUE 和 load params <路径> 同步更新当前 state、config.txt 和 checkpoint 支持自定义 action 审核提示词:新增 --llm-action-analysis-prompt-file / PAM_LLM_ACTION_ANALYSIS_PROMPT_FILE 新增 prompts/action_review.txt,落地保存当前默认审核提示词,便于后续按基线调整 更新 Linux 打包脚本,将 prompts/action_review.txt 一并带入发布包 同步更新 README、流程图、todo 和打包文档,修正 --analyze-actions 语义说明与 chat 最新行为说明
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""LLM client 需要实现的共享协议。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Protocol
|
|
|
|
from pam_deploy_graph.models import (
|
|
ActionResult,
|
|
ExecutionStrategy,
|
|
LlmActionAnalysis,
|
|
LlmDeployPlan,
|
|
LlmIntentResult,
|
|
LlmParamResult,
|
|
)
|
|
|
|
|
|
class LlmClient(Protocol):
|
|
"""Agent 使用的最小 LLM 能力接口。"""
|
|
|
|
def understand_request(self, text: str) -> LlmIntentResult:
|
|
"""识别用户自然语言请求的意图。"""
|
|
...
|
|
|
|
def extract_params(self, text: str, base_params: dict[str, Any] | None = None) -> LlmParamResult:
|
|
"""从自然语言中抽取部署参数。"""
|
|
...
|
|
|
|
def generate_plan(
|
|
self,
|
|
*,
|
|
params: dict[str, Any],
|
|
intent: str,
|
|
strategy: ExecutionStrategy,
|
|
) -> LlmDeployPlan:
|
|
"""根据参数和意图生成部署计划。"""
|
|
...
|
|
|
|
def analyze_action_result(
|
|
self,
|
|
*,
|
|
action: str,
|
|
result: ActionResult,
|
|
state_summary: dict[str, Any],
|
|
) -> LlmActionAnalysis:
|
|
"""分析 action 执行结果,并给出是否允许继续执行的建议。"""
|
|
...
|