forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

rag-copy.ts140 lines, 5.9 KiBHistoryRawDownload
1import type { Locale } from "@/i18n/messages";
2
3/**
4 * The documented abstention codes (`guard_*`, `insufficient_data`,
5 * `model_abstained`, `empty_scope`) in plain words; an unknown code is shown
6 * as it came rather than guessed at.
7 */
8function reasonText(locale: Locale, reason: string): string {
9 const tr = locale === "tr";
10 if (reason === "insufficient_data") return tr ? "ders içeriklerinde bunu yanıtlayacak kadar bilgi yok" : "the course material does not cover this enough";
11 if (reason === "model_abstained") return tr ? "yapay zekâ bunu güvenle yanıtlayamadı" : "the AI could not answer this confidently";
12 if (reason === "empty_scope") return tr ? "çalışılacak bir aralık seçilmedi" : "no range was selected to study";
13 if (reason.startsWith("guard_")) return tr ? "soru içerik kurallarına takıldı" : "the question was stopped by the content rules";
14 return reason;
15}
16
17const copy = {
18 en: {
19 title: "Ask your notes",
20 newThread: "New chat",
21 history: "Chat history",
22 untitled: "Untitled chat",
23 emptyThreads: "No chats yet",
24 emptyThreadsHint: "Start a new chat to ask the course corpus a question.",
25 emptyChat: "What would you like to learn?",
26 emptyChatHint: "Answers use only the course material available to your account.",
27 placeholder: "Ask a question about your course notes…",
28 send: "Send",
29 composerHint: "Enter to send · Shift+Enter for a new line",
30 thinking: "Searching your course material…",
31 thinking2: "Reading the sources…",
32 thinking3: "Preparing the answer…",
33 copy: "Copy",
34 copied: "Copied",
35 retry: "Ask again",
36 scrollToLatest: "Latest",
37 newMessages: "New message",
38 groupToday: "Today",
39 groupYesterday: "Yesterday",
40 groupThisWeek: "This week",
41 groupEarlier: "Earlier",
42 sources: "Sources",
43 source: "Source",
44 subject: "Subject",
45 pages: "Pages",
46 document: "Course document",
47 rename: "Rename chat",
48 actions: "Chat actions",
49 renameHint: "Give this chat a short, recognisable name.",
50 renameLabel: "Chat name",
51 renamePlaceholder: "e.g. Newton's laws",
52 delete: "Delete chat",
53 deleteHint: "This permanently deletes the chat and all of its messages.",
54 deleteConfirm: "Delete chat",
55 failed: "The answer could not be completed. Please try again.",
56 failedWithCode: (code: string) => `The answer could not be completed (${code}). Please try again.`,
57 abstained: "There was not enough course material to answer this question confidently.",
58 abstainedReason: (reason: string) => `Reason: ${reasonText("en", reason)}`,
59 loadingMessages: "Loading messages…",
60 tabLabel: "Study",
61 studyFrom: (ders: string) => `Study these ${ders} passages`,
62 summarize: "Summarize",
63 practice: "Practice questions",
64 difficulty: "Difficulty",
65 difficultyEasy: "Easy",
66 difficultyMedium: "Medium",
67 difficultyHard: "Hard",
68 summaryTitle: "Summary",
69 questionsTitle: "Practice questions",
70 showAnswer: "Show answer",
71 working: "Working on it…",
72 coveredPages: (pages: string) => `Pages covered: ${pages}`,
73 studyUnavailable: "Summaries and practice questions are not available right now; the AI service for them is not connected.",
74 studyFailed: (reason: string) => `This could not be prepared: ${reason}`,
75 noQuestions: "No questions could be drawn from these passages.",
76 },
77 tr: {
78 title: "Notlarına sor",
79 newThread: "Yeni sohbet",
80 history: "Sohbet geçmişi",
81 untitled: "Başlıksız sohbet",
82 emptyThreads: "Henüz sohbet yok",
83 emptyThreadsHint: "Ders arşivine soru sormak için yeni bir sohbet başlat.",
84 emptyChat: "Ne öğrenmek istersin?",
85 emptyChatHint: "Yanıtlar yalnızca hesabının erişebildiği ders içeriklerini kullanır.",
86 placeholder: "Ders notların hakkında bir soru sor…",
87 send: "Gönder",
88 composerHint: "Göndermek için Enter · Yeni satır için Shift+Enter",
89 thinking: "Ders içeriklerinde aranıyor…",
90 thinking2: "Kaynaklar taranıyor…",
91 thinking3: "Yanıt hazırlanıyor…",
92 copy: "Kopyala",
93 copied: "Kopyalandı",
94 retry: "Tekrar sor",
95 scrollToLatest: "En son",
96 newMessages: "Yeni mesaj",
97 groupToday: "Bugün",
98 groupYesterday: "Dün",
99 groupThisWeek: "Bu hafta",
100 groupEarlier: "Daha önce",
101 sources: "Kaynaklar",
102 source: "Kaynak",
103 subject: "Ders",
104 pages: "Sayfalar",
105 document: "Ders belgesi",
106 rename: "Sohbeti yeniden adlandır",
107 actions: "Sohbet işlemleri",
108 renameHint: "Bu sohbete kısa ve ayırt edilebilir bir ad ver.",
109 renameLabel: "Sohbet adı",
110 renamePlaceholder: "Örn. Newton yasaları",
111 delete: "Sohbeti sil",
112 deleteHint: "Bu işlem sohbeti ve tüm mesajlarını kalıcı olarak siler.",
113 deleteConfirm: "Sohbeti sil",
114 failed: "Yanıt tamamlanamadı. Lütfen tekrar dene.",
115 failedWithCode: (code: string) => `Yanıt tamamlanamadı (${code}). Lütfen tekrar dene.`,
116 abstained: "Bu soruyu güvenle yanıtlamak için yeterli ders içeriği bulunamadı.",
117 abstainedReason: (reason: string) => `Neden: ${reasonText("tr", reason)}`,
118 loadingMessages: "Mesajlar yükleniyor…",
119 tabLabel: "Çalış",
120 studyFrom: (ders: string) => `Bu ${ders} kaynaklarıyla çalış`,
121 summarize: "Özetle",
122 practice: "Soru üret",
123 difficulty: "Zorluk",
124 difficultyEasy: "Kolay",
125 difficultyMedium: "Orta",
126 difficultyHard: "Zor",
127 summaryTitle: "Özet",
128 questionsTitle: "Pratik sorular",
129 showAnswer: "Cevabı göster",
130 working: "Hazırlanıyor…",
131 coveredPages: (pages: string) => `Kapsanan sayfalar: ${pages}`,
132 studyUnavailable: "Özet ve soru üretimi şu an kullanılamıyor; bunlar için yapay zekâ servisi bağlı değil.",
133 studyFailed: (reason: string) => `Hazırlanamadı: ${reason}`,
134 noQuestions: "Bu kaynaklardan soru çıkarılamadı.",
135 },
136} as const;
137
138export function ragCopy(locale: Locale) {
139 return copy[locale];
140}