Skip to content

Commit c90401a

Browse files
author
琴福
committed
提交pikapython-c
1 parent 1f52859 commit c90401a

File tree

133 files changed

+36636
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+36636
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copilot Instructions for pikapython-c
2+
3+
## 项目架构概览
4+
- 本项目为面向 PikaPython 的 AI 驱动 Python-C 编译加速器与自动化验证平台。
5+
- 主要组件:
6+
- `Client.py`:核心入口,负责与 MCP 服务端交互,管理会话、工具加载、LLM 初始化和代理图构建。
7+
- `MCP_server.py`:MCP 服务端,基于 FastMCP,注册文件读写等工具,供客户端调用。
8+
- `MCP_config.py`:配置文件,包含模型、API、超参数等关键配置。
9+
- `Prompt.py`:存放自动化测试/验证相关的 prompt 模板。
10+
11+
## 关键开发流程
12+
- 启动流程:
13+
1. `Client.py` 初始化 MCP 客户端(通过 `StdioServerParameters` 启动 `MCP_server.py`)。
14+
2. 加载工具(如文件读写),绑定到 LLM。
15+
3. 构建代理图(StateGraph),实现 agent-tool 交互。
16+
- 工具注册与调用:
17+
- 服务端通过 `@mcp.tool()` 装饰器注册工具(如 `read_file`, `write_file`)。
18+
- 客户端通过 LLM 工具绑定和 agent graph 调用工具。
19+
- 配置管理:
20+
- 所有模型、API、超参数均在 `MCP_config.py` 配置,需统一引用。
21+
22+
## 项目约定与模式
23+
- 所有文件路径需使用 Linux 风格(如 `./` 前缀)。
24+
- 工具函数需通过 MCP 工具注册,便于 agent 自动发现和调用。
25+
- 分支命名采用 `Feat_xxx` 约定,贡献流程见 README。
26+
- 测试/验证逻辑建议集中在 `Prompt.py`,便于 prompt 复用。
27+
28+
## 依赖与集成
29+
- 依赖 `langchain_openai`, `langchain_mcp_adapters`, `fastmcp` 等库。
30+
- LLM 相关参数(如模型名、API key)需从 `MCP_config.py` 读取。
31+
- MCP 工具与 LLM 通过 `bind_tools` 集成。
32+
33+
## 示例:注册与调用工具
34+
```python
35+
# 服务端注册工具
36+
@mcp.tool()
37+
def read_file(file_path: str) -> str:
38+
...
39+
40+
# 客户端调用工具
41+
self.mcp_tools = await load_mcp_tools(self.session)
42+
self.llm_with_tools = llm.bind_tools(self.mcp_tools)
43+
```
44+
45+
## 重要文件参考
46+
- `Client.py`:agent 入口与主流程
47+
- `MCP_server.py`:工具注册与服务端逻辑
48+
- `MCP_config.py`:统一配置
49+
- `Prompt.py`:自动化验证模板
50+
51+
---
52+
如有不清楚或遗漏的部分,请反馈以便进一步完善说明。

tools/pikapython-c/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/__pycache__
2+
file_create/
3+
logs/
4+
pikapython-linux/build/
5+
pikapython-linux/pikapython/pikascript-api/
6+
**/*.bak*
7+
**/*.backup*
8+
pikapython-linux/pikapython/pikascript-api*/

0 commit comments

Comments
 (0)