0e4c2ebef4
Squash-merge the cloudflare-migration branch (7 commits by Kai ki) into staging with conflict resolution, feature integration, and bug fixes. Engine: - Paradigm D: single-stream Writer replacing dual-phase Plan/Beats - Delete Architect agent; story bible generated via Writer <plan> tag - Modular prompt architecture (segments/registry/builder) - StreamRouter for tagged stream splitting (<plan>/<story>/<choices>) Infrastructure: - Cloudflare Workers deployment (wrangler.jsonc, OpenNext adapter) - D1 database schema + Drizzle ORM (scaffolded, not yet active) - R2 storage helpers (scaffolded, not yet active) - Story persistence API routes + client-side persistence BYOK (Bring Your Own Key): - /api/llm/user-proxy with SSRF-protected LLM proxy (+ requireUser auth) - CORS-aware fetch in ai-client: auto-detect CORS failure, fallback to server proxy transparently via OpenAI SDK custom fetch - BYO config support added to classify-freeform and vision routes - SettingsModal CORS privacy notice (keys never logged/stored) SSE streaming: - engineClient.ts: fetchSSE helper for progressive scene events - startSession/requestScene accept optional emit callback - Fix SSE error event field name (error → message) in scene/start routes i18n integration: - Wire buildLanguageDirective into paradigm D's prompt builder - Update corsNotice i18n keys (zh-CN/en/ja) with CORS proxy privacy text - Preserve Session.language + LanguageSwitcher from i18n commit Co-authored-by: Kai ki <155355644+zbf1009@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
2.2 KiB
SQL
61 lines
2.2 KiB
SQL
CREATE TABLE `characters` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`story_id` text NOT NULL,
|
|
`name` text NOT NULL,
|
|
`visual_description` text,
|
|
`voice_description` text,
|
|
`base_portrait_key` text,
|
|
`base_portrait_url` text,
|
|
`base_portrait_uuid` text,
|
|
`voice_json` text,
|
|
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
FOREIGN KEY (`story_id`) REFERENCES `stories`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `characters_story_name_idx` ON `characters` (`story_id`,`name`);--> statement-breakpoint
|
|
CREATE TABLE `featured_stories` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`gender` text NOT NULL,
|
|
`title` text NOT NULL,
|
|
`outline` text NOT NULL,
|
|
`style` text NOT NULL,
|
|
`tags` text NOT NULL,
|
|
`cover_path` text NOT NULL,
|
|
`firstact_path` text NOT NULL,
|
|
`firstscene_path` text,
|
|
`sort_order` integer DEFAULT 0 NOT NULL,
|
|
`is_active` integer DEFAULT 1 NOT NULL,
|
|
`click_count` integer DEFAULT 0 NOT NULL,
|
|
`created_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `featured_gender_active_idx` ON `featured_stories` (`gender`,`is_active`);--> statement-breakpoint
|
|
CREATE TABLE `scenes` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`story_id` text NOT NULL,
|
|
`scene_key` text,
|
|
`scene_summary` text,
|
|
`scene_image_key` text,
|
|
`scene_image_url` text,
|
|
`beats_json` text,
|
|
`sort_order` integer NOT NULL,
|
|
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
FOREIGN KEY (`story_id`) REFERENCES `stories`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `scenes_story_id_idx` ON `scenes` (`story_id`);--> statement-breakpoint
|
|
CREATE TABLE `stories` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`user_id` text,
|
|
`world_setting` text NOT NULL,
|
|
`style_guide` text NOT NULL,
|
|
`style_reference_image_key` text,
|
|
`orientation` text DEFAULT 'landscape' NOT NULL,
|
|
`story_state_json` text,
|
|
`status` text DEFAULT 'active' NOT NULL,
|
|
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `stories_user_id_idx` ON `stories` (`user_id`);--> statement-breakpoint
|
|
CREATE INDEX `stories_created_at_idx` ON `stories` (`created_at`); |