Agent Chat Worker

This Cloudflare Worker provides the /api/chat endpoint for the dashboard chat bar.

Setup

  1. Install dependencies:
cd worker
npm install
  1. Authenticate Wrangler:
npx wrangler login
  1. Add the DeepSeek key as a secret:
npx wrangler secret put DEEPSEEK_API_KEY

The default model is configured in wrangler.toml as deepseek-v4-flash, with DEEPSEEK_THINKING=disabled for quick dashboard replies. Web search is also enabled by default through Bing RSS results, so each user query can be grounded with fresh web context when relevant.

  1. Optional local development:
copy .dev.vars.example .dev.vars
npm run dev
  1. Deploy:
npm run deploy

After deploy, copy the Worker URL and paste it into Agent/chat-config.js:

window.AGENT_CHAT_CONFIG = {
  endpoint: "https://your-worker-name.workers.dev/api/chat",
  assistantName: "Agent Chat",
};

If you later bind a custom subdomain, update the same file to that custom URL.