mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 04:14:46 +08:00
feat: add environment variable injection for Docker sandbox
- Add environment field to sandbox config for injecting env vars into container - Support $VAR syntax to resolve values from host environment variables - Refactor frontend API modules to use centralized getBackendBaseURL() - Improve Doraemon skill with explicit input/output path arguments - Add .env.example file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ Generate JSON spec for 8 panels arranged on ONE 9:16 vertical canvas (1080x1920)
|
||||
1. Extract story context (theme, gadget, conflict, punchline)
|
||||
2. Map to 8 narrative beats
|
||||
3. Output JSON to `/mnt/user-data/outputs/prompt.json`
|
||||
4. Run `python /mnt/skills/custom/doraemon-comic-aigc/scripts/generate.py`
|
||||
4. Run `python /mnt/skills/custom/doraemon-comic-aigc/scripts/generate.py --input_path /mnt/user-data/outputs/prompt.json --output_path /mnt/user-data/outputs/doraemon.png `
|
||||
5. Directly present the output image as well as the `prompt.json` using the `present_files` tool without checking the file existence
|
||||
|
||||
## Panel Layout
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import argparse
|
||||
import base64
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def generate_image(prompt: str) -> str:
|
||||
def generate_image(prompt: str, output_path: str) -> str:
|
||||
api_key = os.getenv("GEMINI_API_KEY")
|
||||
if not api_key:
|
||||
return "GEMINI_API_KEY is not set"
|
||||
@@ -24,22 +25,25 @@ def generate_image(prompt: str) -> str:
|
||||
if len(image_parts) == 1:
|
||||
base64_image = image_parts[0]["inlineData"]["data"]
|
||||
# Save the image to a file
|
||||
with open("/mnt/user-data/outputs/doraemon.png", "wb") as f:
|
||||
with open(output_path, "wb") as f:
|
||||
f.write(base64.b64decode(base64_image))
|
||||
return "Successfully generated image to /mnt/user-data/outputs/doraemon.png"
|
||||
return f"Successfully generated image to {output_path}"
|
||||
else:
|
||||
return "Failed to generate image"
|
||||
|
||||
|
||||
def main():
|
||||
def main(input_path: str, output_path: str):
|
||||
with open(
|
||||
"/mnt/user-data/outputs/prompt.json",
|
||||
input_path,
|
||||
"r",
|
||||
) as f:
|
||||
raw = f.read()
|
||||
print(generate_image(raw))
|
||||
print(generate_image(raw, output_path))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
parser = argparse.ArgumentParser(description="Generate Doraemon comic image")
|
||||
parser.add_argument("--input_path", required=True, help="Path to the input prompt JSON file")
|
||||
parser.add_argument("--output_path", required=True, help="Path to save the output image")
|
||||
args = parser.parse_args()
|
||||
main(args.input_path, args.output_path)
|
||||
|
||||
Reference in New Issue
Block a user