Add a democratic idea submission and AI synthesis platform

Implement a full-stack application with a React frontend and a Python Flask backend. The backend integrates with an AI agent to filter political ideas for democratic values and synthesize accepted ideas into a collective voice. Includes API endpoints for idea submission, retrieval, and synthesis, along with database persistence.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 923ae0e3-a363-4db8-b04a-e8baca2a1330
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 31c5f770-9905-46af-a938-9d40ef3d4404
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8af7d2ec-2cc3-4ece-8af3-9f071488d072/923ae0e3-a363-4db8-b04a-e8baca2a1330/Xzzm5QH
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
pironantoine
2026-04-03 16:25:11 +00:00
parent 4d26b95657
commit f9c4073d21
92 changed files with 8199 additions and 23 deletions
+56
View File
@@ -14,3 +14,59 @@ import * as zod from "zod";
export const HealthCheckResponse = zod.object({
status: zod.string(),
});
/**
* Submit a civic idea to be filtered and included in the synthesis
* @summary Submit a political idea
*/
export const submitIdeaBodyContentMin = 10;
export const submitIdeaBodyContentMax = 1000;
export const submitIdeaBodyAuthorMax = 100;
export const SubmitIdeaBody = zod.object({
content: zod
.string()
.min(submitIdeaBodyContentMin)
.max(submitIdeaBodyContentMax)
.describe("The political idea text"),
author: zod
.string()
.max(submitIdeaBodyAuthorMax)
.optional()
.describe("Optional pseudonym"),
});
/**
* Returns all ideas that passed the democratic filter
* @summary List all accepted ideas
*/
export const ListIdeasResponseItem = zod.object({
id: zod.number(),
content: zod.string(),
author: zod.string().nullish(),
accepted: zod.boolean(),
rejectionReason: zod.string().nullish(),
createdAt: zod.coerce.date(),
});
export const ListIdeasResponse = zod.array(ListIdeasResponseItem);
/**
* Returns counts of total, accepted and rejected ideas
* @summary Get idea statistics
*/
export const GetIdeaStatsResponse = zod.object({
total: zod.number(),
accepted: zod.number(),
rejected: zod.number(),
});
/**
* Returns the latest synthesized text of the people's voice
* @summary Get current synthesis
*/
export const GetSynthesisResponse = zod.object({
text: zod.string().describe("The synthesized voice of the people"),
ideaCount: zod.number().describe("Number of ideas included in the synthesis"),
updatedAt: zod.coerce.date().nullish(),
});
@@ -0,0 +1,12 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
export interface ErrorResponse {
error: string;
message: string;
}
+16
View File
@@ -0,0 +1,16 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
export interface Idea {
id: number;
content: string;
author?: string | null;
accepted: boolean;
rejectionReason?: string | null;
createdAt: Date;
}
@@ -0,0 +1,16 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
import type { Idea } from "./idea";
export interface IdeaResult {
id: number;
accepted: boolean;
/** Reason if rejected */
reason?: string;
idea?: Idea;
}
@@ -0,0 +1,13 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
export interface IdeaStats {
total: number;
accepted: number;
rejected: number;
}
+6
View File
@@ -6,4 +6,10 @@
* OpenAPI spec version: 0.1.0
*/
export * from "./errorResponse";
export * from "./healthStatus";
export * from "./idea";
export * from "./ideaResult";
export * from "./ideaStats";
export * from "./submitIdeaBody";
export * from "./synthesis";
@@ -0,0 +1,21 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
export interface SubmitIdeaBody {
/**
* The political idea text
* @minLength 10
* @maxLength 1000
*/
content: string;
/**
* Optional pseudonym
* @maxLength 100
*/
author?: string;
}
@@ -0,0 +1,15 @@
/**
* Generated by orval v8.5.3 🍺
* Do not edit manually.
* Api
* API specification
* OpenAPI spec version: 0.1.0
*/
export interface Synthesis {
/** The synthesized voice of the people */
text: string;
/** Number of ideas included in the synthesis */
ideaCount: number;
updatedAt?: Date | null;
}