Files
AutoMetabuilder/frontend/autometabuilder/components/sections/PromptSection.tsx
johndoe6345789 b3bd57964f Introduce AutoMetabuilder core components and workflow packages:
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration.
- Add support for OpenAI client setup and model resolution.
- Develop SDLC context loader from GitHub and repository files.
- Implement workflow context and engine builders.
- Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`.
- Update localization files with new package descriptions and labels.
- Streamline web navigation by loading items from a dedicated JSON file.
2026-01-10 01:21:19 +00:00

58 lines
1.7 KiB
TypeScript

import { useEffect, useState } from "react";
import { Button, Paper, Stack, TextField, Typography } from "@mui/material";
type PromptSectionProps = {
content: string;
onSave: (content: string) => Promise<void>;
t: (key: string, fallback?: string) => string;
};
export default function PromptSection({ content, onSave, t }: PromptSectionProps) {
const [draft, setDraft] = useState(content);
const [message, setMessage] = useState("");
useEffect(() => {
setDraft(content);
}, [content]);
const handleSave = async () => {
await onSave(draft);
setMessage(t("ui.prompt.save", "Save Prompt"));
setTimeout(() => setMessage(""), 2000);
};
return (
<Paper id="prompt" sx={{ p: 3, mb: 3, backgroundColor: "#0d111b" }}>
<Typography variant="h5" gutterBottom>
{t("ui.prompt.title", "Prompt Builder")}
</Typography>
<Typography variant="body2" color="text.secondary" gutterBottom>
{t("ui.prompt.subtitle", "Shape how the assistant thinks, speaks, and decides")}
</Typography>
<TextField
multiline
minRows={10}
value={draft}
onChange={(event) => setDraft(event.target.value)}
fullWidth
InputProps={{
sx: {
backgroundColor: "#030712",
borderRadius: 2,
color: "white",
fontFamily: "JetBrains Mono, monospace",
},
}}
/>
<Stack direction="row" spacing={2} alignItems="center" mt={2}>
<Button variant="contained" onClick={handleSave}>
{t("ui.prompt.save", "Save Prompt")}
</Button>
<Typography variant="body2" color="success.main">
{message}
</Typography>
</Stack>
</Paper>
);
}