Skip to content

POC: Local Chat Panel with ollama model.#3487

Draft
rushtong wants to merge 18 commits into
developfrom
gr-DT-3250-node-js
Draft

POC: Local Chat Panel with ollama model.#3487
rushtong wants to merge 18 commits into
developfrom
gr-DT-3250-node-js

Conversation

@rushtong

@rushtong rushtong commented May 8, 2026

Copy link
Copy Markdown
Contributor

Addresses

https://broadworkbench.atlassian.net/browse/DT-3266

Summary

Proof of concept implementation of a local Node/Ollama AI chat set up.

Architecture

Potential MCP Architecture (1)

Additionally, session handling will need to span the different pods in the DUOS app k8s namespace. All pods will need to be able to communicate with a Redis StatefulSet as the implementation solution:
Screenshot 2026-05-17 at 1 31 41 PM

Data Flow

Browser (React chat UI)
  │  POST /api/chat  { message }
  │  Authorization: Bearer <oidcToken>
  ▼
Fastify server  (same Docker container, port 8080)
  ├─ stores oidcToken → sessionStore[sessionId]  (TTL = token expiry)
  ├─ calls LLM backend
  │    local:      OLLAMA_URL/api/chat  (OpenAI-compatible)
  │    production: Vertex AI Gemini API  (via @google-cloud/vertexai SDK)
  │  streams SSE tokens back to browser while agentic loop runs
  │
  │  (tool calls from LLM loop back into same server)
  ├─ POST /mcp/:sessionId  (JSON-RPC 2.0)
  │    looks up oidcToken from sessionStore
  │    calls Consent API with Bearer <oidcToken>
  ▼
Consent API → data → MCP handler → agentic loop → SSE → browser

Running Locally

docker build . -t duos
docker compose --profile local-ai up -d
docker exec duos-ollama ollama pull llama3.2:3b

Tools implemented are in consentClient.js:

  • list_datasets
  • get_dataset
  • list_dar_collections

Chat Panel In Action

Screenshot 2026-05-15 at 2 11 24 PM

Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@rushtong rushtong changed the title Gr dt 3250 node js DT-3250: Run DUOS as a Nodejs app instead of as static content May 8, 2026
Comment thread server/src/index.js Fixed
Comment thread server/src/mcp.js Fixed
@rushtong rushtong changed the title DT-3250: Run DUOS as a Nodejs app instead of as static content POC: Local Chat Panel with ollama model. May 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants