mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-04 21:02:39 +02:00
commit
e49da64ba0
3 changed files with 6 additions and 14 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue