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

Merge pull request #2011 from cheahjs/feat/rag-citations

feat: show RAG query results as citations
parents ba09fcd5 c84e0aa2
......@@ -73,6 +73,7 @@
"Chunk Overlap": "გადახურვა ფრაგმენტულია",
"Chunk Params": "გადახურვის პარამეტრები",
"Chunk Size": "გადახურვის ზომა",
"Citation": "",
"Click here for help.": "დახმარებისთვის, დააკლიკე აქ",
"Click here to": "",
"Click here to check other modelfiles.": "სხვა მოდელური ფაილების სანახავად, დააკლიკე აქ",
......@@ -270,6 +271,7 @@
"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": "არ იცი რა დაწერო? გადართვა:",
......@@ -385,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.": "მეტყველების ამოცნობის API არ არის მხარდაჭერილი ამ ბრაუზერში.",
......
......@@ -73,6 +73,7 @@
"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.": "다른 모델파일을 확인하려면 여기를 클릭하세요.",
......@@ -270,6 +271,7 @@
"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": "무엇을 쓸지 모르겠나요? 전환하세요.",
......@@ -385,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를 지원하지 않습니다.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Chunk Overlap",
"Chunk Params": "Chunk Params",
"Chunk Size": "Chunk Grootte",
"Citation": "",
"Click here for help.": "Klik hier voor help.",
"Click here to": "",
"Click here to check other modelfiles.": "Klik hier om andere modelfiles te controleren.",
......@@ -270,6 +271,7 @@
"New Chat": "Nieuwe Chat",
"New Password": "Nieuw Wachtwoord",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "Niet zeker wat toe te voegen?",
"Not sure what to write? Switch to": "Niet zeker wat te schrijven? Schakel over naar",
......@@ -385,6 +387,7 @@
"Sign Out": "Uitloggen",
"Sign up": "Registreren",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Spraakherkenning fout: {{error}}",
"Speech-to-Text Engine": "Spraak-naar-tekst Engine",
"SpeechRecognition API is not supported in this browser.": "SpeechRecognition API wordt niet ondersteund in deze browser.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Zachodzenie bloku",
"Chunk Params": "Parametry bloku",
"Chunk Size": "Rozmiar bloku",
"Citation": "",
"Click here for help.": "Kliknij tutaj, aby uzyskać pomoc.",
"Click here to": "",
"Click here to check other modelfiles.": "Kliknij tutaj, aby sprawdzić inne pliki modelowe.",
......@@ -270,6 +271,7 @@
"New Chat": "Nowy czat",
"New Password": "Nowe hasło",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "Nie wiesz, co dodać?",
"Not sure what to write? Switch to": "Nie wiesz, co napisać? Przełącz się na",
......@@ -385,6 +387,7 @@
"Sign Out": "Wyloguj się",
"Sign up": "Zarejestruj się",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Błąd rozpoznawania mowy: {{error}}",
"Speech-to-Text Engine": "Silnik mowy na tekst",
"SpeechRecognition API is not supported in this browser.": "API Rozpoznawania Mowy nie jest obsługiwane w tej przeglądarce.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Sobreposição de Fragmento",
"Chunk Params": "Parâmetros de Fragmento",
"Chunk Size": "Tamanho do Fragmento",
"Citation": "",
"Click here for help.": "Clique aqui para obter ajuda.",
"Click here to": "",
"Click here to check other modelfiles.": "Clique aqui para verificar outros arquivos de modelo.",
......@@ -270,6 +271,7 @@
"New Chat": "Novo Bate-papo",
"New Password": "Nova Senha",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "Não tem certeza do que adicionar?",
"Not sure what to write? Switch to": "Não tem certeza do que escrever? Mude para",
......@@ -385,6 +387,7 @@
"Sign Out": "Sair",
"Sign up": "Inscrever-se",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Erro de reconhecimento de fala: {{error}}",
"Speech-to-Text Engine": "Mecanismo de Fala para Texto",
"SpeechRecognition API is not supported in this browser.": "A API SpeechRecognition não é suportada neste navegador.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Sobreposição de Fragmento",
"Chunk Params": "Parâmetros de Fragmento",
"Chunk Size": "Tamanho do Fragmento",
"Citation": "",
"Click here for help.": "Clique aqui para obter ajuda.",
"Click here to": "",
"Click here to check other modelfiles.": "Clique aqui para verificar outros arquivos de modelo.",
......@@ -270,6 +271,7 @@
"New Chat": "Novo Bate-papo",
"New Password": "Nova Senha",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "Não tem certeza do que adicionar?",
"Not sure what to write? Switch to": "Não tem certeza do que escrever? Mude para",
......@@ -385,6 +387,7 @@
"Sign Out": "Sair",
"Sign up": "Inscrever-se",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Erro de reconhecimento de fala: {{error}}",
"Speech-to-Text Engine": "Mecanismo de Fala para Texto",
"SpeechRecognition API is not supported in this browser.": "A API SpeechRecognition não é suportada neste navegador.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Перекрытие фрагментов",
"Chunk Params": "Параметры фрагментов",
"Chunk Size": "Размер фрагмента",
"Citation": "",
"Click here for help.": "Нажмите здесь для помощь.",
"Click here to": "",
"Click here to check other modelfiles.": "Нажмите тут чтобы проверить другие файлы моделей.",
......@@ -270,6 +271,7 @@
"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": "Не уверены, что написать? Переключитесь на",
......@@ -385,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.": "API распознавания речи не поддерживается в этом браузере.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Överlappning",
"Chunk Params": "Chunk-parametrar",
"Chunk Size": "Chunk-storlek",
"Citation": "",
"Click here for help.": "Klicka här för hjälp.",
"Click here to": "",
"Click here to check other modelfiles.": "Klicka här för att kontrollera andra modelfiler.",
......@@ -270,6 +271,7 @@
"New Chat": "Ny chatt",
"New Password": "Nytt lösenord",
"No results found": "",
"No source available": "",
"Not factually correct": "",
"Not sure what to add?": "Inte säker på vad du ska lägga till?",
"Not sure what to write? Switch to": "Inte säker på vad du ska skriva? Växla till",
......@@ -385,6 +387,7 @@
"Sign Out": "Logga ut",
"Sign up": "Registrera dig",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Fel vid taligenkänning: {{error}}",
"Speech-to-Text Engine": "Tal-till-text-motor",
"SpeechRecognition API is not supported in this browser.": "SpeechRecognition API stöds inte i denna webbläsare.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Chunk Çakışması",
"Chunk Params": "Chunk Parametreleri",
"Chunk Size": "Chunk Boyutu",
"Citation": "",
"Click here for help.": "Yardım için buraya tıklayın.",
"Click here to": "",
"Click here to check other modelfiles.": "Diğer model dosyalarını kontrol etmek için buraya tıklayın.",
......@@ -270,6 +271,7 @@
"New Chat": "Yeni Sohbet",
"New Password": "Yeni Parola",
"No results found": "",
"No source available": "",
"Not factually correct": "Gerçeklere göre doğru değil",
"Not sure what to add?": "Ne ekleyeceğinizden emin değil misiniz?",
"Not sure what to write? Switch to": "Ne yazacağınızdan emin değil misiniz? Şuraya geçin",
......@@ -385,6 +387,7 @@
"Sign Out": "Çıkış Yap",
"Sign up": "Kaydol",
"Signing in": "Oturum açma",
"Source": "",
"Speech recognition error: {{error}}": "Konuşma tanıma hatası: {{error}}",
"Speech-to-Text Engine": "Konuşmadan Metne Motoru",
"SpeechRecognition API is not supported in this browser.": "SpeechRecognition API bu tarayıcıda desteklenmiyor.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Перекриття фрагментів",
"Chunk Params": "Параметри фрагментів",
"Chunk Size": "Розмір фрагменту",
"Citation": "",
"Click here for help.": "Клацніть тут, щоб отримати допомогу.",
"Click here to": "",
"Click here to check other modelfiles.": "Клацніть тут, щоб перевірити інші файли моделей.",
......@@ -270,6 +271,7 @@
"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": "Не впевнений, що писати? Переключитися на",
......@@ -385,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 не підтримується в цьому браузері.",
......
......@@ -73,6 +73,7 @@
"Chunk Overlap": "Chồng lấn (overlap)",
"Chunk Params": "Cài đặt số lượng ký tự cho khối ký tự (chunk)",
"Chunk Size": "Kích thước khối (size)",
"Citation": "",
"Click here for help.": "Bấm vào đây để được trợ giúp.",
"Click here to": "",
"Click here to check other modelfiles.": "Bấm vào đây để kiểm tra các tệp mô tả mô hình (modelfiles) khác.",
......@@ -270,6 +271,7 @@
"New Chat": "Tạo cuộc trò chuyện mới",
"New Password": "Mật khẩu mới",
"No results found": "",
"No source available": "",
"Not factually correct": "Không chính xác so với thực tế",
"Not sure what to add?": "Không chắc phải thêm gì?",
"Not sure what to write? Switch to": "Không chắc phải viết gì? Chuyển sang",
......@@ -385,6 +387,7 @@
"Sign Out": "Đăng xuất",
"Sign up": "Đăng ký",
"Signing in": "",
"Source": "",
"Speech recognition error: {{error}}": "Lỗi nhận dạng giọng nói: {{error}}",
"Speech-to-Text Engine": "Công cụ Nhận dạng Giọng nói",
"SpeechRecognition API is not supported in this browser.": "Trình duyệt này không hỗ trợ API Nhận dạng Giọng nói.",
......
......@@ -73,6 +73,7 @@
"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.": "点击这里检查其他模型文件。",
......@@ -270,6 +271,7 @@
"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": "不确定写什么?切换到",
......@@ -385,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。",
......
......@@ -73,6 +73,7 @@
"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。",
......@@ -270,6 +271,7 @@
"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": "不確定要寫什麼?切換到",
......@@ -385,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。",
......
......@@ -366,7 +366,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 +402,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 +604,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 +621,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 +633,11 @@
break;
}
if (citations) {
responseMessage.citations = citations;
continue;
}
if (responseMessage.content == '' && value == '\n') {
continue;
} else {
......
......@@ -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 {
......
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