From 9be51e192fca8901d47328875d9e0c690d4b2b99 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Sun, 17 Aug 2025 02:20:42 +0700
Subject: this was me. local LLM!

---
 src/components/tones/ToneSelectorClient.tsx | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'src/components/tones/ToneSelectorClient.tsx')

diff --git a/src/components/tones/ToneSelectorClient.tsx b/src/components/tones/ToneSelectorClient.tsx
index 438fc8a..3335015 100644
--- a/src/components/tones/ToneSelectorClient.tsx
+++ b/src/components/tones/ToneSelectorClient.tsx
@@ -29,6 +29,7 @@ import { Skeleton } from "@/components/ui/skeleton"; // For loading state
 import { MutationOrder, PhoneticData, ToneQuery } from "@/lib/types/phonetics";
 import { ProsodySyllable } from "@/lib/types/cards";
 import { ArrowLeft, ArrowRight, Volume2, FlipHorizontal2 } from "lucide-react";
+import { LLM } from "@/lib/services/llm";
 
 function getColorByTone(tone: string): string {
   if (tone === "mid") return "blue";
@@ -96,6 +97,18 @@ const ProminentToneDisplay = ({ word }: { word: any }) => {
     return () => window.removeEventListener("keydown", onKeyDown);
   }, [playAudio]);
 
+  async function testLM() {
+    const lm = new LLM({
+      openai: {
+        url: "http://localhost:1234/v1",
+        apiKey: "",
+        model: "openai/gpt-oss-20b",
+        allowBrowser: true,
+      },
+    });
+    const res = await lm.chat("hey man something great happened to me today");
+    console.log("llm res", res);
+  }
   return (
     <div className="flex flex-col items-center mb-4">
       <h1 className="text-6xl font-bold mb-2">
@@ -123,6 +136,7 @@ const ProminentToneDisplay = ({ word }: { word: any }) => {
         <audio ref={audioRef} />
         <p className="ipa text-xl text-gray-700 mt-2">{word.frequency}</p>
         <p className="ipa text-xl text-gray-700 mt-2">{word.word_id}</p>
+        <button onClick={testLM}>Test</button>
       </div>
     </div>
   );
-- 
cgit v1.2.3

