Skip to content

Suaig/ai_expert_tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Expert - AI 专家咨询工具

让 AI 能够咨询更高级的 AI 模型,以 MCP Server + CLI 双模式运行。

安装

前置要求:Python 3.11+、uv

# 克隆项目
git clone <repo-url> ai_co_tools
cd ai_co_tools

# 安装依赖
uv sync

配置

将配置文件放到 ~/.ai_expert/config.yaml

experts:
  - name: "deepseek"
    model: "deepseek-chat"
    provider: "openai"
    base_url: "https://api.deepseek.com/v1"
    api_key_env: "DEEPSEEK_API_KEY"   # 环境变量名 或 直接填入 API Key
    description: "推理专家,擅长复杂算法和架构设计"
    tags: ["算法", "架构", "推理"]
    max_tokens: 8192
    temperature: 0.7

  - name: "gpt4o"
    model: "gpt-4o"
    provider: "openai"
    base_url: "https://api.openai.com/v1"
    api_key_env: "OPENAI_API_KEY"
    description: "通用高级专家"
    tags: ["代码", "知识", "通用"]

conversations_dir: "~/.ai_expert/conversations"
default_expert: "deepseek"

api_key_env 支持两种写法:填环境变量名(如 OPENAI_API_KEY)或直接填 API Key 值。

配置加载优先级:AI_EXPERT_CONFIG 环境变量 > ~/.ai_expert/config.yaml > 环境变量直连模式

注册到 Claude Code

claude mcp add ai-expert -- uv run --directory /path/to/ai_co_tools ai-expert serve

重启 Claude Code 会话后生效。

CLI 使用

列出专家

ai-expert list-experts

咨询专家

# 基本提问(默认启用 thinking 模式,隐藏推理过程)
ai-expert ask deepseek "如何设计分布式锁?"

# 附带上下文
ai-expert ask deepseek "这段代码有什么问题?" -c "def foo(): return 1/0"

# 显示推理过程
ai-expert ask deepseek "分析快排的时间复杂度" --verbose

# 关闭 thinking 模式
ai-expert ask deepseek "1+1=?" --no-thinking

# 指定 system prompt 和标题
ai-expert ask deepseek "设计一个缓存系统" -s "你是分布式系统架构师" -t "缓存设计"

继续对话

ai-expert continue <conversation_id> "追问:如果用 Redis 实现呢?"
ai-expert continue <conversation_id> "还有其他方案吗?" --verbose

管理对话

# 列出所有对话
ai-expert list-conversations

# 按专家过滤
ai-expert list-conversations --expert deepseek

# 查看完整对话
ai-expert get-conversation <conversation_id>

# 删除指定对话
ai-expert clear-conversation <conversation_id>

# 清除所有对话
ai-expert clear-conversation

启动 MCP 服务

ai-expert serve

MCP 工具

注册到 Claude Code 后,以下工具可供 AI 调用:

工具 参数 说明
list_experts 列出所有可用专家
ask_expert expert_name, question, context_info?, system_prompt?, title?, thinking?, verbose? 发起新咨询
continue_conversation conversation_id, message, thinking?, verbose? 继续已有对话
list_conversations expert_name? 列出历史对话
get_conversation conversation_id 查看完整对话
clear_conversation conversation_id? 删除对话(省略 ID 则清除全部)

Thinking 模式

  • 默认启用:所有咨询默认使用 thinking/推理模式
  • 隐藏推理:默认只返回最终答案,设置 verbose=True 显示推理过程
  • 多轮不传递:thinking 内容不会存入对话历史,续对话时不会重复传递

支持的 Provider

Provider 适用模型
openai OpenAI、DeepSeek、及所有 OpenAI 兼容 API
anthropic Claude 系列模型

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages