Initial commit: Pixel AI comic/video creation platform

- FastAPI backend with SQLModel, Alembic migrations, AgentScope agents
- Next.js 15 frontend with React 19, Tailwind, Zustand, React Flow
- Multi-provider AI system (DashScope, Kling, MiniMax, Volcengine, OpenAI, etc.)
- All HTTP clients migrated from sync requests to async httpx
- Admin-managed API keys via environment variables
- SSRF vulnerability fixed in ensure_url()
This commit is contained in:
张鹏
2026-04-29 01:20:12 +08:00
commit f9f4560459
808 changed files with 151724 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
import { Command } from './Command';
import { AppNodeType, AppNodeData } from '../types/node';
/**
* Command to update a node's data
*/
export class UpdateNodeCommand implements Command {
private nodeId: string;
private oldData: Partial<AppNodeData>;
private newData: Partial<AppNodeData>;
private setNodes: (updater: (nodes: AppNodeType[]) => AppNodeType[]) => void;
private getNodes: () => AppNodeType[];
constructor(
nodeId: string,
newData: Partial<AppNodeData>,
setNodes: (updater: (nodes: AppNodeType[]) => AppNodeType[]) => void,
getNodes: () => AppNodeType[]
) {
this.nodeId = nodeId;
this.newData = newData;
this.setNodes = setNodes;
this.getNodes = getNodes;
// Store old data for undo
const node = getNodes().find(n => n.id === nodeId);
if (node && node.type === 'appNode') {
this.oldData = { ...node.data };
} else {
this.oldData = {};
}
}
execute(): void {
this.setNodes((nodes) =>
nodes.map(n =>
n.id === this.nodeId && n.type === 'appNode'
? { ...n, data: { ...n.data, ...this.newData } }
: n
)
);
}
undo(): void {
this.setNodes((nodes) =>
nodes.map(n =>
n.id === this.nodeId && n.type === 'appNode'
? { ...n, data: { ...n.data, ...this.oldData } }
: n
)
);
}
getDescription(): string {
return `Update node: ${this.nodeId}`;
}
}