Conversational E-Governance AI

Bilingual Citizens AI Assistant

Developed a state-level bilingual chatbot with Next.js, Google GenAI SDK, and custom Nastaliq CSS, solving stream parsing failures and dynamically generating stateful forms in the viewport.

Client:Civic Welfare Department
Timeline:5 months
Team:Lead AI Architect
Next.jsPrismaPostgreSQLGoogle GenAI SDKGemini 2.5Urdu Nastaliq CSS
System Architecture

The Challenge

Ensuring structural JSON schema output consistency during multi-turn chats under high API traffic, and creating dynamic user intakes without static layouts.

The Solution

Formulated a server-side JSON-repair interceptor and designed a stateful chatbot pre-filling user files and injecting custom intake inputs directly into stream contexts.

My Approach

1

Structured Parsing Safeties

Implemented server-side parser middleware that monitors incomplete stream packets and repairs brackets, maintaining absolute JSON compliance.

2

Stateful Form Injection

Programmatically mapped profile data and dynamically evaluated fields inside the conversation context, generating specialized forms inside chat viewports.

Results & Impact

Instant
Form Ingestion Time

Self-prefilling known profiles dynamically

100%
JSON Parsing Success

Ensured by self-healing stream interceptors

Technical Highlights

Stream JSON Repair Interceptor

Self-healing parser resolving unescaped keys or trailing commas mid-stream.

const cleanJSON = (str) => { return str.replace(/\,\s*\}/g, '\u0027}\u0027').replace(/\,\s*\]/g, '\u0027]\u0027'); };

Lessons Learned

  • Stream validators must handle packet fragmentation
  • Nastaliq typography requires specialized CSS container constraints

Next Steps

  • Deploy native text-to-speech outputs in localized regional Urdu dialects
  • Integrate government citizen portal SSO APIs

Have a Similar Challenge?

I specialize in building production-grade systems that solve complex operational problems. Let's discuss how I can help architect your solution.