feat: 新增 /run 接口,在 go-judge 沙箱中编译运行 C/C++
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a5cfdc1bb6
commit
3c3169bd26
5 files changed
+151
-2
No files matched your search
+17
-1
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Dict, Any
|
||||
from typing import List, Dict, Any, Literal
|
||||
|
||||
|
||||
class PresetCodeCreate(BaseModel):
|
||||
@@ -30,6 +30,7 @@ class AIAnalysisRequest(BaseModel):
|
||||
|
||||
class DebugRequest(BaseModel):
|
||||
"""调试请求模式,用于调试 Python 代码"""
|
||||
|
||||
code: str
|
||||
inputs: List[str]
|
||||
|
||||
@@ -45,3 +46,18 @@ class FormatResponse(BaseModel):
|
||||
"""格式化代码的响应模式"""
|
||||
|
||||
code: str
|
||||
|
||||
|
||||
class RunRequest(BaseModel):
|
||||
"""运行 C/C++ 代码的请求模式"""
|
||||
|
||||
code: str
|
||||
language: Literal["c", "cpp"]
|
||||
stdin: str = ""
|
||||
|
||||
|
||||
class RunResponse(BaseModel):
|
||||
"""运行结果,status 沿用 Judge0 的状态码:3 成功、6 编译错误、11 运行错误"""
|
||||
|
||||
status: int
|
||||
output: str
|
||||
Reference in new issue
Block a user