Update index.html
Browse files- index.html +3 -4
index.html
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
return { blocked: false };
|
| 32 |
};
|
| 33 |
|
| 34 |
-
//
|
| 35 |
const callLLM = async (systemPrompt, userQuery, history, apiKey) => {
|
| 36 |
const formattedHistory = history.slice(-4).map(m => ({
|
| 37 |
role: m.sender === "user" ? "user" : "assistant",
|
|
@@ -44,7 +44,6 @@
|
|
| 44 |
{ role: "user", content: userQuery }
|
| 45 |
];
|
| 46 |
|
| 47 |
-
// Primary Free Serverless Route
|
| 48 |
const response = await fetch("https://router.huggingface.co/hf-inference/v1/chat/completions", {
|
| 49 |
method: "POST",
|
| 50 |
headers: {
|
|
@@ -52,7 +51,7 @@
|
|
| 52 |
"Content-Type": "application/json"
|
| 53 |
},
|
| 54 |
body: JSON.stringify({
|
| 55 |
-
model: "
|
| 56 |
messages: messages,
|
| 57 |
max_tokens: 300,
|
| 58 |
temperature: 0.7
|
|
@@ -112,7 +111,7 @@
|
|
| 112 |
return;
|
| 113 |
}
|
| 114 |
|
| 115 |
-
// Fetch context from Supabase
|
| 116 |
const { data: products } = await supabase.from('products').select('*');
|
| 117 |
const { data: orders } = await supabase.from('orders').select('*');
|
| 118 |
|
|
|
|
| 31 |
return { blocked: false };
|
| 32 |
};
|
| 33 |
|
| 34 |
+
// Hugging Face LLM Caller using Llama-3.1-8B-Instruct
|
| 35 |
const callLLM = async (systemPrompt, userQuery, history, apiKey) => {
|
| 36 |
const formattedHistory = history.slice(-4).map(m => ({
|
| 37 |
role: m.sender === "user" ? "user" : "assistant",
|
|
|
|
| 44 |
{ role: "user", content: userQuery }
|
| 45 |
];
|
| 46 |
|
|
|
|
| 47 |
const response = await fetch("https://router.huggingface.co/hf-inference/v1/chat/completions", {
|
| 48 |
method: "POST",
|
| 49 |
headers: {
|
|
|
|
| 51 |
"Content-Type": "application/json"
|
| 52 |
},
|
| 53 |
body: JSON.stringify({
|
| 54 |
+
model: "meta-llama/Llama-3.1-8B-Instruct",
|
| 55 |
messages: messages,
|
| 56 |
max_tokens: 300,
|
| 57 |
temperature: 0.7
|
|
|
|
| 111 |
return;
|
| 112 |
}
|
| 113 |
|
| 114 |
+
// Fetch database context from Supabase
|
| 115 |
const { data: products } = await supabase.from('products').select('*');
|
| 116 |
const { data: orders } = await supabase.from('orders').select('*');
|
| 117 |
|