diff --git a/apps/python-service/routers/ai.py b/apps/python-service/routers/ai.py
index d056db59..338c2e6e 100644
--- a/apps/python-service/routers/ai.py
+++ b/apps/python-service/routers/ai.py
@@ -46,14 +46,29 @@ class CollectionField(BaseModel):
required: bool = False
ref: str | None = None
unique: bool = False
+ default: Union[str, int, float, bool, None] = None
items: dict | None = None
fields: list["CollectionField"] | None = None
@model_validator(mode='after')
- def validate_object_fields(self):
+ def validate_field(self):
if self.type == "Object":
if self.fields is None or len(self.fields) == 0:
raise ValueError("fields must be present and non-empty for Object type")
+
+ if self.default is not None:
+ if self.required:
+ raise ValueError("default is not allowed on required fields")
+ if self.type not in ["String", "Number", "Boolean"]:
+ raise ValueError(f"default is not allowed on {self.type} fields")
+
+ if self.type == "Boolean" and not isinstance(self.default, bool):
+ raise ValueError("default must be boolean for Boolean fields")
+ elif self.type == "Number" and not (isinstance(self.default, (int, float)) and not isinstance(self.default, bool)):
+ raise ValueError("default must be numeric for Number fields")
+ elif self.type == "String" and not isinstance(self.default, str):
+ raise ValueError("default must be string for String fields")
+
return self
class CollectionSchema(BaseModel):
@@ -182,8 +197,9 @@ async def collection_creator(request: CollectionCreatorRequest, req: Request):
1. If the description is vague, ask 2-3 specific clarifying questions and set type: "clarify". You MUST set "schema": null. NEVER ask more than 3 at once.
2. Once you have enough context, propose a schema and set type: "schema".
3. Only use these field types: String, Number, Boolean, Date, Ref, Array, Object. For Ref, ALWAYS set 'ref' to the referenced collection name e.g. 'users'. For Array, set 'items' to describe item type e.g. {"type": "String"}. For Object, set 'fields' as a list of sub-fields. Do NOT use Object as a lazy catch-all — prefer specific flat fields when possible.
-4. ALWAYS include "createdAt" (type: Date, required: true) in EVERY collection.
-5. Suggest Ref to "users" where ownership applies (ownerId, authorId, userId, etc.) with 'ref': 'users'.
+4. If a field is NOT required, you may suggest a default value using the 'default' key (value type must exactly match the field type). Do not provide defaults for required fields or complex types.
+5. ALWAYS include "createdAt" (type: Date, required: true) in EVERY collection.
+6. Suggest Ref to "users" where ownership applies (ownerId, authorId, userId, etc.) with 'ref': 'users'.
6. NEVER generate a collection named "users" — it is reserved for auth.
7. When the developer confirms satisfaction ("looks good", "yes", "create it", "perfect") -> set type: "complete", set "schema": null, and in your message, clearly tell the developer that their schema is finalized and guide them to click the "Insert All" button in the Schema Preview panel on the right to create the collections in their database. NEVER claim that you have already created the collections yourself.
8. The "schema" field MUST ALWAYS BE AN ARRAY (LIST) OF OBJECTS. Even if you are proposing a single collection, you must wrap it in an array like: `"schema": [ { "collection": "...", "fields": [...] } ]`. If `type` is "clarify" or "complete", you MUST set `"schema": null`.
diff --git a/apps/web-dashboard/package.json b/apps/web-dashboard/package.json
index 9637fe21..0e3318e2 100644
--- a/apps/web-dashboard/package.json
+++ b/apps/web-dashboard/package.json
@@ -15,6 +15,7 @@
"@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
+ "@radix-ui/react-checkbox": "^1.3.11",
"@radix-ui/react-dialog": "^1.1.23",
"@radix-ui/react-select": "^2.3.7",
"@radix-ui/react-tabs": "^1.1.21",
diff --git a/apps/web-dashboard/src/components/CollectionCreatorAgent.jsx b/apps/web-dashboard/src/components/CollectionCreatorAgent.jsx
index 794cb825..cb2e2f0c 100644
--- a/apps/web-dashboard/src/components/CollectionCreatorAgent.jsx
+++ b/apps/web-dashboard/src/components/CollectionCreatorAgent.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import api from '../utils/api';
import { toast } from 'react-hot-toast';
-import { Send, ArrowRight } from 'lucide-react';
+import { Send, ArrowRight, Bot } from 'lucide-react';
import SchemaCanvasViewer from './SchemaCanvasViewer';
const SUGGESTIONS = [
@@ -166,6 +166,9 @@ export default function CollectionCreatorAgent({ projectId, onInsertAll }) {
if (f.unique !== undefined && !['Array', 'Object', 'Ref'].includes(f.type)) {
fieldDef.unique = !!f.unique;
}
+ if (f.default !== undefined) {
+ fieldDef.default = f.default;
+ }
return fieldDef;
});
};
@@ -214,14 +217,22 @@ export default function CollectionCreatorAgent({ projectId, onInsertAll }) {
};
return (
-
+
- {/* Open Chat Stream & Pinned Composer - Left */}
-