.cursor/skills/ai-features/SKILL.md
Guides AI agent features in petconnect-app including LLM providers (DeepSeek, Doubao, Gemini), anti-abuse constraints, prompt design, and keyword-based human simulation. Use when adding AI agents, changing LLM providers, adjusting rate limits, or modifying agent prompts.
npx skillsauth add Aafff623/pet-adoption-app ai-featuresInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
flowchart TB
subgraph Entry [统一入口]
LLM[lib/api/llm.ts]
end
subgraph Providers [提供商]
DS[DeepSeek]
DB[豆包]
GM[Gemini]
end
subgraph Config [配置]
Agents[lib/config/aiAgents.ts]
Guard[lib/utils/aiGuard.ts]
Reply[lib/utils/autoReply.ts]
end
LLM -->|VITE_LLM_PROVIDER| DS
LLM -->|VITE_LLM_PROVIDER| DB
LLM -->|VITE_LLM_PROVIDER| GM
LLM --> Agents
LLM --> Guard
generateAgentReply,按 VITE_LLM_PROVIDER 分发lib/api/llmProviders/deepseek.ts、doubao.ts,以及 lib/api/gemini.tsAgentType 中增加新类型AI_AGENTS 中增加配置(含 systemPrompt、tone、maxTokens)conversations.agent_type 已支持任意字符串,无需迁移MAX_MESSAGE_LENGTH、COOLDOWN_MS、RECENT_USER_MESSAGES_COUNTshouldAllowAI(message, lastAiReplyTime, recentUserMessages) 返回 { allow, fallback? }ANTI_ABUSE_RULES,要求模型对刷屏/重复内容简短回复修改限流参数时,仅改 lib/utils/aiGuard.ts 中的常量。
| Provider | 必填变量 |
|----------|----------|
| deepseek | VITE_DEEPSEEK_API_KEY |
| doubao | VITE_DOUBAO_API_KEY、VITE_DOUBAO_MODEL_ID |
| gemini | VITE_GEMINI_API_KEY |
切换 provider 时设置 VITE_LLM_PROVIDER=deepseek|doubao|gemini,默认 deepseek。
matchWhenShortOnly 用于「确认」类避免误匹配(如「你可以帮我做什么」中的「可以」)AiAgentConfig.avatar 字段data:image/svg+xml,%3C...%3E(URL 编码 SVG)fetchConversations 中自动从配置关联头像agentType 分组)去重,合并未读数,保留最新消息新增或修改智能体时,务必在 AiAgentConfig 中配置 avatar 字段。
当用户发送超过 400 字的消息(MAX_MESSAGE_LENGTH)时:
[分 X/N] 标签(如 [分 1/3]\n消息内容)shouldAllowAI),确保一致性handleSendMessage 函数(行 140-235)shouldAllowAI(支持环境变量 VITE_AI_MAX_MESSAGE_LENGTH 调整)| 变量 | 默认值 | 说明 |
|------|--------|------|
| VITE_AI_MAX_MESSAGE_LENGTH | 400 | 单条消息分段阈值(字符数) |
tools
Guides Supabase usage in petconnect-app including MCP tool calls, migrations, RLS, and API layer conventions. Use when working with Supabase, executing SQL, applying migrations, list_tables, execute_sql, RLS policies, or database schema changes.
tools
项目仓库瘦身与规范。Use when cleaning repo, optimizing .gitignore, removing large files, or organizing project structure. 约定:脚本仅用 PowerShell / npm 跨平台命令,不生成 .sh 文件。
development
Generates professional README files by synthesizing standard-readme, Best-README-Template, Google styleguide, and GitHub best practices. Use when creating or redesigning README.md, documenting projects, or when the user asks for README templates or best practices.
development
专业处理 README 与部署文档。Use when writing README, deployment guides, environment variable docs, or project structure documentation. 约定:README 必须包含环境变量表、获取 API Key 的链接、部署步骤、项目结构。