diff --git a/docs/.vitepress/theme/components/VocabQuiz.vue b/docs/.vitepress/theme/components/VocabQuiz.vue
index 2e41078..6a15af9 100644
--- a/docs/.vitepress/theme/components/VocabQuiz.vue
+++ b/docs/.vitepress/theme/components/VocabQuiz.vue
@@ -67,13 +67,23 @@
-
-
+
+
+
+
+
+
+
@@ -168,7 +178,7 @@ const vaud = useTemplateRef>("vaud");
const v = computed(() => vList.value[vIndex.value]);
const example = computed(() => {
- if (!v.value.examples?.length) return null;
+ if (!v.value?.examples?.length) return null;
const ex = v.value.examples;
return ex[exIndex.value];
});
@@ -200,6 +210,25 @@ watch(quizState, () => {
saveQuizState();
});
+watch(example, () => {
+ exNotes.value = "";
+ if (!example.value) return;
+
+ if (supabase) {
+ let { ko } = example.value;
+ ko = ko.replaceAll("**", "");
+
+ supabase
+ .from("sentence-explain")
+ .select("explain")
+ .eq("ko", ko)
+ .then((r) => {
+ if (!r.data?.[0]) return;
+ exNotes.value = r.data[0].explain;
+ });
+ }
+});
+
const vocabulary: Record = {};
for (const [k, vs] of Object.entries(
@@ -400,7 +429,9 @@ const markdownIt = new MarkdownIt({
typographer: true,
});
-async function explainSentence(s: string) {
+async function explainSentence(ko: string) {
+ ko = ko.replaceAll("**", "");
+
for await (const data of LLMstream({
model: "deepseek-v4-flash",
messages: [
@@ -409,14 +440,29 @@ async function explainSentence(s: string) {
content:
"Explain how this sentence works in 500 characters. Give key vocabularies.",
},
- { role: "user", content: s },
+ { role: "user", content: ko },
],
})) {
- if (data.done) return;
+ if (data.done) break;
if (data.content) {
exNotes.value += data.content;
}
}
+
+ if (supabase) {
+ console.log(supabase);
+ const user_id = await supabase.auth.getUser().then((r) => r.data.user?.id);
+ console.log(user_id);
+
+ await supabase.from("sentence-explain").upsert(
+ {
+ user_id,
+ ko,
+ explain: exNotes.value,
+ },
+ { onConflict: "ko,user_id" },
+ );
+ }
}
function onModalClickOutside(ev: MouseEvent) {
diff --git a/docs/howtostudykorean/unit-1/20-well-poorly.md b/docs/howtostudykorean/unit-1/20-well-poorly.md
index 824bf90..b579478 100644
--- a/docs/howtostudykorean/unit-1/20-well-poorly.md
+++ b/docs/howtostudykorean/unit-1/20-well-poorly.md
@@ -71,7 +71,7 @@ vocabulary:
audio: https://www.howtostudykorean.com/wp-content/uploads/2015/11/Lesson20v6.mp3
en: powder
examples:
- - ko: 케이크 반죽에 **밀가루**를 넣으세요
+ - ko: 케이크 반죽에 밀**가루**를 넣으세요
en: Put some **flour** into the cake batter, please
- ko: 봄에는 꽃**가루** 알레르기를 조심해 야 해요
en: You need to be careful about **pollen** allergies in the spring