server : simple chat UI with vuejs and daisyui

This commit is contained in:
Xuan Son Nguyen 2024-11-04 23:09:57 +01:00
parent ea02c753eb
commit 120d05b7de
2 changed files with 160 additions and 1292 deletions

View file

@ -29,7 +29,7 @@ export async function* llama(prompt, params = {}, config = {}) {
const completionParams = { ...paramDefaults, ...params, prompt };
const response = await fetch(`${api_url}/completion`, {
const response = await fetch(`${api_url}${config.endpoint || '/completion'}`, {
method: 'POST',
body: JSON.stringify(completionParams),
headers: {
@ -78,7 +78,12 @@ export async function* llama(prompt, params = {}, config = {}) {
for (const line of lines) {
const match = regex.exec(line);
if (match) {
result[match[1]] = match[2]
result[match[1]] = match[2];
if (result.data === '[DONE]') {
cont = false;
break;
}
// since we know this is llama.cpp, let's just decode the json in data
if (result.data) {
result.data = JSON.parse(result.data);

File diff suppressed because it is too large Load diff