server: public: use relative routes for static files (#6325)

server: public: support custom `api_url`, default to relative base path
This commit is contained in:
Eric Zhang 2024-03-27 13:55:29 +08:00 committed by GitHub
parent a4f569e8a3
commit 0642b22cd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2864 additions and 2848 deletions

View file

@ -199,10 +199,10 @@
<script type="module">
import {
html, h, signal, effect, computed, render, useSignal, useEffect, useRef, Component
} from '/index.js';
} from './index.js';
import { llama } from '/completion.js';
import { SchemaConverter } from '/json-schema-to-grammar.mjs';
import { llama } from './completion.js';
import { SchemaConverter } from './json-schema-to-grammar.mjs';
let selected_image = false;
var slot_id = -1;
@ -405,7 +405,7 @@
throw new Error("already running");
}
controller.value = new AbortController();
for await (const chunk of llama(prompt, llamaParams, { controller: controller.value })) {
for await (const chunk of llama(prompt, llamaParams, { controller: controller.value, api_url: document.baseURI.replace(/\/+$/, '') })) {
const data = chunk.data;
if (data.stop) {