fix: 修复bug
This commit is contained in:
@@ -7,10 +7,10 @@ app:
|
|||||||
openai:
|
openai:
|
||||||
# Prefer environment variables in real deployments.
|
# Prefer environment variables in real deployments.
|
||||||
# OPENAI_API_KEY must be set; OPENAI_BASE_URL optional (for DeepSeek / other gateways).
|
# OPENAI_API_KEY must be set; OPENAI_BASE_URL optional (for DeepSeek / other gateways).
|
||||||
api_key_env: "OPENAI_API_KEY"
|
api_key_env: "sk-85880595fc714d63bfd0b025e917bd26"
|
||||||
base_url_env: "OPENAI_BASE_URL"
|
base_url_env: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||||
# Example: "gpt-4o-mini" / "gpt-4o" / gateway specific names
|
# Example: "gpt-4o-mini" / "gpt-4o" / gateway specific names
|
||||||
model: "gpt-4o-mini"
|
model: "qwen3.5-plus"
|
||||||
|
|
||||||
script_gen:
|
script_gen:
|
||||||
# Narration length constraint per scene (Chinese chars approx)
|
# Narration length constraint per scene (Chinese chars approx)
|
||||||
|
|||||||
8
dev.sh
8
dev.sh
@@ -21,15 +21,17 @@ case "$CMD" in
|
|||||||
# Start in background, then wait for Node self-check + health endpoint.
|
# Start in background, then wait for Node self-check + health endpoint.
|
||||||
docker compose up -d --build "$@"
|
docker compose up -d --build "$@"
|
||||||
echo "[dev] waiting for server health..."
|
echo "[dev] waiting for server health..."
|
||||||
deadline=$((SECONDS + 90))
|
# ComfyUI first startup may take longer while preparing custom nodes.
|
||||||
|
HEALTH_TIMEOUT_SECONDS="${HEALTH_TIMEOUT_SECONDS:-300}"
|
||||||
|
deadline=$((SECONDS + HEALTH_TIMEOUT_SECONDS))
|
||||||
ok=0
|
ok=0
|
||||||
while [ $SECONDS -lt $deadline ]; do
|
while [ $SECONDS -lt $deadline ]; do
|
||||||
if curl -fsS "http://127.0.0.1:3000/api/health" >/dev/null 2>&1; then
|
if curl -fsS "http://127.0.0.1:3000/api/health" >/dev/null 2>&1; then
|
||||||
ok=1
|
ok=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
# If container exited, fail fast.
|
# Fail fast only if container actually exited (avoid mis-detecting "starting" state).
|
||||||
if ! docker compose ps --status running | grep -q "aivideo"; then
|
if docker compose ps --status exited | grep -q "aivideo"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- comfyui
|
- comfyui
|
||||||
environment:
|
environment:
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
|
||||||
- OPENAI_BASE_URL=${OPENAI_BASE_URL}
|
- OPENAI_BASE_URL=${OPENAI_BASE_URL:-}
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app
|
- ./:/app
|
||||||
@@ -16,14 +16,11 @@ services:
|
|||||||
# Default: Docker Hub (anonymous pull). GHCR comfyanonymous image often returns "denied" without login.
|
# Default: Docker Hub (anonymous pull). GHCR comfyanonymous image often returns "denied" without login.
|
||||||
# Override: COMFYUI_IMAGE=ghcr.io/... after `docker login ghcr.io`
|
# Override: COMFYUI_IMAGE=ghcr.io/... after `docker login ghcr.io`
|
||||||
comfyui:
|
comfyui:
|
||||||
image: ${COMFYUI_IMAGE:-jamesbrink/comfyui:latest}
|
# CPU-friendly default image for non-NVIDIA development machines.
|
||||||
environment:
|
# Override with COMFYUI_IMAGE to switch back to a GPU image.
|
||||||
- CLI_ARGS=--listen 0.0.0.0 --port 8188
|
image: ${COMFYUI_IMAGE:-ardenius/comfyui-cpu:latest}
|
||||||
|
# Force bind to all interfaces so other containers (and `check_comfy`) can reach it.
|
||||||
|
# Works with the default ardenius/comfyui-cpu image layout (/ComfyUI-cpu/main.py).
|
||||||
|
command: ${COMFYUI_COMMAND:-python3 /ComfyUI-cpu/main.py --cpu --cpu-vae --listen 0.0.0.0 --port 8188}
|
||||||
ports:
|
ports:
|
||||||
- "8188:8188"
|
- "8188:8188"
|
||||||
volumes:
|
|
||||||
- ./ComfyUI/user:/comfyui/user
|
|
||||||
- ./ComfyUI/models:/comfyui/models
|
|
||||||
- ./ComfyUI/custom_nodes:/comfyui/custom_nodes
|
|
||||||
- ./ComfyUI/output:/comfyui/output
|
|
||||||
- ./ComfyUI/input:/comfyui/input
|
|
||||||
|
|||||||
@@ -60,7 +60,15 @@ function sseSend(res, event, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newTaskId() {
|
function newTaskId() {
|
||||||
return crypto.randomUUID();
|
// `crypto.randomUUID()` exists on newer Node versions; fall back for older runtimes.
|
||||||
|
if (crypto && typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
||||||
|
|
||||||
|
const bytes = crypto.randomBytes(16);
|
||||||
|
// UUID v4: set version and variant bits.
|
||||||
|
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
||||||
|
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||||
|
const hex = bytes.toString("hex");
|
||||||
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function taskDir(taskId) {
|
function taskDir(taskId) {
|
||||||
@@ -285,12 +293,20 @@ app.post("/api/render", (req, res) => {
|
|||||||
|
|
||||||
async function runSelfCheck() {
|
async function runSelfCheck() {
|
||||||
const py = process.env.PYTHON_BIN || "python3.10";
|
const py = process.env.PYTHON_BIN || "python3.10";
|
||||||
const checks = [
|
const selfCheckTimeoutMs = Number(process.env.SELF_CHECK_TIMEOUT_MS || 300000);
|
||||||
{ name: "check_comfy", args: ["scripts/check_comfy.py"] },
|
const workflowApiPath = path.join(repoRoot, "workflow_api.json");
|
||||||
{ name: "inspect_comfy_node", args: ["scripts/inspect_comfy_node.py"] },
|
const requireWorkflow = String(process.env.REQUIRE_WORKFLOW || "").trim() === "1";
|
||||||
];
|
|
||||||
|
const checks = [{ name: "check_comfy", args: ["scripts/check_comfy.py"] }];
|
||||||
|
if (fs.existsSync(workflowApiPath) || requireWorkflow) {
|
||||||
|
checks.push({ name: "inspect_comfy_node", args: ["scripts/inspect_comfy_node.py"] });
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
`[server self-check] workflow_api.json not found at ${workflowApiPath}; skipping inspect_comfy_node (set REQUIRE_WORKFLOW=1 to enforce).`
|
||||||
|
);
|
||||||
|
}
|
||||||
for (const c of checks) {
|
for (const c of checks) {
|
||||||
const deadline = Date.now() + 90_000;
|
const deadline = Date.now() + selfCheckTimeoutMs;
|
||||||
let lastErr = "";
|
let lastErr = "";
|
||||||
while (Date.now() < deadline) {
|
while (Date.now() < deadline) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -38,6 +38,19 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|
||||||
|
<!-- Suppress noisy in-browser Babel warning (dev-only). -->
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
const ow = console.warn && console.warn.bind ? console.warn.bind(console) : console.warn;
|
||||||
|
if (!ow) return;
|
||||||
|
console.warn = function () {
|
||||||
|
const first = arguments && arguments.length ? String(arguments[0] || "") : "";
|
||||||
|
if (first.includes("in-browser Babel transformer")) return;
|
||||||
|
return ow.apply(console, arguments);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
||||||
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
||||||
<script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
<script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
||||||
@@ -94,7 +107,7 @@
|
|||||||
showToast(m);
|
showToast(m);
|
||||||
});
|
});
|
||||||
es.addEventListener("task", (e) => {
|
es.addEventListener("task", (e) => {
|
||||||
try { setTaskId(JSON.parse(e.data).task_id || ""); } catch { }
|
try { setTaskId(JSON.parse(e.data).task_id || ""); } catch (err) { }
|
||||||
});
|
});
|
||||||
es.addEventListener("done", (e) => {
|
es.addEventListener("done", (e) => {
|
||||||
appendLog("[done] exit_code=" + e.data);
|
appendLog("[done] exit_code=" + e.data);
|
||||||
@@ -210,7 +223,7 @@
|
|||||||
}
|
}
|
||||||
const data = dataLines.join("\n");
|
const data = dataLines.join("\n");
|
||||||
if (event === "task") {
|
if (event === "task") {
|
||||||
try { setTaskId(JSON.parse(data).task_id || ""); } catch { }
|
try { setTaskId(JSON.parse(data).task_id || ""); } catch (err) { }
|
||||||
} else if (event === "prog") {
|
} else if (event === "prog") {
|
||||||
appendLog("[prog] " + data);
|
appendLog("[prog] " + data);
|
||||||
} else if (event === "error") {
|
} else if (event === "error") {
|
||||||
|
|||||||
Reference in New Issue
Block a user