Sign inSign up

ppollai/chatbot

By ppollai

β€’Updated about 1 year ago

A SAMPLE WebSocket-based chatbot that provides predefined Questions & Answers about a profile.

Image
Machine learning & AI
0

1.1K

ppollai/chatbot repository overview

⁠Chatbot – WebSocket Based Q&A Bot

This is a lightweight WebSocket-based chatbot that provides predefined Questions & Answers about a profile/skillset. You can run it easily via Docker or deploy on Kubernetes with Ingress support.


β πŸš€ Run with Docker

docker run -d -p 8080:8080 ppollai/chatbot:latest

πŸ‘‰ The chatbot will be available at:

  • WebSocket URL: ws://localhost:8080

⁠☸️ Deploy on Kubernetes

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: chatbot
  namespace: ai-chatbot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: chatbot
  template:
    metadata:
      labels:
        app: chatbot
    spec:
      containers:
      - name: chatbot
        image: ppollai/chatbot:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
  name: chatbot
  namespace: ai-chatbot
spec:
  selector:
    app: chatbot
  ports:
    - port: 8080
      targetPort: 8080

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: chatbot
  namespace: ai-chatbot
  annotations:
    nginx.ingress.kubernetes.io/preserve-host: 'true'
    nginx.ingress.kubernetes.io/proxy-body-size: 10m
    nginx.ingress.kubernetes.io/proxy-buffer-size: 1m
    nginx.ingress.kubernetes.io/proxy-buffering: 'off'
    nginx.ingress.kubernetes.io/proxy-http-version: '1.1'
    nginx.ingress.kubernetes.io/proxy-max-temp-file-size: 20m
    nginx.ingress.kubernetes.io/proxy-read-timeout: '3600'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '3600'
    nginx.ingress.kubernetes.io/use-forwarded-headers: 'true'
    nginx.ingress.kubernetes.io/websocket-service: 'true'
    nginx.ingress.kubernetes.io/websocket-services: chatbot
spec:
  ingressClassName: nginx
  rules:
    - http:
        paths:
          - path: /chat
            pathType: Prefix
            backend:
              service:
                name: chatbot
                port:
                  number: 8080
          - path: /chatbot
            pathType: Prefix
            backend:
              service:
                name: chatbot
                port:
                  number: 8080

πŸ‘‰ After applying, the chatbot will be accessible at:

  • WebSocket URL: ws://<ingress-ip>/chatbot

β πŸ’» Test with wscat

You can test the chatbot quickly using wscat⁠:

⁠Install wscat (if not already installed)
npm install -g wscat
⁠Connect to chatbot
# For Docker local run
wscat -c ws://localhost:8080

# For Kubernetes ingress
wscat -c ws://<ingress-ip>/chatbot
⁠Example Interaction
Connected (press CTRL+C to quit)
< Welcome! Please select a question number:
1. What is your full name?
2. What is your experience level?
3. What is your current role?
...

> 1
< My name is Prashant Kumar Pollai, a seasoned Server Infrastructure and Solution Architect.

β πŸ”Ž Features

  • WebSocket based chatbot with predefined Q&A
  • Ready-to-use Docker image
  • Kubernetes Ingress with /chatbot path support
  • Testable via wscat CLI
  • Lightweight & production-ready

Tag summary

Content type

Image

Digest

sha256:d1fd6ecd7…

Size

48 MB

Last updated

about 1 year ago

docker pull ppollai/chatbot