Merge pull request #40 from rowboatlabs/dev

merge dev
This commit is contained in:
Ramnique Singh 2025-03-10 14:34:34 +05:30 committed by GitHub
commit e49da64ba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 14 deletions

View file

@ -14,7 +14,7 @@ See the relevant sections below for details on each service.
- [Local Development Setup](#local-development-setup) - [Local Development Setup](#local-development-setup)
- [Python SDK](#option-1-python-sdk) - [Python SDK](#option-1-python-sdk)
- [HTTP API](#option-2-http-api) - [HTTP API](#option-2-http-api)
- [Optional Features](#optional-features) - [Optional Features](#enable-rag)
- [Enable RAG](#enable-rag) - [Enable RAG](#enable-rag)
- [URL Scraping](#url-scraping) - [URL Scraping](#url-scraping)
- [File Uploads](#file-uploads) - [File Uploads](#file-uploads)

View file

@ -1,21 +1,13 @@
import { promises as fs } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
export const dynamic = 'force-dynamic' export const dynamic = 'force-dynamic'
const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Fetch template once when module loads
const templatePromise = fetch(process.env.CHAT_WIDGET_HOST + '/bootstrap.template.js')
// Read the file once when the module loads .then(res => res.text());
const jsFileContents = fs.readFile(
path.join(__dirname, 'bootstrap.js'),
'utf-8'
);
export async function GET() { export async function GET() {
try { try {
// Reuse the cached content // Reuse the cached content
const template = await jsFileContents; const template = await templatePromise;
// Replace placeholder values with actual URLs // Replace placeholder values with actual URLs
const contents = template const contents = template