constants.ts 946 B

123456789101112131415161718192021222324
  1. import { dev, browser } from '$app/environment';
  2. import { PUBLIC_API_BASE_URL } from '$env/static/public';
  3. export const OLLAMA_API_BASE_URL =
  4. PUBLIC_API_BASE_URL === ''
  5. ? browser
  6. ? `http://${location.hostname}:11434/api`
  7. : `http://localhost:11434/api`
  8. : PUBLIC_API_BASE_URL;
  9. export const WEBUI_BASE_URL = dev ? `http://${location.hostname}:8080` : ``;
  10. export const WEBUI_API_BASE_URL = `${WEBUI_BASE_URL}/api/v1`;
  11. export const WEB_UI_VERSION = 'v1.0.0-alpha-static';
  12. // Source: https://kit.svelte.dev/docs/modules#$env-static-public
  13. // This feature, akin to $env/static/private, exclusively incorporates environment variables
  14. // that are prefixed with config.kit.env.publicPrefix (usually set to PUBLIC_).
  15. // Consequently, these variables can be securely exposed to client-side code.
  16. // Example of the .env configuration:
  17. // OLLAMA_API_BASE_URL="http://localhost:11434/api"
  18. // # Public
  19. // PUBLIC_API_BASE_URL=$OLLAMA_API_BASE_URL