aboutsummaryrefslogtreecommitdiff
path: root/src/config.example.js
blob: 84d2a01701e2dcd22fab6e0d6c08ffe6a9d842d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ==========================================================================
 * WebX11 Chat Widget — configuration
 * --------------------------------------------------------------------------
 * Copy this file to `config.js` next to widget.html and edit the values.
 * Everything is optional except `endpoint`.
 *
 * ABOUT THE ENDPOINT
 *   `endpoint` must be YOUR OWN gateway, i.e. an HTTP URL on your server that
 *   forwards the request to your model backend (Ollama, an Ollama-compatible
 *   API, or your own proxy) and adds your API key server-side.
 *
 *   The widget runs in the visitor's browser, so anything you put in this
 *   file is public. NEVER put an API key, token or password here — not in
 *   this example file, not in your config.js, not in widget.html. Keep the
 *   key on the server (environment variable, secrets file, systemd unit)
 *   and let the gateway attach it to the upstream request.
 *
 *   The endpoint must also allow your website's origin (CORS). See
 *   docs/USAGE.md → Troubleshooting.
 * ========================================================================== */

window.WX_WIDGET_CONFIG = {

  /* Base URL of your gateway: protocol + host + the path prefix your proxy
   * exposes, e.g. 'https://YOUR-HOST/ollama'. The widget appends
   * '/api/generate' for you. If you prefer, give the full generate URL
   * ('https://YOUR-HOST/ollama/api/generate') and it is used as-is.
   * A relative path such as '/ollama' works when the widget is served from
   * the same origin as the gateway. */
  endpoint: 'https://YOUR-HOST/ollama',

  /* Model name as your backend knows it. Ollama tags look like
   * 'llama3.2:latest'. This is a public identifier, not a secret. */
  model: 'llama3.2:latest',

  /* Header and greeting */
  title: 'Chat with us',
  welcomeMessage: 'Hi! How can I help you today?',
  inputPlaceholder: 'Type your message…',

  /* Brand colour (any #rgb or #rrggbb). Text on the accent colour is
   * switched between dark and light automatically. */
  accentColor: '#00e5a0',

  /* 'right' (default) or 'left' */
  position: 'right',

  /* Show the "Model: …" line under the header. Set to false to hide it. */
  statusLine: true,

  /* The assistant's instructions. Write this for your own business. */
  systemPrompt:
    'You are a helpful assistant for this website. ' +
    'Answer briefly and accurately. If you do not know something, say so ' +
    'and suggest contacting the site owner.',

  /* Optional: load the system prompt from a plain-text URL instead of the
   * inline string above. Leave empty to use systemPrompt. */
  promptUrl: '',
  promptVersion: '',

  /* Prepended to the visitor's message before it is sent. */
  questionPrefix: 'User Question:',

  /* Quick-reply buttons: [label, message sent when clicked] */
  chips: [
    ['What do you offer?', 'What do you offer?'],
    ['Contact', 'How can I contact you?']
  ]
};