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:
hetao
2026-01-24 22:33:29 +08:00
parent 869af570c9
commit 6e147a772e
8 changed files with 72 additions and 18 deletions

View File

@@ -1,17 +1,14 @@
import { env } from "@/env";
import { getBackendBaseURL } from "@/core/config";
import type { MCPConfig } from "./types";
export async function loadMCPConfig() {
const response = await fetch(
`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/mcp/config`,
);
const response = await fetch(`${getBackendBaseURL()}/api/mcp/config`);
return response.json() as Promise<MCPConfig>;
}
export async function updateMCPConfig(config: MCPConfig) {
const response = await fetch(
`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/mcp/config`,
const response = await fetch(`${getBackendBaseURL()}/api/mcp/config`,
{
method: "PUT",
headers: {

View File

@@ -1,16 +1,16 @@
import { env } from "@/env";
import { getBackendBaseURL } from "@/core/config";
import type { Skill } from "./type";
export async function loadSkills() {
const skills = await fetch(`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/skills`);
const skills = await fetch(`${getBackendBaseURL()}/api/skills`);
const json = await skills.json();
return json.skills as Skill[];
}
export async function enableSkill(skillName: string, enabled: boolean) {
const response = await fetch(
`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/skills/${skillName}`,
`${getBackendBaseURL()}/api/skills/${skillName}`,
{
method: "PUT",
headers: {