You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// const model = openai(body.model || 'gpt-5-mini');
50
+
constmodel=xai("grok-4-0709")
51
+
52
+
// Instruction prompt guiding the model to emit ONLY the structured object.
53
+
// Note: by default prefer moderate detail; allow higher detail when requested by client.
54
+
constsystemInstructions=`
55
+
You are a 3D mesh generator specializing in high-fidelity, realistic models. Output ONLY a JSON object that matches the schema.
56
+
57
+
Rules:
58
+
- Provide a concise, descriptive mesh.name (e.g., "Ancient Oak Tree with Bark Texture Details", "Ergonomic Modern Office Chair").
59
+
- Aim for detail: incorporate intricate features like surface variations, asymmetries for organic shapes, or precise engineering for man-made objects.
60
+
- Use realistic proportions, scales, and architectures based on real-world references.
61
+
- Optimize topology for quality: favor quads for smooth surfaces to support subdivision and texturing; use triangles only where necessary; ensure manifold, watertight meshes without self-intersections or holes.
62
+
- Target a higher vertex count (e.g., 100-1000+ vertices depending on complexity) for smoother curves, finer details, and better subdivision potential.
63
+
- Use 0-based indices in faces.
64
+
- Center the mesh at the origin (0,0,0) and normalize scale to fit within a unit bounding box unless the request specifies otherwise.
65
+
- Ensure symmetry where logically appropriate (e.g., for vehicles or furniture).
66
+
- Do not include extra narration, metadata, or prose—only the JSON object that matches the schema.
67
+
68
+
User's request: ${userPrompt}
69
+
`;
70
+
71
+
const{ partialObjectStream,}=awaitstreamObject({
72
+
model: model,
73
+
schema: meshSchema,
74
+
prompt: systemInstructions,
75
+
temperature: 0.2
76
+
});
77
+
78
+
// Stream each partial object state as NDJSON so the client can incrementally update.
0 commit comments