Unverified Commit 68c182db authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge branch 'dev' into main

parents 242e70d1 876853f2
......@@ -15,6 +15,7 @@
"Add a short description about what this modelfile does": "为这个模型文件添加一段简短的描述",
"Add a short title for this prompt": "为这个提示词添加一个简短的标题",
"Add a tag": "添加标签",
"Add custom prompt": "",
"Add Docs": "添加文档",
"Add Files": "添加文件",
"Add message": "添加消息",
......@@ -34,6 +35,7 @@
"Already have an account?": "已经有账户了吗?",
"an assistant": "助手",
"and": "和",
"and create a new shared link.": "",
"API Base URL": "API 基础 URL",
"API Key": "API 密钥",
"API Key created.": "",
......@@ -43,6 +45,7 @@
"Archived Chats": "聊天记录存档",
"are allowed - Activate this command by typing": "允许 - 通过输入来激活这个命令",
"Are you sure?": "你确定吗?",
"Attach file": "",
"Attention to detail": "",
"Audio": "音频",
"Auto-playback response": "自动播放回应",
......@@ -52,8 +55,10 @@
"available!": "可用!",
"Back": "返回",
"Bad Response": "",
"before": "",
"Being lazy": "",
"Builder Mode": "构建模式",
"Bypass SSL verification for Websites": "",
"Cancel": "取消",
"Categories": "分类",
"Change Password": "更改密码",
......@@ -68,7 +73,9 @@
"Chunk Overlap": "块重叠 (Chunk Overlap)",
"Chunk Params": "块参数 (Chunk Params)",
"Chunk Size": "块大小 (Chunk Size)",
"Citation": "",
"Click here for help.": "点击这里获取帮助。",
"Click here to": "",
"Click here to check other modelfiles.": "点击这里检查其他模型文件。",
"Click here to select": "点击这里选择",
"Click here to select a csv file.": "",
......@@ -96,6 +103,8 @@
"Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':": "为以下查询创建一个简洁的、3-5 个词的短语作为标题,严格遵守 3-5 个词的限制并避免使用“标题”一词:",
"Create a modelfile": "创建模型文件",
"Create Account": "创建账户",
"Create new key": "",
"Create new secret key": "",
"Created at": "创建于",
"Created At": "",
"Current Model": "当前模型",
......@@ -103,6 +112,7 @@
"Custom": "自定义",
"Customize Ollama models for a specific purpose": "定制特定用途的 Ollama 模型",
"Dark": "暗色",
"Dashboard": "",
"Database": "数据库",
"DD/MM/YYYY HH:mm": "DD/MM/YYYY HH:mm",
"Default": "默认",
......@@ -118,6 +128,7 @@
"Delete chat": "删除聊天",
"Delete Chat": "",
"Delete Chats": "删除聊天记录",
"delete this link": "",
"Delete User": "",
"Deleted {{deleteModelTag}}": "已删除{{deleteModelTag}}",
"Deleted {{tagName}}": "",
......@@ -144,6 +155,7 @@
"Edit Doc": "编辑文档",
"Edit User": "编辑用户",
"Email": "电子邮件",
"Embedding Model": "",
"Embedding Model Engine": "",
"Embedding model set to \"{{embedding_model}}\"": "",
"Enable Chat History": "启用聊天历史",
......@@ -165,6 +177,7 @@
"Enter stop sequence": "输入停止序列",
"Enter Top K": "输入 Top K",
"Enter URL (e.g. http://127.0.0.1:7860/)": "输入 URL (例如 http://127.0.0.1:7860/)",
"Enter URL (e.g. http://localhost:11434)": "",
"Enter Your Email": "输入您的电子邮件",
"Enter Your Full Name": "输入您的全名",
"Enter Your Password": "输入您的密码",
......@@ -206,6 +219,7 @@
"Import Modelfiles": "导入模型文件",
"Import Prompts": "导入提示",
"Include `--api` flag when running stable-diffusion-webui": "运行 stable-diffusion-webui 时包含 `--api` 标志",
"Input commands": "",
"Interface": "界面",
"join our Discord for help.": "加入我们的 Discord 寻求帮助。",
"JSON": "JSON",
......@@ -225,6 +239,7 @@
"Manage Ollama Models": "管理 Ollama 模型",
"Max Tokens": "最大令牌数",
"Maximum of 3 models can be downloaded simultaneously. Please try again later.": "最多可以同时下载 3 个模型,请稍后重试。",
"Messages you send after creating your link won't be shared. Users with the URL will beable to view the shared chat.": "",
"Minimum Score": "",
"Mirostat": "Mirostat",
"Mirostat Eta": "Mirostat Eta",
......@@ -255,6 +270,8 @@
"Name your modelfile": "命名你的模型文件",
"New Chat": "新聊天",
"New Password": "新密码",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "不确定要添加什么?",
"Not sure what to write? Switch to": "不确定写什么?切换到",
......@@ -283,6 +300,7 @@
"OpenAI URL/Key required.": "",
"or": "或",
"Other": "",
"Overview": "",
"Parameters": "参数",
"Password": "密码",
"PDF document (.pdf)": "",
......@@ -297,6 +315,7 @@
"Prompt Content": "提示词内容",
"Prompt suggestions": "提示词建议",
"Prompts": "提示词",
"Pull \"{{searchValue}}\" from Ollama.com": "",
"Pull a model from Ollama.com": "从 Ollama.com 拉取一个模型",
"Pull Progress": "拉取进度",
"Query Params": "查询参数",
......@@ -309,13 +328,17 @@
"Regenerate": "",
"Release Notes": "发布说明",
"Remove": "",
"Remove Model": "",
"Rename": "",
"Repeat Last N": "重复最后 N 次",
"Repeat Penalty": "重复惩罚",
"Request Mode": "请求模式",
"Reranking Model": "",
"Reranking model disabled": "",
"Reranking model set to \"{{reranking_model}}\"": "",
"Reset Vector Storage": "重置向量存储",
"Response AutoCopy to Clipboard": "自动复制回答到剪贴板",
"Retrieval Augmented Generation Settings": "",
"Role": "角色",
"Rosé Pine": "Rosé Pine",
"Rosé Pine Dawn": "Rosé Pine Dawn",
......@@ -337,12 +360,15 @@
"Select a mode": "选择一个模式",
"Select a model": "选择一个模型",
"Select an Ollama instance": "选择一个 Ollama 实例",
"Select model": "",
"Send a Message": "发送消息",
"Send message": "发送消息",
"Server connection verified": "已验证服务器连接",
"Set as default": "设为默认",
"Set Default Model": "设置默认模型",
"Set embedding model (e.g. {{model}})": "",
"Set Image Size": "设置图片大小",
"Set reranking model (e.g. {{model}})": "",
"Set Steps": "设置步骤",
"Set Title Auto-Generation Model": "设置标题自动生成模型",
"Set Voice": "设置声音",
......@@ -361,6 +387,7 @@
"Sign Out": "登出",
"Sign up": "注册",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "语音识别错误:{{error}}",
"Speech-to-Text Engine": "语音转文字引擎",
"SpeechRecognition API is not supported in this browser.": "此浏览器不支持 SpeechRecognition API。",
......@@ -405,8 +432,6 @@
"Uh-oh! There was an issue connecting to {{provider}}.": "哎呀!连接到{{provider}}时出现问题。",
"Unknown File Type '{{file_type}}', but accepting and treating as plain text": "未知文件类型'{{file_type}}',将视为纯文本进行处理",
"Update and Copy Link": "",
"Update Embedding Model": "",
"Update embedding model (e.g. {{model}})": "",
"Update password": "更新密码",
"Update Reranking Model": "",
"Update reranking model (e.g. {{model}})": "",
......@@ -427,6 +452,7 @@
"Version": "版本",
"Warning: If you update or change your embedding model, you will need to re-import all documents.": "",
"Web": "网页",
"Web Params": "",
"Webhook URL": "",
"WebUI Add-ons": "WebUI 插件",
"WebUI Settings": "WebUI 设置",
......@@ -437,6 +463,8 @@
"Write a prompt suggestion (e.g. Who are you?)": "写一个提示建议(例如:你是谁?)",
"Write a summary in 50 words that summarizes [topic or keyword].": "用 50 个字写一个总结 [主题或关键词]。",
"You": "你",
"You have no archived conversations.": "",
"You have shared this chat": "",
"You're a helpful assistant.": "你是一个有帮助的助手。",
"You're now logged in.": "已登录。",
"Youtube": ""
......
......@@ -15,6 +15,7 @@
"Add a short description about what this modelfile does": "為這個 Modelfile 添加一段簡短的描述",
"Add a short title for this prompt": "為這個提示詞添加一個簡短的標題",
"Add a tag": "新增標籤",
"Add custom prompt": "",
"Add Docs": "新增文件",
"Add Files": "新增檔案",
"Add message": "新增訊息",
......@@ -34,6 +35,7 @@
"Already have an account?": "已經有帳號了嗎?",
"an assistant": "助手",
"and": "和",
"and create a new shared link.": "",
"API Base URL": "API 基本 URL",
"API Key": "API 金鑰",
"API Key created.": "",
......@@ -43,6 +45,7 @@
"Archived Chats": "聊天記錄存檔",
"are allowed - Activate this command by typing": "是允許的 - 透過輸入",
"Are you sure?": "你確定嗎?",
"Attach file": "",
"Attention to detail": "",
"Audio": "音訊",
"Auto-playback response": "自動播放回答",
......@@ -52,8 +55,10 @@
"available!": "可以使用!",
"Back": "返回",
"Bad Response": "",
"before": "",
"Being lazy": "",
"Builder Mode": "建構模式",
"Bypass SSL verification for Websites": "",
"Cancel": "取消",
"Categories": "分類",
"Change Password": "修改密碼",
......@@ -68,7 +73,9 @@
"Chunk Overlap": "Chunk Overlap",
"Chunk Params": "Chunk 參數",
"Chunk Size": "Chunk 大小",
"Citation": "",
"Click here for help.": "點擊這裡尋找幫助。",
"Click here to": "",
"Click here to check other modelfiles.": "點擊這裡檢查其他 Modelfiles。",
"Click here to select": "點擊這裡選擇",
"Click here to select a csv file.": "",
......@@ -96,6 +103,8 @@
"Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':": "為以下的查詢建立一個簡潔、3-5 個詞的短語作為標題,嚴格遵守 3-5 個詞的限制,避免使用「標題」這個詞:",
"Create a modelfile": "建立 Modelfile",
"Create Account": "建立帳號",
"Create new key": "",
"Create new secret key": "",
"Created at": "建立於",
"Created At": "",
"Current Model": "目前模型",
......@@ -103,6 +112,7 @@
"Custom": "自訂",
"Customize Ollama models for a specific purpose": "定制特定用途的 Ollama 模型",
"Dark": "暗色",
"Dashboard": "",
"Database": "資料庫",
"DD/MM/YYYY HH:mm": "DD/MM/YYYY HH:mm",
"Default": "預設",
......@@ -118,6 +128,7 @@
"Delete chat": "刪除聊天紀錄",
"Delete Chat": "",
"Delete Chats": "刪除聊天紀錄",
"delete this link": "",
"Delete User": "",
"Deleted {{deleteModelTag}}": "已刪除 {{deleteModelTag}}",
"Deleted {{tagName}}": "",
......@@ -144,6 +155,7 @@
"Edit Doc": "編輯文件",
"Edit User": "編輯使用者",
"Email": "電子郵件",
"Embedding Model": "",
"Embedding Model Engine": "",
"Embedding model set to \"{{embedding_model}}\"": "",
"Enable Chat History": "啟用聊天歷史",
......@@ -165,6 +177,7 @@
"Enter stop sequence": "輸入停止序列",
"Enter Top K": "輸入 Top K",
"Enter URL (e.g. http://127.0.0.1:7860/)": "輸入 URL(例如 http://127.0.0.1:7860/)",
"Enter URL (e.g. http://localhost:11434)": "",
"Enter Your Email": "輸入你的電子郵件",
"Enter Your Full Name": "輸入你的全名",
"Enter Your Password": "輸入你的密碼",
......@@ -206,6 +219,7 @@
"Import Modelfiles": "匯入 Modelfiles",
"Import Prompts": "匯入提示詞",
"Include `--api` flag when running stable-diffusion-webui": "在運行 stable-diffusion-webui 時加上 `--api` 標誌",
"Input commands": "",
"Interface": "介面",
"join our Discord for help.": "加入我們的 Discord 尋找幫助。",
"JSON": "JSON",
......@@ -225,6 +239,7 @@
"Manage Ollama Models": "管理 Ollama 模型",
"Max Tokens": "最大 Token 數",
"Maximum of 3 models can be downloaded simultaneously. Please try again later.": "最多可以同時下載 3 個模型。請稍後再試。",
"Messages you send after creating your link won't be shared. Users with the URL will beable to view the shared chat.": "",
"Minimum Score": "",
"Mirostat": "Mirostat",
"Mirostat Eta": "Mirostat Eta",
......@@ -255,6 +270,8 @@
"Name your modelfile": "命名你的 Modelfile",
"New Chat": "新增聊天",
"New Password": "新密碼",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "不確定要新增什麼嗎?",
"Not sure what to write? Switch to": "不確定要寫什麼?切換到",
......@@ -283,6 +300,7 @@
"OpenAI URL/Key required.": "",
"or": "或",
"Other": "",
"Overview": "",
"Parameters": "參數",
"Password": "密碼",
"PDF document (.pdf)": "",
......@@ -297,6 +315,7 @@
"Prompt Content": "提示詞內容",
"Prompt suggestions": "提示詞建議",
"Prompts": "提示詞",
"Pull \"{{searchValue}}\" from Ollama.com": "",
"Pull a model from Ollama.com": "從 Ollama.com 下載模型",
"Pull Progress": "下載進度",
"Query Params": "查詢參數",
......@@ -309,13 +328,17 @@
"Regenerate": "",
"Release Notes": "發布說明",
"Remove": "",
"Remove Model": "",
"Rename": "",
"Repeat Last N": "重複最後 N 次",
"Repeat Penalty": "重複懲罰",
"Request Mode": "請求模式",
"Reranking Model": "",
"Reranking model disabled": "",
"Reranking model set to \"{{reranking_model}}\"": "",
"Reset Vector Storage": "重置向量儲存空間",
"Response AutoCopy to Clipboard": "自動複製回答到剪貼簿",
"Retrieval Augmented Generation Settings": "",
"Role": "Role",
"Rosé Pine": "玫瑰松",
"Rosé Pine Dawn": "黎明玫瑰松",
......@@ -337,12 +360,15 @@
"Select a mode": "選擇模式",
"Select a model": "選擇一個模型",
"Select an Ollama instance": "選擇 Ollama 實例",
"Select model": "",
"Send a Message": "傳送訊息",
"Send message": "傳送訊息",
"Server connection verified": "已驗證伺服器連線",
"Set as default": "設為預設",
"Set Default Model": "設定預設模型",
"Set embedding model (e.g. {{model}})": "",
"Set Image Size": "設定圖片大小",
"Set reranking model (e.g. {{model}})": "",
"Set Steps": "設定步數",
"Set Title Auto-Generation Model": "設定自動生成標題用模型",
"Set Voice": "設定語音",
......@@ -361,6 +387,7 @@
"Sign Out": "登出",
"Sign up": "註冊",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "語音識別錯誤:{{error}}",
"Speech-to-Text Engine": "語音轉文字引擎",
"SpeechRecognition API is not supported in this browser.": "此瀏覽器不支持 SpeechRecognition API。",
......@@ -405,11 +432,7 @@
"Uh-oh! There was an issue connecting to {{provider}}.": "哎呀!連線到 {{provider}} 時出現問題。",
"Unknown File Type '{{file_type}}', but accepting and treating as plain text": "未知的文件類型 '{{file_type}}',但接受並視為純文字",
"Update and Copy Link": "",
"Update Embedding Model": "",
"Update embedding model (e.g. {{model}})": "",
"Update password": "更新密碼",
"Update Reranking Model": "",
"Update reranking model (e.g. {{model}})": "",
"Upload a GGUF model": "上傳一個 GGUF 模型",
"Upload files": "上傳文件",
"Upload Progress": "上傳進度",
......@@ -427,6 +450,7 @@
"Version": "版本",
"Warning: If you update or change your embedding model, you will need to re-import all documents.": "",
"Web": "網頁",
"Web Params": "",
"Webhook URL": "",
"WebUI Add-ons": "WebUI 擴充套件",
"WebUI Settings": "WebUI 設定",
......@@ -437,6 +461,8 @@
"Write a prompt suggestion (e.g. Who are you?)": "寫一個提示詞建議(例如:你是誰?)",
"Write a summary in 50 words that summarizes [topic or keyword].": "寫一個 50 字的摘要來概括 [主題或關鍵詞]。",
"You": "你",
"You have no archived conversations.": "",
"You have shared this chat": "",
"You're a helpful assistant.": "你是一位善於協助他人的助手。",
"You're now logged in.": "已登入。",
"Youtube": ""
......
......@@ -472,29 +472,20 @@ export const blobToFile = (blob, fileName) => {
return file;
};
// promptTemplate replaces any occurrences of the following in the template with the prompt
// {{prompt}} will be replaced with the prompt
// {{prompt:start:<length>}} will be replaced with the first <length> characters of the prompt
// {{prompt:end:<length>}} will be replaced with the last <length> characters of the prompt
// Character length is used as we don't have the ability to tokenize the prompt
export const promptTemplate = (template: string, prompt: string) => {
prompt = prompt.replace(/{{prompt}}|{{prompt:start:\d+}}|{{prompt:end:\d+}}/g, '');
template = template.replace(/{{prompt}}/g, prompt);
// Replace all instances of {{prompt:start:<length>}} with the first <length> characters of the prompt
const startRegex = /{{prompt:start:(\d+)}}/g;
let startMatch: RegExpMatchArray | null;
while ((startMatch = startRegex.exec(template)) !== null) {
const length = parseInt(startMatch[1]);
template = template.replace(startMatch[0], prompt.substring(0, length));
}
template = template.replace(/{{prompt:start:(\d+)}}/g, (match, length) =>
prompt.substring(0, parseInt(length))
);
// Replace all instances of {{prompt:end:<length>}} with the last <length> characters of the prompt
const endRegex = /{{prompt:end:(\d+)}}/g;
let endMatch: RegExpMatchArray | null;
while ((endMatch = endRegex.exec(template)) !== null) {
const length = parseInt(endMatch[1]);
template = template.replace(endMatch[0], prompt.substring(prompt.length - length));
}
template = template.replace(/{{prompt:end:(\d+)}}/g, (match, length) =>
prompt.slice(-parseInt(length))
);
return template;
};
......@@ -520,3 +511,34 @@ export const approximateToHumanReadable = (nanoseconds: number) => {
return results.reverse().join(' ');
};
export const getTimeRange = (timestamp) => {
const now = new Date();
const date = new Date(timestamp * 1000); // Convert Unix timestamp to milliseconds
// Calculate the difference in milliseconds
const diffTime = now.getTime() - date.getTime();
const diffDays = diffTime / (1000 * 3600 * 24);
const nowDate = now.getDate();
const nowMonth = now.getMonth();
const nowYear = now.getFullYear();
const dateDate = date.getDate();
const dateMonth = date.getMonth();
const dateYear = date.getFullYear();
if (nowYear === dateYear && nowMonth === dateMonth && nowDate === dateDate) {
return 'Today';
} else if (nowYear === dateYear && nowMonth === dateMonth && nowDate - dateDate === 1) {
return 'Yesterday';
} else if (diffDays <= 7) {
return 'Previous 7 days';
} else if (diffDays <= 30) {
return 'Previous 30 days';
} else if (nowYear === dateYear) {
return date.toLocaleString('default', { month: 'long' });
} else {
return date.getFullYear().toString();
}
};
......@@ -177,7 +177,7 @@
</script>
<div class=" hidden lg:flex fixed bottom-0 right-0 px-3 py-3 z-10">
<Tooltip content="Help" placement="left">
<Tooltip content={$i18n.t('Help')} placement="left">
<button
id="show-shortcuts-button"
bind:this={showShortcutsButtonElement}
......@@ -201,11 +201,11 @@
>
{#if loaded}
{#if !['user', 'admin'].includes($user.role)}
<div class="fixed w-full h-full flex z-50">
<div class="fixed w-full h-full flex z-[999]">
<div
class="absolute w-full h-full backdrop-blur-md bg-white/20 dark:bg-gray-900/50 flex justify-center"
class="absolute w-full h-full backdrop-blur-lg bg-white/10 dark:bg-gray-900/50 flex justify-center"
>
<div class="m-auto pb-44 flex flex-col justify-center">
<div class="m-auto pb-10 flex flex-col justify-center">
<div class="max-w-md">
<div class="text-center dark:text-white text-2xl font-medium z-50">
Account Activation Pending<br /> Contact Admin for WebUI Access
......
......@@ -134,6 +134,14 @@
selectedModels = [''];
}
if ($page.url.searchParams.get('q')) {
prompt = $page.url.searchParams.get('q') ?? '';
if (prompt) {
await tick();
submitPrompt(prompt);
}
}
selectedModels = selectedModels.map((modelId) =>
$models.map((m) => m.id).includes(modelId) ? modelId : ''
);
......@@ -366,7 +374,8 @@
},
format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
});
if (res && res.ok) {
......@@ -401,6 +410,11 @@
console.log(line);
let data = JSON.parse(line);
if ('citations' in data) {
responseMessage.citations = data.citations;
continue;
}
if ('detail' in data) {
throw data;
}
......@@ -598,7 +612,8 @@
num_ctx: $settings?.options?.num_ctx ?? undefined,
frequency_penalty: $settings?.options?.repeat_penalty ?? undefined,
max_tokens: $settings?.options?.num_predict ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
},
model?.source?.toLowerCase() === 'litellm'
? `${LITELLM_API_BASE_URL}/v1`
......@@ -614,7 +629,7 @@
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
for await (const update of textStream) {
const { value, done } = update;
const { value, done, citations } = update;
if (done || stopResponseFlag || _chatId !== $chatId) {
responseMessage.done = true;
messages = messages;
......@@ -626,6 +641,11 @@
break;
}
if (citations) {
responseMessage.citations = citations;
continue;
}
if (responseMessage.content == '' && value == '\n') {
continue;
} else {
......
......@@ -110,7 +110,7 @@
<div class=" flex flex-col justify-center">
<div class=" px-6 pt-4">
<div class=" flex justify-between items-center">
<div class="flex items-center text-2xl font-semibold">Dashboard</div>
<div class="flex items-center text-2xl font-semibold">{$i18n.t('Dashboard')}</div>
<div>
<Tooltip content={$i18n.t('Admin Settings')}>
<button
......@@ -141,7 +141,9 @@
</div>
<div class="px-6 flex text-sm gap-2.5">
<div class="py-3 border-b font-medium text-gray-100 cursor-pointer">Overview</div>
<div class="py-3 border-b font-medium text-gray-100 cursor-pointer">
{$i18n.t('Overview')}
</div>
<!-- <div class="py-3 text-gray-300 cursor-pointer">Users</div> -->
</div>
......@@ -268,7 +270,7 @@
<td class="px-3 py-2 text-right">
<div class="flex justify-end w-full">
{#if user.role !== 'admin'}
<Tooltip content="Chats">
<Tooltip content={$i18n.t('Chats')}>
<button
class="self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
on:click={async () => {
......
......@@ -378,7 +378,8 @@
},
format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
});
if (res && res.ok) {
......@@ -413,6 +414,11 @@
console.log(line);
let data = JSON.parse(line);
if ('citations' in data) {
responseMessage.citations = data.citations;
continue;
}
if ('detail' in data) {
throw data;
}
......@@ -610,7 +616,8 @@
num_ctx: $settings?.options?.num_ctx ?? undefined,
frequency_penalty: $settings?.options?.repeat_penalty ?? undefined,
max_tokens: $settings?.options?.num_predict ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
},
model?.source?.toLowerCase() === 'litellm'
? `${LITELLM_API_BASE_URL}/v1`
......@@ -626,7 +633,7 @@
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
for await (const update of textStream) {
const { value, done } = update;
const { value, done, citations } = update;
if (done || stopResponseFlag || _chatId !== $chatId) {
responseMessage.done = true;
messages = messages;
......@@ -638,6 +645,11 @@
break;
}
if (citations) {
responseMessage.citations = citations;
continue;
}
if (responseMessage.content == '' && value == '\n') {
continue;
} else {
......
......@@ -81,7 +81,7 @@
</div>
</div>
<div class=" bg-white dark:bg-gray-900 min-h-screen w-full flex justify-center font-mona">
<div class=" bg-white dark:bg-gray-950 min-h-screen w-full flex justify-center font-mona">
<!-- <div class="hidden lg:flex lg:flex-1 px-10 md:px-16 w-full bg-yellow-50 justify-center">
<div class=" my-auto pb-16 text-left">
<div>
......@@ -96,7 +96,7 @@
</div>
</div> -->
<div class="w-full sm:max-w-lg px-4 min-h-screen flex flex-col">
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
{#if $config?.trusted_header_auth ?? false}
<div class=" my-auto pb-10 w-full">
<div
......@@ -114,27 +114,29 @@
</div>
</div>
{:else}
<div class=" my-auto pb-10 w-full">
<div class=" my-auto pb-10 w-full dark:text-gray-100">
<form
class=" flex flex-col justify-center bg-white py-6 sm:py-16 px-6 sm:px-16 rounded-2xl"
class=" flex flex-col justify-center"
on:submit|preventDefault={() => {
submitHandler();
}}
>
<div class=" text-xl sm:text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$i18n.t('to')}
{$WEBUI_NAME}
</div>
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
<div class="mb-1">
<div class=" text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$i18n.t('to')}
{$WEBUI_NAME}
</div>
{/if}
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div>
{/if}
</div>
<div class="flex flex-col mt-4">
{#if mode === 'signup'}
......@@ -143,14 +145,14 @@
<input
bind:value={name}
type="text"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
autocomplete="name"
placeholder={$i18n.t('Enter Your Full Name')}
required
/>
</div>
<hr class=" my-3" />
<hr class=" my-3 dark:border-gray-900" />
{/if}
<div class="mb-2">
......@@ -158,7 +160,7 @@
<input
bind:value={email}
type="email"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
autocomplete="email"
placeholder={$i18n.t('Enter Your Email')}
required
......@@ -167,10 +169,11 @@
<div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<input
bind:value={password}
type="password"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
placeholder={$i18n.t('Enter Your Password')}
autocomplete="current-password"
required
......@@ -180,7 +183,7 @@
<div class="mt-5">
<button
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-full text-white font-semibold text-sm py-3 transition"
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-2xl text-white font-semibold text-sm py-3 transition"
type="submit"
>
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
......
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Open WebUI</ShortName>
<Description>Search Open WebUI</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://localhost:5137/favicon.png</Image>
<Url type="text/html" method="get" template="http://localhost:5137/?q={searchTerms}"/>
<moz:SearchForm>http://localhost:5137</moz:SearchForm>
</OpenSearchDescription>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment