blob: 58127156691c64fc39e2812bd6d1aea9cc70424b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
"use server";
import db from "../lib/db";
import { analyzeTHWord, segmentateThai } from "@/lib/calls/nlp";
export function shuffleDeck(userId: number, lessonId: number) {
const res = db.fetchLesson({ userId, lessonId, random: true });
return res;
}
export async function thaiAnalysis(text: string) {
const res = await segmentateThai(text);
const res2 = await analyzeTHWord(text);
console.log({ res, res2 });
}
export async function toggleBookmark(
userId: number,
wordId: number,
is: boolean,
notes?: string,
) {
console.log("toggling on server, ostensibly");
const r = !is
? db.addBookmark(userId, wordId, notes)
: db.delBookmark(userId, wordId);
return { ok: "ack" };
}
// export async function ocrAction(file: File): AsyncRes<string[]> {
// const res = await NLP.ocr(file);
// return res;
// }
|