Commit 5e1c4089 authored by Jun Siang Cheah's avatar Jun Siang Cheah
Browse files

Merge branch 'dev' into feat/backend-web-search

parents f49e1afa 233dcb2d
......@@ -12,9 +12,9 @@
"lint:frontend": "eslint . --fix",
"lint:types": "npm run check",
"lint:backend": "pylint backend/",
"format": "prettier --plugin-search-dir --write '**/*.{js,ts,svelte,css,md,html,json}'",
"format": "prettier --plugin-search-dir --write \"**/*.{js,ts,svelte,css,md,html,json}\"",
"format:backend": "black . --exclude \"/venv/\"",
"i18n:parse": "i18next --config i18next-parser.config.ts && prettier --write 'src/lib/i18n/**/*.{js,json}'",
"i18n:parse": "i18next --config i18next-parser.config.ts && prettier --write \"src/lib/i18n/**/*.{js,json}\"",
"cy:open": "cypress open"
},
"devDependencies": {
......
......@@ -6,6 +6,8 @@ type TextStreamUpdate = {
value: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
citations?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error?: any;
};
// createOpenAITextStream takes a responseBody with a SSE response,
......@@ -47,6 +49,11 @@ async function* openAIStreamToIterator(
const parsedData = JSON.parse(data);
console.log(parsedData);
if (parsedData.error) {
yield { done: true, value: '', error: parsedData.error };
break;
}
if (parsedData.citations) {
yield { done: false, value: '', citations: parsedData.citations };
continue;
......
......@@ -309,31 +309,33 @@
copyToClipboard={copyToClipboardWithToast}
/>
{:else}
<ResponseMessage
{message}
modelfiles={selectedModelfiles}
siblings={history.messages[message.parentId]?.childrenIds ?? []}
isLastMessage={messageIdx + 1 === messages.length}
{readOnly}
{updateChatMessages}
{confirmEditResponseMessage}
{showPreviousMessage}
{showNextMessage}
{rateMessage}
copyToClipboard={copyToClipboardWithToast}
{continueGeneration}
{regenerateResponse}
on:save={async (e) => {
console.log('save', e);
const message = e.detail;
history.messages[message.id] = message;
await updateChatById(localStorage.token, chatId, {
messages: messages,
history: history
});
}}
/>
{#key message.id}
<ResponseMessage
{message}
modelfiles={selectedModelfiles}
siblings={history.messages[message.parentId]?.childrenIds ?? []}
isLastMessage={messageIdx + 1 === messages.length}
{readOnly}
{updateChatMessages}
{confirmEditResponseMessage}
{showPreviousMessage}
{showNextMessage}
{rateMessage}
copyToClipboard={copyToClipboardWithToast}
{continueGeneration}
{regenerateResponse}
on:save={async (e) => {
console.log('save', e);
const message = e.detail;
history.messages[message.id] = message;
await updateChatById(localStorage.token, chatId, {
messages: messages,
history: history
});
}}
/>
{/key}
{/if}
</div>
</div>
......
......@@ -39,9 +39,9 @@
let selectedReason = null;
let comment = '';
$: if (message.annotation.rating === 1) {
$: if (message?.annotation?.rating === 1) {
reasons = LIKE_REASONS;
} else if (message.annotation.rating === -1) {
} else if (message?.annotation?.rating === -1) {
reasons = DISLIKE_REASONS;
}
......
......@@ -65,8 +65,8 @@
let generatingImage = false;
let showRateComment = false;
let showCitationModal = false;
let selectedCitation = null;
$: tokens = marked.lexer(sanitizeResponseContent(message.content));
......@@ -1006,7 +1006,7 @@
</div>
{/if}
{#if showRateComment}
{#if message.done && showRateComment}
<RateComment
messageId={message.id}
bind:show={showRateComment}
......
......@@ -37,7 +37,7 @@ const createIsLoadingStore = (i18n: i18nType) => {
return isLoading;
};
export const initI18n = (defaultLocale: string) => {
export const initI18n = (defaultLocale: string | undefined) => {
let detectionOrder = defaultLocale
? ['querystring', 'localStorage']
: ['querystring', 'localStorage', 'navigator'];
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "Superposición de fragmentos",
"Chunk Params": "Parámetros de fragmentos",
"Chunk Size": "Tamaño de fragmentos",
"Citation": "",
"Citation": "Cita",
"Click here for help.": "Presiona aquí para obtener ayuda.",
"Click here to": "",
"Click here to check other modelfiles.": "Presiona aquí para consultar otros modelfiles.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "No hay fuente disponible",
"Not factually correct": "",
"Not sure what to add?": "¿No sabes qué añadir?",
"Not sure what to write? Switch to": "¿No sabes qué escribir? Cambia a",
......@@ -413,7 +413,7 @@
"Sign Out": "Cerrar sesión",
"Sign up": "Crear una cuenta",
"Signing in": "",
"Source": "",
"Source": "Fuente",
"Speech recognition error: {{error}}": "Error de reconocimiento de voz: {{error}}",
"Speech-to-Text Engine": "Motor de voz a texto",
"SpeechRecognition API is not supported in this browser.": "La API SpeechRecognition no es compatible con este navegador.",
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "همپوشانی تکه",
"Chunk Params": "پارامترهای تکه",
"Chunk Size": "اندازه تکه",
"Citation": "",
"Citation": "استناد",
"Click here for help.": "برای کمک اینجا را کلیک کنید.",
"Click here to": "",
"Click here to check other modelfiles.": "برای بررسی سایر فایل\u200cهای مدل اینجا را کلیک کنید.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "منبعی در دسترس نیست",
"Not factually correct": "",
"Not sure what to add?": "مطمئن نیستید چه چیزی را اضافه کنید؟",
"Not sure what to write? Switch to": "مطمئن نیستید چه بنویسید؟ تغییر به",
......@@ -413,7 +413,7 @@
"Sign Out": "خروج",
"Sign up": "ثبت نام",
"Signing in": "",
"Source": "",
"Source": "منبع",
"Speech recognition error: {{error}}": "خطای تشخیص گفتار: {{error}}",
"Speech-to-Text Engine": "موتور گفتار به متن",
"SpeechRecognition API is not supported in this browser.": "API تشخیص گفتار در این مرورگر پشتیبانی نمی شود.",
......
This diff is collapsed.
......@@ -77,7 +77,7 @@
"Chunk Overlap": "Sovrapposizione chunk",
"Chunk Params": "Parametri chunk",
"Chunk Size": "Dimensione chunk",
"Citation": "",
"Citation": "Citazione",
"Click here for help.": "Clicca qui per aiuto.",
"Click here to": "",
"Click here to check other modelfiles.": "Clicca qui per controllare altri file modello.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "Nessuna fonte disponibile",
"Not factually correct": "",
"Not sure what to add?": "Non sei sicuro di cosa aggiungere?",
"Not sure what to write? Switch to": "Non sei sicuro di cosa scrivere? Passa a",
......@@ -413,7 +413,7 @@
"Sign Out": "Esci",
"Sign up": "Registrati",
"Signing in": "",
"Source": "",
"Source": "Fonte",
"Speech recognition error: {{error}}": "Errore di riconoscimento vocale: {{error}}",
"Speech-to-Text Engine": "Motore da voce a testo",
"SpeechRecognition API is not supported in this browser.": "L'API SpeechRecognition non è supportata in questo browser.",
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "チャンクオーバーラップ",
"Chunk Params": "チャンクパラメーター",
"Chunk Size": "チャンクサイズ",
"Citation": "",
"Citation": "引用文",
"Click here for help.": "ヘルプについてはここをクリックしてください。",
"Click here to": "",
"Click here to check other modelfiles.": "他のモデルファイルを確認するにはここをクリックしてください。",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "使用可能なソースがありません",
"Not factually correct": "",
"Not sure what to add?": "何を追加すればよいかわからない?",
"Not sure what to write? Switch to": "何を書けばよいかわからない? 次に切り替える",
......@@ -413,7 +413,7 @@
"Sign Out": "サインアウト",
"Sign up": "サインアップ",
"Signing in": "",
"Source": "",
"Source": "ソース",
"Speech recognition error: {{error}}": "音声認識エラー: {{error}}",
"Speech-to-Text Engine": "音声テキスト変換エンジン",
"SpeechRecognition API is not supported in this browser.": "このブラウザでは SpeechRecognition API がサポートされていません。",
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "გადახურვა ფრაგმენტულია",
"Chunk Params": "გადახურვის პარამეტრები",
"Chunk Size": "გადახურვის ზომა",
"Citation": "",
"Citation": "ციტატა",
"Click here for help.": "დახმარებისთვის, დააკლიკე აქ",
"Click here to": "",
"Click here to check other modelfiles.": "სხვა მოდელური ფაილების სანახავად, დააკლიკე აქ",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "წყარო არ არის ხელმისაწვდომი",
"Not factually correct": "",
"Not sure what to add?": "არ იცი რა დაამატო?",
"Not sure what to write? Switch to": "არ იცი რა დაწერო? გადართვა:",
......@@ -413,7 +413,7 @@
"Sign Out": "გასვლა",
"Sign up": "რეგისტრაცია",
"Signing in": "",
"Source": "",
"Source": "წყარო",
"Speech recognition error: {{error}}": "მეტყველების ამოცნობის შეცდომა: {{error}}",
"Speech-to-Text Engine": "ხმოვან-ტექსტური ძრავი",
"SpeechRecognition API is not supported in this browser.": "მეტყველების ამოცნობის API არ არის მხარდაჭერილი ამ ბრაუზერში.",
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "Chunk Overlap",
"Chunk Params": "Chunk Params",
"Chunk Size": "Chunk Size",
"Citation": "",
"Citation": "인용",
"Click here for help.": "도움말을 보려면 여기를 클릭하세요.",
"Click here to": "",
"Click here to check other modelfiles.": "다른 모델파일을 확인하려면 여기를 클릭하세요.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "사용 가능한 소스 없음",
"Not factually correct": "",
"Not sure what to add?": "추가할 것이 궁금하세요?",
"Not sure what to write? Switch to": "무엇을 쓸지 모르겠나요? 전환하세요.",
......@@ -413,7 +413,7 @@
"Sign Out": "로그아웃",
"Sign up": "가입",
"Signing in": "",
"Source": "",
"Source": "출처",
"Speech recognition error: {{error}}": "음성 인식 오류: {{error}}",
"Speech-to-Text Engine": "음성-텍스트 엔진",
"SpeechRecognition API is not supported in this browser.": "이 브라우저에서는 SpeechRecognition API를 지원하지 않습니다.",
......
......@@ -47,6 +47,10 @@
"code": "fr-FR",
"title": "French (France)"
},
{
"code": "he-IL",
"title": "עברית (Hebrew)"
},
{
"code": "hi-IN",
"title": "Hindi (हिंदी)"
......
This diff is collapsed.
......@@ -77,8 +77,8 @@
"Chunk Overlap": "Chunk Overlap",
"Chunk Params": "Chunk Params",
"Chunk Size": "Chunk Grootte",
"Citation": "",
"Click here for help.": "Klik hier voor help.",
"Citation": "Citaat",
"Click here for help.": "Klik hier voor hulp.",
"Click here to": "",
"Click here to check other modelfiles.": "Klik hier om andere modelfiles te controleren.",
"Click here to select": "Klik hier om te selecteren",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "Geen bron beschikbaar",
"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",
......@@ -413,7 +413,7 @@
"Sign Out": "Uitloggen",
"Sign up": "Registreren",
"Signing in": "",
"Source": "",
"Source": "Bron",
"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.",
......
This diff is collapsed.
......@@ -77,7 +77,7 @@
"Chunk Overlap": "Sobreposição de Fragmento",
"Chunk Params": "Parâmetros de Fragmento",
"Chunk Size": "Tamanho do Fragmento",
"Citation": "",
"Citation": "Citação",
"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.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "Nenhuma fonte disponível",
"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",
......@@ -413,7 +413,7 @@
"Sign Out": "Sair",
"Sign up": "Inscrever-se",
"Signing in": "",
"Source": "",
"Source": "Fonte",
"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.",
......
......@@ -77,7 +77,7 @@
"Chunk Overlap": "Sobreposição de Fragmento",
"Chunk Params": "Parâmetros de Fragmento",
"Chunk Size": "Tamanho do Fragmento",
"Citation": "",
"Citation": "Citação",
"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.",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "Nenhuma fonte disponível",
"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",
......@@ -413,7 +413,7 @@
"Sign Out": "Sair",
"Sign up": "Inscrever-se",
"Signing in": "",
"Source": "",
"Source": "Fonte",
"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.",
......
......@@ -77,8 +77,8 @@
"Chunk Overlap": "Перекрытие фрагментов",
"Chunk Params": "Параметры фрагментов",
"Chunk Size": "Размер фрагмента",
"Citation": "",
"Click here for help.": "Нажмите здесь для помощь.",
"Citation": "Цитата",
"Click here for help.": "Нажмите здесь для помощи.",
"Click here to": "",
"Click here to check other modelfiles.": "Нажмите тут чтобы проверить другие файлы моделей.",
"Click here to select": "Нажмите тут чтобы выберите",
......@@ -289,7 +289,7 @@
"No results found": "",
"No search query generated": "",
"No search results found": "",
"No source available": "",
"No source available": "Нет доступных источников",
"Not factually correct": "",
"Not sure what to add?": "Не уверены, что добавить?",
"Not sure what to write? Switch to": "Не уверены, что написать? Переключитесь на",
......@@ -413,7 +413,7 @@
"Sign Out": "Выход",
"Sign up": "зарегистрировать",
"Signing in": "",
"Source": "",
"Source": "Источник",
"Speech recognition error: {{error}}": "Ошибка распознавания речи: {{error}}",
"Speech-to-Text Engine": "Система распознавания речи",
"SpeechRecognition API is not supported in this browser.": "API распознавания речи не поддерживается в этом браузере.",
......
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