updated README
This commit is contained in:
+1
-77
@@ -45,83 +45,7 @@ type fileType = {
|
||||
const DOCKER_BIN = process.env.DOCKER_BIN || "docker";
|
||||
|
||||
// basic openapi for open webui
|
||||
const OPENAPI = {
|
||||
openapi: "3.1.0",
|
||||
info: {
|
||||
title: "Container Code Runner",
|
||||
version: "1.0.0",
|
||||
description:
|
||||
"run source code inside a sandboxed container. important: provide pure source code only; do not wrap code in shell commands or pipelines."
|
||||
},
|
||||
paths: {
|
||||
"/execute": {
|
||||
post: {
|
||||
operationId: "execute",
|
||||
summary: "Run code in a sandboxed container",
|
||||
// the model sees this text
|
||||
description:
|
||||
"use the language directly, not bash + the language. e.g., `#include...` (good) vs `echo '#include...' && gcc` (bad). pass only pure source text in `code`.",
|
||||
requestBody: {
|
||||
required: true,
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
language: {
|
||||
type: "string",
|
||||
enum: Object.keys(LANGS),
|
||||
description:
|
||||
"the programming language to run. do not use 'bash' to wrap or invoke compilers/interpreters; select the actual language (e.g., 'c', 'cpp', 'python')."
|
||||
},
|
||||
code: {
|
||||
type: "string",
|
||||
description:
|
||||
"pure source code only. do not include shell commands, redirections, pipes, or `echo`/`printf` wrappers. examples: good: `print('hi')`; bad: `echo \"print('hi')\" | python`."
|
||||
},
|
||||
args: { type: "array", items: { type: "string" } },
|
||||
files: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "object",
|
||||
properties: {
|
||||
path: { type: "string" },
|
||||
content: { type: "string" }
|
||||
},
|
||||
required: ["path", "content"],
|
||||
description:
|
||||
"optional supporting files. contents must be pure file text, not shell commands."
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ["language", "code"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
"200": {
|
||||
description: "Execution result",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
stdout: { type: "string" },
|
||||
stderr: { type: "string" },
|
||||
exitCode: { type: "integer" },
|
||||
timedOut: { type: "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const OPENAPI = JSON.parse((await import('fs')).readFileSync('openapi.json'))
|
||||
|
||||
function sendJson(res, status, obj) {
|
||||
const body = JSON.stringify(obj);
|
||||
|
||||
Reference in New Issue
Block a user