1. Redis 状态管理方案
1.1 状态键设计
Redis Key 结构:
// Key 格式: agent_runtime_stopping:{appId}:{chatId}
const WORKFLOW_STATUS_PREFIX = 'agent_runtime_stopping';
type WorkflowStatusKey = `${typeof WORKFLOW_STATUS_PREFIX}:${string}:${string}`;
// 示例: agent_runtime_stopping:app_123456:chat_789012
状态值设计:
- 存在键 (值为 1): 工作流应该停止
- 不存在键: 工作流正常运行
- 设计简化: 不使用状态枚举,仅通过键的存在与否判断
参数类型定义:
type WorkflowStatusParams = {
appId: string;
chatId: string;
};
[Description truncada. Veja o README completo no GitHub.]