[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-xingyaoww--code-act":3,"tool-xingyaoww--code-act":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",142651,2,"2026-04-06T23:34:12",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":78,"owner_email":78,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":111,"forks":112,"last_commit_at":113,"license":114,"difficulty_score":115,"env_os":116,"env_gpu":117,"env_ram":118,"env_deps":119,"category_tags":131,"github_topics":132,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":137,"updated_at":138,"faqs":139,"releases":170},4690,"xingyaoww\u002Fcode-act","code-act","Official Repo for ICML 2024 paper \"Executable Code Actions Elicit Better LLM Agents\" by Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, Heng Ji.","CodeAct 是一个旨在提升大语言模型（LLM）智能体能力的开源框架。它创新性地提出使用可执行的代码作为智能体的统一行动空间，替代传统的纯文本或 JSON 格式指令。通过集成 Python 解释器，CodeAct 允许模型在多轮交互中动态执行代码、根据运行结果自我修正错误或生成新动作，从而显著提高了处理复杂任务的成功率。\n\n该方案主要解决了现有智能体在行动规划上不够灵活、难以利用执行反馈进行自我迭代的问题。实验数据显示，相较于传统方法，CodeAct 在多项基准测试中的任务成功率提升了高达 20%。项目不仅发布了核心方法论，还开源了包含 7000 条多轮交互数据的 CodeActInstruct 数据集，以及基于 Mistral 和 Llama 架构微调的 CodeActAgent 模型。\n\nCodeAct 特别适合 AI 研究人员、开发者以及希望构建高自主性智能体应用的技术团队使用。其独特的技术亮点在于将“代码执行”与“多轮反思”紧密结合，使模型具备类似程序员的调试与进化能力。此外，项目提供了完善的部署支持，兼容 Ollama、llama.cpp 及 Kubernetes 等多种环","CodeAct 是一个旨在提升大语言模型（LLM）智能体能力的开源框架。它创新性地提出使用可执行的代码作为智能体的统一行动空间，替代传统的纯文本或 JSON 格式指令。通过集成 Python 解释器，CodeAct 允许模型在多轮交互中动态执行代码、根据运行结果自我修正错误或生成新动作，从而显著提高了处理复杂任务的成功率。\n\n该方案主要解决了现有智能体在行动规划上不够灵活、难以利用执行反馈进行自我迭代的问题。实验数据显示，相较于传统方法，CodeAct 在多项基准测试中的任务成功率提升了高达 20%。项目不仅发布了核心方法论，还开源了包含 7000 条多轮交互数据的 CodeActInstruct 数据集，以及基于 Mistral 和 Llama 架构微调的 CodeActAgent 模型。\n\nCodeAct 特别适合 AI 研究人员、开发者以及希望构建高自主性智能体应用的技术团队使用。其独特的技术亮点在于将“代码执行”与“多轮反思”紧密结合，使模型具备类似程序员的调试与进化能力。此外，项目提供了完善的部署支持，兼容 Ollama、llama.cpp 及 Kubernetes 等多种环境，方便用户快速在本地或云端搭建属于自己的智能体系统。","\u003Ch1 align=\"center\"> Executable Code Actions Elicit Better LLM Agents \u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n\u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01030\">📃 Paper\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act\" >🤗 Data (CodeActInstruct)\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\" >🤗 Model (CodeActAgent-Mistral-7b-v0.1)\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fchat.xwang.dev\u002F\">🤖 Chat with CodeActAgent!\u003C\u002Fa>\n\u003C\u002Fp>\n\nWe propose to use executable **code** to consolidate LLM agents’ **act**ions into a unified action space (**CodeAct**).\nIntegrated with a Python interpreter, CodeAct can execute code actions and dynamically revise prior actions or emit new actions upon new observations (e.g., code execution results) through multi-turn interactions (check out [this example!](https:\u002F\u002Fchat.xwang.dev\u002Fr\u002FVqn108G)).\n\n![Overview](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_b0bb79042fa8.png)\n\n## News\n\n**Apr 10, 2024**: CodeActAgent Mistral is [officially available at `ollama`](https:\u002F\u002Follama.com\u002Fxingyaow\u002Fcodeact-agent-mistral)!\n\n**Mar 11, 2024**: We also add [llama.cpp](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp) support for inferencing CodeActAgent on laptop (tested on MacOS), check out instructions [here](#using-llamacpp-for-laptop)!\n\n**Mar 11, 2024**: We now support serving all CodeActAgent's components (LLM serving, code executor, MongoDB, Chat-UI) via Kubernetes ⎈! Check out [this guide](docs\u002FKUBERNETES_DEPLOY.md)!\n\n**Feb 2, 2024**: CodeAct is released!\n\n## Why CodeAct?\n\nOur extensive analysis of 17 LLMs on API-Bank and a newly curated benchmark [M\u003Csup>3\u003C\u002Fsup>ToolEval](docs\u002FEVALUATION.md) shows that CodeAct outperforms widely used alternatives like Text and JSON (up to 20% higher success rate). Please check our paper for more detailed analysis!\n\n![Comparison between CodeAct and Text\u002FJSON](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_53e4d6c03ae1.png)\n*Comparison between CodeAct and Text \u002F JSON as action.*\n\n![Comparison between CodeAct and Text\u002FJSON](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_e525f5b7acdc.png)\n*Quantitative results comparing CodeAct and {Text, JSON} on M\u003Csup>3\u003C\u002Fsup>ToolEval.*\n\n\n## 📁 CodeActInstruct\n\nWe collect an instruction-tuning dataset, CodeActInstruct, consists of 7k multi-turn interactions using CodeAct. Dataset is release at [huggingface dataset 🤗](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act). Please refer to the paper and [this section](#-data-generation-optional) for details of data collection.\n\n\n![Data Statistics](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_a21e538eca9b.png)\n*Dataset Statistics. Token statistics are computed using Llama-2 tokenizer.*\n\n## 🪄 CodeActAgent\n\nTrained on **CodeActInstruct** and general conversations, **CodeActAgent** excels at out-of-domain agent tasks compared to open-source models of the same size, while not sacrificing generic performance (e.g., knowledge, dialog). We release two variants of CodeActAgent:\n- **CodeActAgent-Mistral-7b-v0.1** (recommended, [model link](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1)): using Mistral-7b-v0.1 as the base model with 32k context window.\n- **CodeActAgent-Llama-7b** ([model link](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Llama-2-7b)): using Llama-2-7b as the base model with 4k context window.\n\n![Model Performance](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_9dd9658afc5b.png)\n*Evaluation results for CodeActAgent. ID and OD correspondingly stand for in-domain and out-of-domain evaluation. Overall averaged performance normalizes the MT-Bench score to be consistent with other tasks and excludes in-domain tasks for fair comparison.*\n\n\nPlease check out [:page_with_curl: our paper](TODO) for more details about data collection, model training, evaluation, and more!\n\n\n## 🚀 Use CodeActAgent for Your Application!\n\n\u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fassets\u002F38853559\u002F62c80ada-62ce-447e-811c-fc801dd4beac\"> \u003C\u002Fvideo>\n*Demo of the chat interface.*\n\nA CodeActAgent system contains the following components:\n\n- **LLM Serving**: We use [vLLM as an example](#serve-the-model-using-vllm-into-openai-compatible-api), but any serving software that can serve the model into an OpenAI compatile API should be fine.\n- **Interaction Interface**:\n  - [Chat-UI for chat interface + MongoDB for chat history](#via-chat-ui)\n  - OR [simple Python script](#via-simple-python-script)\n- **Code Execution Engine**: This service will start an [API](#start-your-code-execution-engine) that accepts code execution requests from Chat-UI or the Python script, then starts an individual docker container to execute code for *each* chat session.\n\n🌟 **If you have access to a Kubernetes cluster**: You can follow [our Kubernetes setup guide](docs\u002FKUBERNETES_DEPLOY.md) that allows you to spin up all of these components using one command!\n\nFollow the guide below to set up with Docker.\n\n### Serve the Model into OpenAI Compatible API\n\n#### Using VLLM via Docker (requires [nvidia-docker](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fnvidia-docker))\n\n```bash\n# You should download the model first, here is an example for CodeActAgent-Mistral\ncd $YOUR_DIR_TO_DOWNLOADED_MISTRAL_MODEL\ngit lfs install\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\n.\u002Fscripts\u002Fchat\u002Fstart_vllm.sh $YOUR_DIR_TO_DOWNLOADED_MISTRAL_MODEL\u002FCodeActAgent-Mistral-7b-v0.1\n# OR\n# .\u002Fscripts\u002Fchat_ui\u002Fstart_vllm.sh $YOUR_DIR_TO_DOWNLOADED_LLAMA_MODEL\u002FCodeActAgent-Llama-7b\n```\n\nThis script (docker-required) will start hosting the model based on `CUDA_VISIBLE_DEVICES` to port `8080` and you may access the model via OPENAI_API_BASE of `http:\u002F\u002Flocalhost:8080\u002Fv1` (by default). You may check the [OpenAI API's official documentation](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate) for detailed instruction. You may also check vLLM's [official instruction](https:\u002F\u002Fvllm.ai\u002F) for more information.\n\n#### Using LLama.cpp (for laptop!)\n\nThis is tested on MacOS (M2 Max, Ventura 13.6).\n\n**Install LLama.cpp**\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp.git\n# optionally create a conda environment for installation\nconda create -n llamacpp python=3.10\n# Install dependencies for llama cpp\ncd llama.cpp\nconda activate llamacpp\npip install -r requirements.txt\n# Build (refer to https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp?tab=readme-ov-file#build for more details)\nmake\n```\n\n**(Optional) Convert Model into [gguf](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fggml\u002Fblob\u002Fmaster\u002Fdocs\u002Fgguf.md) Format**\n\nOR you can skip the following commands by downloading the pre-converted quantized version (q8_0) [here](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1.q8_0.gguf).\n```bash\n# Download the model if you haven't\ngit lfs install\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\n# Assume you are in the directory of llama.cpp\npython convert.py .\u002FCodeActAgent-Mistral-7b-v0.1 --outtype f16 --outfile CodeActAgent-Mistral-7b-v0.1.f16.gguf\n# (optional) Quantize for faster inference\n.\u002Fquantize CodeActAgent-Mistral-7b-v0.1.f16.gguf CodeActAgent-Mistral-7b-v0.1.q8_0.gguf Q8_0\n```\n\n**Serve into OpenAI compatible API**\n\nSee [this](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Ftree\u002Fmaster\u002Fexamples\u002Fserver#llamacpp-http-server) for a detailed description of the arguments.\n```bash\n.\u002Fserver -m CodeActAgent-Mistral-7b-v0.1.q8_0.gguf -c 8192 --port 8080\n```\n\nNow you can access the OpenAI compatible server on `http:\u002F\u002Flocalhost:8080\u002Fv1` with model name being `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf`. **You need to change model name from `CodeActAgent-Mistral-7b-v0.1` to `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf` for the interaction interface** in the following section (in chat-ui configuration file or in the Python script)!\n\n#### (Optional) Test if OpenAI-compatible API is working\n```bash\ncurl -X POST 'http:\u002F\u002Flocalhost:8080\u002Fv1\u002Fchat\u002Fcompletions' -d '{\n  \"model\": \"CodeActAgent-Mistral-7b-v0.1.q8_0.gguf\",\n  \"messages\": [\n      {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n      {\"role\": \"user\", \"content\": \"How to build a website?\"}\n  ]\n}'\n```\n\n\n### Start your Code Execution Engine!\n\nWe implemented a containerized code execution engine based on [JupyterKernelGateway](https:\u002F\u002Fgithub.com\u002Fjupyter-server\u002Fkernel_gateway). The idea is to start a Jupyter server inside a [docker container](scripts\u002Fchat_ui\u002Fcode_execution\u002FDockerfile) *per chat session* to support code execution request from the model (the session will timeout in a fixed period of time). It requires docker to be installed locally.\n\n```bash\n# Start a code execution server at 8081\n.\u002Fscripts\u002Fchat\u002Fcode_execution\u002Fstart_jupyter_server.sh 8081\n```\n\n### Interact with the system!\n\n#### via simple Python script\n\nIf you don't want to spin up a fancy interface and just want to play with it from the command line, we got you covered!\n\n```bash\n# Make sure you started model server (vLLM or llama.cpp) and code execution engine before running this!\npython3 scripts\u002Fchat\u002Fdemo.py --model_name xingyaoww\u002FCodeActAgent-Mistral-7b-v0.1 --openai_api_base http:\u002F\u002F$YOUR_API_HOST:$YOUR_API_PORT\u002Fv1 --jupyter_kernel_url http:\u002F\u002F$YOUR_CODE_EXEC_ENGINE_HOST:$YOUR_CODE_EXEC_ENGINE_PORT\u002Fexecute\n```\n\n\n#### via Chat-UI\n\nIf you've served the model and the code execution engine, you can run your own chat interface just like [this](https:\u002F\u002Fchat.xwang.dev)!\n\nIf you want user management, you may need to start your own mongoDB instance: \n\n```bash\n.\u002Fscripts\u002Fchat\u002Fstart_mongodb.sh $YOUR_MONGO_DB_PASSWORD\n# The database will be created at `pwd`\u002Fdata\u002Fmongodb and available at localhost:27017\n```\n\nThen, you can configure your `chat-ui` interface.\n\n```bash\ncp chat-ui\u002F.env.template chat-ui\u002F.env.local\n# Make sure you modify .env.local to your configuration by correctly fill-in\n# 1. JUPYTER_API_URL\n# 2. model endpoint (search for 'TODO_OPENAI_BASE_URL');\n#    You also need to change the model name to CodeActAgent-Mistral-7b-v0.1.q8_0.gguf if you are using llama.cpp to infer the model\n# 3. MONGODB_URL - You may leave this empty, the chat-ui will automatically start a database (but it will be deleted once the container is stopped)\n```\n\nNow you can build and start your own web application (docker-required)!\n```bash\n.\u002Fscripts\u002Fchat\u002Frun_chat_ui.sh\n# It will starts the interface on localhost:5173 by default\n\n# Run this script for debug mode\n# .\u002Fscripts\u002Fchat\u002Frun_chat_ui_debug.sh\n```\n\nFor more information (e.g., if you don't want to use docker), please check-out chat-ui's [documentation](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fchat-ui)!\n\n\n## 🎥 Reproduce Experiments in the Paper\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\n# To clone all submodules\ngit submodule update --init --recursive\n```\n\n### 📂 Data Generation (Optional)\n\n**Recommended:** You may download the processed **CodeActInstruct** from [huggingface dataset 🤗](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act).\n\n**For reproducibility:** You can optionally generate data follow instructions in [docs\u002FDATA_GENERATION.md](docs\u002FDATA_GENERATION.md) to generate interaction data.\n\n### 📘 Model Training\n\nWe use a fork of [Megatron-LLM](https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002FMegatron-LLM) for training. You can follow [docs\u002FMODEL_TRAINING.md](docs\u002FMODEL_TRAINING.md) for detailed instructions.\n\n\n### 📊 Evaluation \n\nPlease refer to [docs\u002FEVALUATION.md](docs\u002FEVALUATION.md) for detailed instruction.\n\n## 📚 Citation\n\n```bibtex\n@inproceedings{wang2024executable,\n      title={Executable Code Actions Elicit Better LLM Agents}, \n      author={Xingyao Wang and Yangyi Chen and Lifan Yuan and Yizhe Zhang and Yunzhu Li and Hao Peng and Heng Ji},\n      year={2024},\n      eprint={2402.01030},\n      booktitle={ICML}\n}\n```\n","\u003Ch1 align=\"center\"> 可执行代码动作催生更优秀的 LLM 代理 \u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n\u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01030\">📃 论文\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act\" >🤗 数据 (CodeActInstruct)\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\" >🤗 模型 (CodeActAgent-Mistral-7b-v0.1)\u003C\u002Fa>\n•\n\u003Ca href=\"https:\u002F\u002Fchat.xwang.dev\u002F\">🤖 与 CodeActAgent 聊天！\u003C\u002Fa>\n\u003C\u002Fp>\n\n我们提出使用可执行的**代码**来将 LLM 代理的动作整合进统一的动作空间（**CodeAct**）。\n通过与 Python 解释器集成，CodeAct 能够执行代码动作，并在多轮交互中根据新的观测结果（例如代码执行结果）动态修正先前动作或发出新动作（请查看[这个示例！](https:\u002F\u002Fchat.xwang.dev\u002Fr\u002FVqn108G)）。\n\n![概览](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_b0bb79042fa8.png)\n\n## 新闻\n\n**2024年4月10日**：CodeActAgent Mistral 已经[正式在 `ollama` 上发布](https:\u002F\u002Follama.com\u002Fxingyaow\u002Fcodeact-agent-mistral)！\n\n**2024年3月11日**：我们还增加了对 [llama.cpp](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp) 的支持，以便在笔记本电脑上运行 CodeActAgent（已在 MacOS 上测试），请参阅[此处](#using-llamacpp-for-laptop)的说明！\n\n**2024年3月11日**：我们现在支持通过 Kubernetes 部署 CodeActAgent 的所有组件（LLM 服务、代码执行器、MongoDB、聊天界面）！请查看[这篇指南](docs\u002FKUBERNETES_DEPLOY.md)！\n\n**2024年2月2日**：CodeAct 正式发布！\n\n## 为什么选择 CodeAct？\n\n我们在 API-Bank 上对 17 种 LLM 以及一个新整理的基准测试集 [M\u003Csup>3\u003C\u002Fsup>ToolEval](docs\u002FEVALUATION.md) 进行了深入分析，结果显示 CodeAct 在成功率方面优于广泛使用的文本和 JSON 等替代方案（最高可高出 20%）。更多详细分析请参阅我们的论文！\n\n![CodeAct 与文本\u002FJSON 的比较](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_53e4d6c03ae1.png)\n*CodeAct 与文本\u002FJSON 作为动作方式的比较。*\n\n![CodeAct 与文本\u002FJSON 的比较](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_e525f5b7acdc.png)\n*在 M\u003Csup>3\u003C\u002Fsup>ToolEval 上对比 CodeAct 与 {文本、JSON} 的量化结果。*\n\n\n## 📁 CodeActInstruct\n\n我们收集了一个指令微调数据集 CodeActInstruct，包含 7,000 条使用 CodeAct 的多轮对话。该数据集已在 [huggingface 数据集 🤗](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act) 上发布。有关数据收集的详细信息，请参阅论文及[本节](#-data-generation-optional)。\n\n![数据统计](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_a21e538eca9b.png)\n*数据集统计。标记统计使用 Llama-2 分词器计算。*\n\n## 🪄 CodeActAgent\n\n**CodeActAgent** 基于 **CodeActInstruct** 和通用对话进行训练，在同类规模的开源模型中，其跨领域代理任务表现尤为出色，同时并未牺牲通用性能（如知识储备、对话能力等）。我们发布了两个版本的 CodeActAgent：\n- **CodeActAgent-Mistral-7b-v0.1**（推荐，[模型链接](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1)）：以 Mistral-7b-v0.1 为基础模型，上下文窗口为 32k。\n- **CodeActAgent-Llama-7b**（[模型链接](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Llama-2-7b)）：以 Llama-2-7b 为基础模型，上下文窗口为 4k。\n\n![模型性能](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_readme_9dd9658afc5b.png)\n*CodeActAgent 的评估结果。ID 和 OD 分别代表域内和域外评估。总体平均性能将 MT-Bench 得分标准化，使其与其他任务保持一致，并排除域内任务以确保公平比较。*\n\n\n有关数据收集、模型训练、评估等方面的更多细节，请参阅[:page_with_curl: 我们的论文](TODO)！\n\n\n## 🚀 将 CodeActAgent 应用于您的应用！\n\n\u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fassets\u002F38853559\u002F62c80ada-62ce-447e-811c-fc801dd4beac\"> \u003C\u002Fvideo>\n*聊天界面演示。*\n\n一个 CodeActAgent 系统包含以下组件：\n\n- **LLM 服务**：我们以 [vLLM 为例](#serve-the-model-using-vllm-into-openai-compatible-api)，但任何能够将模型部署为 OpenAI 兼容 API 的服务软件均可。\n- **交互界面**：\n  - [通过聊天界面 + MongoDB 存储聊天记录](#via-chat-ui)\n  - 或者 [使用简单的 Python 脚本](#via-simple-python-script)\n- **代码执行引擎**：该服务将启动一个 [API](#start-your-code-execution-engine)，接收来自聊天界面或 Python 脚本的代码执行请求，然后为 *每* 次聊天会话启动一个独立的 Docker 容器来执行代码。\n\n🌟 **如果您拥有 Kubernetes 集群**：您可以按照我们的[Kubernetes 部署指南](docs\u002FKUBERNETES_DEPLOY.md)，只需一条命令即可启动所有这些组件！\n\n请按照以下指南使用 Docker 进行设置。\n\n### 将模型部署为 OpenAI 兼容 API\n\n#### 使用 VLLM 通过 Docker（需要 [nvidia-docker](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fnvidia-docker)）\n\n```bash\n# 首先下载模型，以下是 CodeActAgent-Mistral 的示例\ncd $YOUR_DIR_TO_DOWNLOADED_MISTRAL_MODEL\ngit lfs install\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\n.\u002Fscripts\u002Fchat\u002Fstart_vllm.sh $YOUR_DIR_TO_DOWNLOADED_MISTRAL_MODEL\u002FCodeActAgent-Mistral-7b-v0.1\n# 或者\n# .\u002Fscripts\u002Fchat_ui\u002Fstart_vllm.sh $YOUR_DIR_TO_DOWNLOADED_LLAMA_MODEL\u002FCodeActAgent-Llama-7b\n```\n\n此脚本（需要 Docker）将基于 `CUDA_VISIBLE_DEVICES` 将模型托管到端口 `8080`，您可以通过 `http:\u002F\u002Flocalhost:8080\u002Fv1` 的 OPENAI_API_BASE 访问模型（默认设置）。有关详细说明，请参阅 [OpenAI API 的官方文档](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate)。您也可以参考 vLLM 的[官方说明](https:\u002F\u002Fvllm.ai\u002F)以获取更多信息。\n\n#### 使用 LLama.cpp（适用于笔记本电脑！）\n\n此方法已在 MacOS（M2 Max，Ventura 13.6）上测试过。\n\n**安装 LLama.cpp**\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp.git\n# 可选：创建一个 conda 环境进行安装\nconda create -n llamacpp python=3.10\n# 安装 llama cpp 的依赖项\ncd llama.cpp\nconda activate llamacpp\npip install -r requirements.txt\n# 构建（详情请参阅 https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp?tab=readme-ov-file#build）\nmake\n```\n\n**(可选) 将模型转换为 [gguf](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fggml\u002Fblob\u002Fmaster\u002Fdocs\u002Fgguf.md) 格式**\n\n或者，您也可以跳过以下步骤，直接下载预转换好的量化版本（q8_0）[在这里](https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1.q8_0.gguf)。\n```bash\n# 如果尚未下载模型，请先下载\ngit lfs install\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\n# 假设您当前位于 llama.cpp 目录下\npython convert.py .\u002FCodeActAgent-Mistral-7b-v0.1 --outtype f16 --outfile CodeActAgent-Mistral-7b-v0.1.f16.gguf\n\n# （可选）量化以加快推理速度\n.\u002Fquantize CodeActAgent-Mistral-7b-v0.1.f16.gguf CodeActAgent-Mistral-7b-v0.1.q8_0.gguf Q8_0\n```\n\n**部署为兼容 OpenAI 的 API**\n\n有关参数的详细说明，请参阅 [此处](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fllama.cpp\u002Ftree\u002Fmaster\u002Fexamples\u002Fserver#llamacpp-http-server)。\n```bash\n.\u002Fserver -m CodeActAgent-Mistral-7b-v0.1.q8_0.gguf -c 8192 --port 8080\n```\n\n现在，您可以通过 `http:\u002F\u002Flocalhost:8080\u002Fv1` 访问兼容 OpenAI 的服务器，模型名称为 `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf`。**在下一部分的交互界面中（无论是聊天 UI 配置文件还是 Python 脚本），您需要将模型名称从 `CodeActAgent-Mistral-7b-v0.1` 更改为 `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf`！**\n\n#### （可选）测试 OpenAI 兼容 API 是否正常工作\n```bash\ncurl -X POST 'http:\u002F\u002Flocalhost:8080\u002Fv1\u002Fchat\u002Fcompletions' -d '{\n  \"model\": \"CodeActAgent-Mistral-7b-v0.1.q8_0.gguf\",\n  \"messages\": [\n      {\"role\": \"system\", \"content\": \"你是一个 helpful assistant。\"},\n      {\"role\": \"user\", \"content\": \"如何搭建一个网站？\"}\n  ]\n}'\n```\n\n\n### 启动您的代码执行引擎！\n\n我们基于 [JupyterKernelGateway](https:\u002F\u002Fgithub.com\u002Fjupyter-server\u002Fkernel_gateway) 实现了一个容器化的代码执行引擎。其核心思想是为每个聊天会话启动一个 [Docker 容器](scripts\u002Fchat_ui\u002Fcode_execution\u002FDockerfile) 内的 Jupyter 服务器，以支持来自模型的代码执行请求（该会话将在设定的时间后超时）。这需要本地已安装 Docker。\n\n```bash\n# 在 8081 端口启动代码执行服务器\n.\u002Fscripts\u002Fchat\u002Fcode_execution\u002Fstart_jupyter_server.sh 8081\n```\n\n### 与系统互动！\n\n#### 通过简单的 Python 脚本\n\n如果您不想搭建复杂的界面，只想在命令行上简单体验一下，我们已经为您准备好了！\n\n```bash\n# 在运行此脚本之前，请确保已启动模型服务器（vLLM 或 llama.cpp）和代码执行引擎！\npython3 scripts\u002Fchat\u002Fdemo.py --model_name xingyaoww\u002FCodeActAgent-Mistral-7b-v0.1 --openai_api_base http:\u002F\u002F$YOUR_API_HOST:$YOUR_API_PORT\u002Fv1 --jupyter_kernel_url http:\u002F\u002F$YOUR_CODE_EXEC_ENGINE_HOST:$YOUR_CODE_EXEC_ENGINE_PORT\u002Fexecute\n```\n\n\n#### 通过 Chat-UI\n\n如果您已经部署了模型和代码执行引擎，就可以像 [这个](https:\u002F\u002Fchat.xwang.dev) 一样运行您自己的聊天界面！\n\n如果需要用户管理功能，您可能需要启动自己的 MongoDB 实例：\n\n```bash\n.\u002Fscripts\u002Fchat\u002Fstart_mongodb.sh $YOUR_MONGO_DB_PASSWORD\n# 数据库将创建在 pwd\u002Fdata\u002Fmongodb 目录下，并可通过 localhost:27017 访问\n```\n\n然后，您可以配置您的 Chat-UI 界面。\n\n```bash\ncp chat-ui\u002F.env.template chat-ui\u002F.env.local\n# 请务必根据您的实际情况修改 .env.local 文件：\n# 1. JUPYTER_API_URL\n# 2. 模型端点（搜索 'TODO_OPENAI_BASE_URL'）；\n#    如果您使用 llama.cpp 推理模型，还需将模型名称更改为 CodeActAgent-Mistral-7b-v0.1.q8_0.gguf\n# 3. MONGODB_URL - 您可以留空，Chat-UI 会自动启动一个数据库（但容器停止后该数据库将被删除）\n```\n\n现在，您可以构建并启动您自己的 Web 应用程序（需使用 Docker）！\n```bash\n.\u002Fscripts\u002Fchat\u002Frun_chat_ui.sh\n# 默认会在 localhost:5173 启动界面\n\n# 运行此脚本以进入调试模式\n# .\u002Fscripts\u002Fchat\u002Frun_chat_ui_debug.sh\n```\n\n如需更多信息（例如不使用 Docker 的情况），请查看 Chat-UI 的 [文档](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fchat-ui)！\n\n\n## 🎥 复现论文中的实验\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\n# 克隆所有子模块\ngit submodule update --init --recursive\n```\n\n### 📂 数据生成（可选）\n\n**推荐：** 您可以从 [Hugging Face 数据集 🤗](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fxingyaoww\u002Fcode-act) 下载处理好的 **CodeActInstruct** 数据集。\n\n**为复现实验：** 您也可以按照 [docs\u002FDATA_GENERATION.md](docs\u002FDATA_GENERATION.md) 中的说明，自行生成交互数据。\n\n### 📘 模型训练\n\n我们使用 [Megatron-LLM](https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002FMegatron-LLM) 的一个分支进行训练。详细的训练步骤请参考 [docs\u002FMODEL_TRAINING.md](docs\u002FMODEL_TRAINING.md)。\n\n\n### 📊 评估 \n\n详细的评估方法请参阅 [docs\u002FEVALUATION.md](docs\u002FEVALUATION.md)。\n\n## 📚 引用\n\n```bibtex\n@inproceedings{wang2024executable,\n      title={Executable Code Actions Elicit Better LLM Agents}, \n      author={Xingyao Wang and Yangyi Chen and Lifan Yuan and Yizhe Zhang and Yunzhu Li and Hao Peng and Heng Ji},\n      year={2024},\n      eprint={2402.01030},\n      booktitle={ICML}\n}\n```","# CodeAct 快速上手指南\n\nCodeAct 是一个通过可执行代码统一大语言模型（LLM）智能体动作空间的框架。它结合 Python 解释器，支持多轮交互、动态修正动作及执行代码，在复杂任务中表现优于传统的 Text 或 JSON 动作格式。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux (推荐), macOS (支持 llama.cpp 本地运行), Windows (需 WSL2)\n- **GPU**: NVIDIA GPU (推荐使用 vLLM 部署时)，显存建议 16GB+ (运行 7B 模型)\n- **CPU**: 若使用 llama.cpp 在笔记本运行，建议较新的多核 CPU (如 Apple M 系列)\n\n### 前置依赖\n请确保已安装以下工具：\n- **Docker** & **Docker Compose** (用于隔离代码执行环境和部署服务)\n- **NVIDIA Docker** (若使用 GPU 加速推理，参考 [nvidia-docker](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fnvidia-docker))\n- **Git** & **Git LFS** (用于下载模型权重)\n- **Python 3.10+** (用于运行脚本和数据处理)\n- **Conda** (可选，用于管理 llama.cpp 环境)\n\n> **国内加速提示**：\n> - 下载 HuggingFace 模型较慢时，建议使用镜像站 `hf-mirror.com`。\n> - 设置环境变量：`export HF_ENDPOINT=https:\u002F\u002Fhf-mirror.com`\n\n---\n\n## 安装步骤\n\n### 1. 克隆项目\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\ncd code-act\ngit submodule update --init --recursive\n```\n\n### 2. 下载模型\n推荐使用 **CodeActAgent-Mistral-7b-v0.1** (支持 32k 上下文)。\n\n```bash\n# 设置国内镜像加速 (可选)\nexport HF_ENDPOINT=https:\u002F\u002Fhf-mirror.com\n\ngit lfs install\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1\n# 模型将下载到当前目录下的 CodeActAgent-Mistral-7b-v0.1 文件夹\n```\n\n*(可选) 若需在笔记本使用 llama.cpp 运行，可下载量化版本:*\n```bash\ngit clone https:\u002F\u002Fhuggingface.co\u002Fxingyaoww\u002FCodeActAgent-Mistral-7b-v0.1.q8_0.gguf\n```\n\n---\n\n## 基本使用\n\n本指南演示最核心的三种组件启动方式：**模型服务**、**代码执行引擎**、**交互界面**。\n\n### 第一步：启动模型服务 (LLM Serving)\n\n选择以下任一方式启动模型，使其提供 OpenAI 兼容的 API。\n\n#### 方案 A：使用 vLLM (推荐，需 GPU)\n此脚本会自动构建 Docker 容器并在端口 `8080` 启动服务。\n\n```bash\n# 替换为你的模型实际路径\nMODEL_PATH=$(pwd)\u002FCodeActAgent-Mistral-7b-v0.1\n\n.\u002Fscripts\u002Fchat\u002Fstart_vllm.sh $MODEL_PATH\n```\n*服务地址默认为：`http:\u002F\u002Flocalhost:8080\u002Fv1`*\n\n#### 方案 B：使用 llama.cpp (适用于 MacBook\u002F无 GPU 环境)\n需先编译 llama.cpp (参考 README 中的详细编译步骤)，然后启动服务器：\n\n```bash\n# 假设已在 llama.cpp 目录下完成编译，且模型文件在同级目录\n.\u002Fserver -m CodeActAgent-Mistral-7b-v0.1.q8_0.gguf -c 8192 --port 8080\n```\n*注意：若使用此方案，后续配置中的模型名称需改为 `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf`。*\n\n### 第二步：启动代码执行引擎\n\nCodeAct 的核心能力是执行代码。该引擎会为每个会话启动独立的 Docker 容器运行 Jupyter Kernel。\n\n```bash\n# 在端口 8081 启动代码执行服务\n.\u002Fscripts\u002Fchat\u002Fcode_execution\u002Fstart_jupyter_server.sh 8081\n```\n\n### 第三步：开始交互\n\n#### 方式 1：命令行快速测试 (最简单)\n无需配置前端，直接通过 Python 脚本对话。\n\n```bash\npython3 scripts\u002Fchat\u002Fdemo.py \\\n  --model_name xingyaoww\u002FCodeActAgent-Mistral-7b-v0.1 \\\n  --openai_api_base http:\u002F\u002Flocalhost:8080\u002Fv1 \\\n  --jupyter_kernel_url http:\u002F\u002Flocalhost:8081\u002Fexecute\n```\n*输入类似 \"计算 100 以内的素数\" 或 \"画一个正弦波图\" 的指令，观察模型生成并执行代码的过程。*\n\n#### 方式 2：启动 Web 聊天界面 (Chat-UI)\n若需要图形化界面（类似 ChatGPT）：\n\n1. **配置环境变量**\n   ```bash\n   cp chat-ui\u002F.env.template chat-ui\u002F.env.local\n   ```\n   编辑 `chat-ui\u002F.env.local`，确保修改以下项：\n   - `JUPYTER_API_URL`: `http:\u002F\u002Flocalhost:8081\u002Fexecute`\n   - `OPENAI_BASE_URL`: `http:\u002F\u002Flocalhost:8080\u002Fv1` (搜索 `TODO_OPENAI_BASE_URL` 进行替换)\n   - `MODEL_NAME`: 若使用 llama.cpp 量化模型，请填写 `CodeActAgent-Mistral-7b-v0.1.q8_0.gguf`，否则保持默认。\n\n2. **启动界面**\n   ```bash\n   .\u002Fscripts\u002Fchat\u002Frun_chat_ui.sh\n   ```\n   访问 `http:\u002F\u002Flocalhost:5173` 即可开始使用。\n\n*(可选) 如需保存聊天记录，可先启动 MongoDB:*\n```bash\n.\u002Fscripts\u002Fchat\u002Fstart_mongodb.sh your_password\n```","某数据分析师需要在无预装环境的生产服务器上，根据动态变化的销售数据自动执行清洗、分析并生成可视化报告。\n\n### 没有 code-act 时\n- **动作空间割裂**：模型只能输出自然语言建议或静态 JSON，无法直接调用服务器上的 Python 库（如 Pandas、Matplotlib），需人工复制代码执行。\n- **缺乏自我修正**：一旦生成的代码因环境差异报错，模型无法感知运行结果，只能盲目重试，导致任务中断。\n- **多步协作困难**：复杂任务需拆分为多次独立对话，上下文容易丢失，难以维持“观察 - 思考 - 行动”的闭环。\n- **工具集成繁琐**：开发者需手动编写大量胶水代码将 LLM 输出解析为函数调用，开发周期长且易出错。\n\n### 使用 code-act 后\n- **统一代码行动空间**：code-act 让模型直接生成可执行的 Python 代码片段，内置解释器即时运行，无缝调用各类数据科学库。\n- **动态反馈与修正**：模型能读取代码执行后的报错信息或输出结果，自动调整逻辑并重试，实现真正的自主调试。\n- **多轮交互闭环**：支持基于执行结果的多轮对话，模型可根据中间数据动态规划下一步操作，完整覆盖复杂分析流程。\n- **开箱即用部署**：依托预训练的 CodeActAgent 模型和标准化组件，无需额外开发解析层，快速搭建具备执行能力的智能体。\n\ncode-act 通过将“可执行代码”作为核心行动载体，彻底打通了大模型从“纸上谈兵”到“实地作战”的最后一步。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxingyaoww_code-act_e525f5b7.png","xingyaoww","Xingyao Wang","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fxingyaoww_6ebb928f.jpg","Co-founder & CAIO @All-Hands-AI. PhD candidate in CS @Illinois. B.S. in CS & DS @umich. Ex-Intern @Google @Microsoft @ByteDance @Tencent.","OpenHands \u002F All Hands AI",null,"xingyaow_","xwang.dev","https:\u002F\u002Fgithub.com\u002Fxingyaoww",[83,87,91,95,99,103,107],{"name":84,"color":85,"percentage":86},"Python","#3572A5",39.1,{"name":88,"color":89,"percentage":90},"HTML","#e34c26",27.5,{"name":92,"color":93,"percentage":94},"Jupyter Notebook","#DA5B0B",18.9,{"name":96,"color":97,"percentage":98},"JavaScript","#f1e05a",10.6,{"name":100,"color":101,"percentage":102},"Shell","#89e051",2.4,{"name":104,"color":105,"percentage":106},"CSS","#663399",1.4,{"name":108,"color":109,"percentage":110},"Mint","#02b046",0,1639,134,"2026-04-03T07:54:59","MIT",4,"Linux, macOS","使用 vLLM 部署时必需 NVIDIA GPU（需安装 nvidia-docker），具体显存未说明但模型为 7B 参数；使用 llama.cpp 在 macOS (M2 Max) 上推理可不依赖 NVIDIA GPU。","未说明（建议根据 7B 模型推理需求配置，通常 16GB+）",{"notes":120,"python":121,"dependencies":122},"该工具核心组件包括 LLM 服务、代码执行引擎（基于 Docker 启动独立 Jupyter 容器）和聊天界面。若使用 vLLM 需安装 nvidia-docker；若在笔记本（如 macOS）运行，推荐使用 llama.cpp 并可将模型转换为 gguf 格式。支持通过 Kubernetes 一键部署所有组件。代码执行引擎要求本地安装 Docker。","3.10 (llama.cpp 示例中指定)",[123,124,125,126,127,128,129,130],"vLLM","llama.cpp","docker","nvidia-docker","JupyterKernelGateway","MongoDB","git-lfs","conda (可选)",[13,14,35],[133,134,135,136],"llm","llm-agent","llm-finetuning","llm-framework","2026-03-27T02:49:30.150509","2026-04-07T08:17:45.036569",[140,145,150,155,160,165],{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},21326,"在 MacOS M1\u002FM2 芯片上安装和运行时遇到 Docker NVIDIA 错误怎么办？","MacOS 不支持 Nvidia Toolkit，因此无法直接使用默认的 Docker 配置。解决方案是使用 `llama.cpp` 在本地运行模型。维护者已在 M2 Max MacBook 上验证该方法可行，`llama.cpp` 可以直接将模型服务化为 OpenAI 兼容的 API，无需额外安装 `ollama`。具体操作指南请参考项目 README 中的 \"Using llama.cpp for Laptop\" 章节。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F2",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},21327,"如何在 Jupyter Kernel Server 中定义和添加工具（Tools）？","您可以直接将任意 Python 函数定义以字符串形式粘贴进去。例如，您可以定义一个包含 `import math` 和具体函数逻辑（如 `def foo(a): return math.ceil(a)`）的代码块。添加后，Agent 在其 `\u003Cexecute>` 执行环境中即可调用该 `foo` 函数。不需要复杂的配置文件，只需更新系统提示词或直接传入函数定义字符串即可。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F6",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},21328,"项目依赖的 pandas 版本过低导致 .fillna 性能问题，如何解决？","建议升级 pandas 至 1.4.2 或更高版本以修复 `.fillna` 函数的性能退化问题。原项目中导致版本锁定的 `scripts\u002Feval\u002Fscience-world\u002Frequirements.txt` 文件已被维护者移除，因为环境搭建实际使用的是 `scripts\u002Feval\u002Fsetup_env.sh` 脚本。用户现在可以直接使用较新版本的 pandas，代码应能正常工作。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F3",{"id":156,"question_zh":157,"answer_zh":158,"source_url":159},21329,"遇到 'json.decoder.jsondecodeerror: expecting value' 错误该如何排查？","该错误通常表示解析的 JSON 数据为空或格式不正确。由于此错误可能由多种上下文引起，排查时需要提供更多详细信息，包括您正在运行的具体代码脚本、输入数据以及完整的错误堆栈，以便定位是哪一个环节返回了无效的 JSON 响应。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F4",{"id":161,"question_zh":162,"answer_zh":163,"source_url":164},21330,"训练 LLM 时遇到 'either num_layers or encoder_num_layers should be specified' 错误如何处理？","该错误表明在训练配置中缺少必要的层数参数。虽然用户尝试在 `finetune_4xA100_4tp_mixture_mistral.sh` 脚本中添加参数未生效，但这通常意味着需要检查底层的 Megatron-LM 配置模板或确保参数传递到了正确的解析器中。需确认是否使用了正确的启动命令，并根据模型架构（如 Mistral）明确指定 `num_layers` 的具体数值。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F13",{"id":166,"question_zh":167,"answer_zh":168,"source_url":169},21331,"如何利用该项目生成多步 Code-Act 数据集？","用户可以利用提供的模型和代码生成更多多步 Code-Act 数据集。社区成员已成功实践此流程并计划在 HuggingFace 上发布生成的数据集。具体生成脚本可参考项目仓库中的 `scripts\u002Fdata` 或相关评估目录下的数据收集与转换工具（如 `convert_outputs.ipynb`）。","https:\u002F\u002Fgithub.com\u002Fxingyaoww\u002Fcode-act\u002Fissues\u002F5",[]]