Librechat发布的它的代码解释器
可惜是付费的,并且付费方式是订阅制
我这边分享一个第三方的代码解释,可以以插件的形式调用,效果还行
可惜是个很早停更的项目现在只是能用,如果有哪位大佬可以捡起来真的是功德无量!!!
只支持python,仅仅可以协助解决一些小问题
项目地址:
看看就可以了
直接看搭建:
docker-compose.yml,一把梭哈
version: "3"
services:
codesherpa:
container_name: codesherpa
image: ghcr.io/iamgreggarcia/codesherpa:latest
restart: unless-stopped
#build:
# context: ./codesherpa
ports:
- "3333:3333"
volumes:
- /<你自己的目录>/codesherpa/static:/app/static
command: python3 -c "import localserver.main; localserver.main.start()"
运行起来之后就可以了,建议是反代到公网
actons
{
"openapi": "3.0.1",
"info": {
"title": "codesherpa",
"description": " 可编写和执行代码、执行命令进行数据分析等。",
"version": "0.1.0"
},
"servers": [
{
"url": "<有反代的填写域名地址,没有的填写ip:端口>",
"description": "Local server"
}
],
"paths": {
"/repl": {
"post": {
"summary": "Repl",
"description": "Execute code.\nNote: This endpoint current supports a REPL-like environment for Python only.\n\nArgs:\n request (CodeExecutionRequest): The request object containing the code to execute.\n\nReturns:\n CodeExecutionResponse: The result of the code execution.",
"operationId": "runcode",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CodeExecutionRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CodeExecutionResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/command": {
"post": {
"summary": "Command Endpoint",
"description": "Run commands.\n\nArgs:\n command_request (CommandExecutionRequest): The request object containing the command to execute.\n\nReturns:\n CommandExecutionResponse: The result of the command execution.",
"operationId": "command",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandExecutionRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandExecutionResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Body_upload_file_upload_post": {
"title": "Body_upload_file_upload_post",
"required": [
"file"
],
"type": "object",
"properties": {
"file": {
"title": "File",
"type": "string",
"format": "binary"
}
}
},
"CodeExecutionRequest": {
"title": "CodeExecutionRequest",
"required": [
"language",
"code"
],
"type": "object",
"properties": {
"language": {
"title": "Language",
"type": "string",
"example": "python"
},
"code": {
"title": "Code",
"type": "string",
"example": "print('Hello, World!')"
}
},
"description": "A Pydantic model representing a request to execute code.\n\nAttributes:\n language (str): The programming language of the code to be executed.\n code (str): The code to be executed.",
"example": {
"language": "python",
"code": "print('Hello, World!')"
}
},
"CodeExecutionResponse": {
"title": "CodeExecutionResponse",
"required": [
"result"
],
"type": "object",
"properties": {
"result": {
"title": "Result",
"type": "string",
"example": "Hello, World!"
}
},
"description": "A Pydantic model representing the response from a code execution request.\n\nAttributes:\n result (str): The result of the code execution.",
"example": {
"result": "Hello, World!"
}
},
"CommandExecutionRequest": {
"title": "CommandExecutionRequest",
"required": [
"command"
],
"type": "object",
"properties": {
"command": {
"title": "Command",
"type": "string",
"example": "ls -la"
}
},
"description": "A Pydantic model representing a request to execute a command.\n\nAttributes:\n command (str): The command to be executed.",
"example": {
"command": "ls -la"
}
},
"CommandExecutionResponse": {
"title": "CommandExecutionResponse",
"required": [
"result"
],
"type": "object",
"properties": {
"result": {
"title": "Result",
"type": "string",
"example": "Hello, World!"
}
},
"description": "A Pydantic model representing the response from a command execution request.\n\nAttributes:\n result (str): The result of the command execution.",
"example": {
"result": "Hello, World!"
}
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
}
}
}
}
最后创建一个agents,填写一个合适的prompt,就可以用了。
下面是效果展示,那种只有o1-PRO能搞定的的高难度数独