Spaces:
Runtime error
Runtime error
Commit ·
6d49714
0
Parent(s):
:)
Browse files:)
:)
- .gitattributes +35 -0
- .gitignore +2 -0
- Dockerfile +17 -0
- README.md +11 -0
- index.html +133 -0
- package-lock.json +616 -0
- package.json +16 -0
- server.js +83 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
node_modules
|
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Node.js runtime as a parent image
|
| 2 |
+
FROM node:18
|
| 3 |
+
|
| 4 |
+
# Set the working directory to /app
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
COPY . /app
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in package.json
|
| 11 |
+
RUN npm install
|
| 12 |
+
|
| 13 |
+
# Make port 3000 available to the world outside this container
|
| 14 |
+
EXPOSE 3000
|
| 15 |
+
|
| 16 |
+
# Run the app when the container launches
|
| 17 |
+
CMD ["npm", "start"]
|
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Chat Vs Chat
|
| 3 |
+
emoji: 😻
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Chat-vs-chat</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
|
| 9 |
+
<script
|
| 10 |
+
src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.js"
|
| 11 |
+
integrity="sha512-qwi9BHx0+QtW8krMaXObe76bUkPf8nRJOufgT5GS7C74s2sV+neksCVUhAWuMSXxZzKHiM3RuADPmWbhguWEIw=="
|
| 12 |
+
crossorigin="anonymous"
|
| 13 |
+
referrerpolicy="no-referrer"
|
| 14 |
+
></script>
|
| 15 |
+
<script type="text/javascript">
|
| 16 |
+
const prompt = (message) => {
|
| 17 |
+
return `<s>[INST]You are a summarization AI. Your task is to summarize user requests, in a single sentence of less than 5 words. Do not try to answer questions, just summarize the user's request. Start your answer with an emoji relevant to the summary.\nWho is the president of Gabon? [/INST]🇬🇦 President of Gabon</s>[INST]Who is Julien Chaumond?[/INST]🧑 Julien Chaumond</s>[INST]What are the latest news?[/INST]📰 Latest news</s>[INST]How to make a great cheesecake?[/INST]🍰 Cheesecake recipe</s>[INST]What is 1 + 1?[/INST]🔢 Simple math operation</s>[INST]${message}[/INST]`;
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
async function sendMessage(message, temperature, maxNewTokens) {
|
| 21 |
+
const response1 = await fetch("/api/model/mistralai", {
|
| 22 |
+
method: "POST",
|
| 23 |
+
headers: {
|
| 24 |
+
"Content-Type": "application/json",
|
| 25 |
+
},
|
| 26 |
+
body: JSON.stringify({
|
| 27 |
+
inputs: prompt(message),
|
| 28 |
+
temperature: temperature,
|
| 29 |
+
max_new_tokens: maxNewTokens,
|
| 30 |
+
}),
|
| 31 |
+
});
|
| 32 |
+
const response2 = await fetch("/api/model/zephyr", {
|
| 33 |
+
method: "POST",
|
| 34 |
+
headers: {
|
| 35 |
+
"Content-Type": "application/json",
|
| 36 |
+
},
|
| 37 |
+
body: JSON.stringify({
|
| 38 |
+
inputs: prompt(message),
|
| 39 |
+
temperature: temperature,
|
| 40 |
+
max_new_tokens: maxNewTokens,
|
| 41 |
+
}),
|
| 42 |
+
});
|
| 43 |
+
const data1 = await response1.json();
|
| 44 |
+
const data2 = await response2.json();
|
| 45 |
+
|
| 46 |
+
// Assuming you want to display the 'generated_text' field in the UI
|
| 47 |
+
document.querySelector("#mistral-response").textContent =
|
| 48 |
+
data1.generated_text || "Error";
|
| 49 |
+
document.querySelector("#zephyr-response").textContent =
|
| 50 |
+
data2.generated_text || "Error";
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 54 |
+
document
|
| 55 |
+
.querySelector("form")
|
| 56 |
+
.addEventListener("submit", async (event) => {
|
| 57 |
+
event.preventDefault();
|
| 58 |
+
|
| 59 |
+
const message =
|
| 60 |
+
event.target.querySelector("input[type='text']").value;
|
| 61 |
+
const temperature = parseFloat(
|
| 62 |
+
document.querySelector("#temperature-input").value
|
| 63 |
+
);
|
| 64 |
+
const maxNewTokens = parseInt(
|
| 65 |
+
document.querySelector("#max-tokens-input").value,
|
| 66 |
+
10
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
await sendMessage(message, temperature, maxNewTokens);
|
| 70 |
+
});
|
| 71 |
+
});
|
| 72 |
+
</script>
|
| 73 |
+
</head>
|
| 74 |
+
<body>
|
| 75 |
+
<div
|
| 76 |
+
class="max-w-screen flex h-screen flex-col overflow-hidden max-h-screen"
|
| 77 |
+
>
|
| 78 |
+
<form action="">
|
| 79 |
+
<input
|
| 80 |
+
placeholder="Type your message"
|
| 81 |
+
type="text"
|
| 82 |
+
class="h-12 w-full border-b px-4 focus:bg-gray-50 focus:outline-none"
|
| 83 |
+
/>
|
| 84 |
+
</form>
|
| 85 |
+
<div class="grid flex-1 grid-cols-2 divide-x overflow-y-auto">
|
| 86 |
+
<div class="relative flex flex-col space-y-2">
|
| 87 |
+
<div
|
| 88 |
+
class="text-xs flex sticky top-0 inset-x-0 h-9 overflow-hidden items-center whitespace-nowrap border-b bg-gray-50 px-4 font-mono sm:text-sm leading-none text-gray-500"
|
| 89 |
+
>
|
| 90 |
+
Mistral-7B-Instruct-v0.1
|
| 91 |
+
</div>
|
| 92 |
+
<div
|
| 93 |
+
id="mistral-response"
|
| 94 |
+
class="mx-2 max-sm:text-sm self-start rounded-lg bg-gray-50 p-3 text-gray-700 break-words overflow-y-auto"
|
| 95 |
+
></div>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="relative flex flex-col space-y-2">
|
| 98 |
+
<div
|
| 99 |
+
class="text-xs flex sticky top-0 inset-x-0 h-9 overflow-hidden items-center whitespace-nowrap border-b bg-gray-50 px-4 font-mono sm:text-sm leading-none text-gray-500"
|
| 100 |
+
>
|
| 101 |
+
HuggingFaceH4/zephyr-7b-alpha
|
| 102 |
+
</div>
|
| 103 |
+
<div
|
| 104 |
+
id="zephyr-response"
|
| 105 |
+
class="mx-2 max-sm:text-sm self-start rounded-lg bg-gray-50 p-3 text-gray-700 break-words overflow-y-auto"
|
| 106 |
+
></div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div
|
| 110 |
+
class="flex h-9 sm:h-12 items-stretch justify-end divide-x border-t font-mono text-xs sm:text-sm text-gray-500"
|
| 111 |
+
>
|
| 112 |
+
<label for="temperature-input" class="flex items-center gap-4 px-4">
|
| 113 |
+
temperature
|
| 114 |
+
<input
|
| 115 |
+
value="1"
|
| 116 |
+
type="number"
|
| 117 |
+
id="temperature-input"
|
| 118 |
+
class="w-16 rounded border bg-gray-100 px-1"
|
| 119 |
+
/>
|
| 120 |
+
</label>
|
| 121 |
+
<label for="max-tokens-input" class="flex items-center gap-4 px-4">
|
| 122 |
+
max_new_tokens
|
| 123 |
+
<input
|
| 124 |
+
value="512"
|
| 125 |
+
type="number"
|
| 126 |
+
id="max-tokens-input"
|
| 127 |
+
class="w-16 rounded border bg-gray-100 px-1"
|
| 128 |
+
/>
|
| 129 |
+
</label>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
</body>
|
| 133 |
+
</html>
|
package-lock.json
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "chat-vs-chat",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"lockfileVersion": 3,
|
| 5 |
+
"requires": true,
|
| 6 |
+
"packages": {
|
| 7 |
+
"": {
|
| 8 |
+
"name": "chat-vs-chat",
|
| 9 |
+
"version": "1.0.0",
|
| 10 |
+
"license": "ISC",
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"dotenv": "^16.3.1",
|
| 13 |
+
"express": "^4.18.2"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"node_modules/accepts": {
|
| 17 |
+
"version": "1.3.8",
|
| 18 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
| 19 |
+
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
| 20 |
+
"dependencies": {
|
| 21 |
+
"mime-types": "~2.1.34",
|
| 22 |
+
"negotiator": "0.6.3"
|
| 23 |
+
},
|
| 24 |
+
"engines": {
|
| 25 |
+
"node": ">= 0.6"
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"node_modules/array-flatten": {
|
| 29 |
+
"version": "1.1.1",
|
| 30 |
+
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
| 31 |
+
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
| 32 |
+
},
|
| 33 |
+
"node_modules/body-parser": {
|
| 34 |
+
"version": "1.20.1",
|
| 35 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
| 36 |
+
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
|
| 37 |
+
"dependencies": {
|
| 38 |
+
"bytes": "3.1.2",
|
| 39 |
+
"content-type": "~1.0.4",
|
| 40 |
+
"debug": "2.6.9",
|
| 41 |
+
"depd": "2.0.0",
|
| 42 |
+
"destroy": "1.2.0",
|
| 43 |
+
"http-errors": "2.0.0",
|
| 44 |
+
"iconv-lite": "0.4.24",
|
| 45 |
+
"on-finished": "2.4.1",
|
| 46 |
+
"qs": "6.11.0",
|
| 47 |
+
"raw-body": "2.5.1",
|
| 48 |
+
"type-is": "~1.6.18",
|
| 49 |
+
"unpipe": "1.0.0"
|
| 50 |
+
},
|
| 51 |
+
"engines": {
|
| 52 |
+
"node": ">= 0.8",
|
| 53 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"node_modules/bytes": {
|
| 57 |
+
"version": "3.1.2",
|
| 58 |
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
| 59 |
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
| 60 |
+
"engines": {
|
| 61 |
+
"node": ">= 0.8"
|
| 62 |
+
}
|
| 63 |
+
},
|
| 64 |
+
"node_modules/call-bind": {
|
| 65 |
+
"version": "1.0.2",
|
| 66 |
+
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
| 67 |
+
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
| 68 |
+
"dependencies": {
|
| 69 |
+
"function-bind": "^1.1.1",
|
| 70 |
+
"get-intrinsic": "^1.0.2"
|
| 71 |
+
},
|
| 72 |
+
"funding": {
|
| 73 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
"node_modules/content-disposition": {
|
| 77 |
+
"version": "0.5.4",
|
| 78 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
| 79 |
+
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
| 80 |
+
"dependencies": {
|
| 81 |
+
"safe-buffer": "5.2.1"
|
| 82 |
+
},
|
| 83 |
+
"engines": {
|
| 84 |
+
"node": ">= 0.6"
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
"node_modules/content-type": {
|
| 88 |
+
"version": "1.0.5",
|
| 89 |
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
| 90 |
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
| 91 |
+
"engines": {
|
| 92 |
+
"node": ">= 0.6"
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"node_modules/cookie": {
|
| 96 |
+
"version": "0.5.0",
|
| 97 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
|
| 98 |
+
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
|
| 99 |
+
"engines": {
|
| 100 |
+
"node": ">= 0.6"
|
| 101 |
+
}
|
| 102 |
+
},
|
| 103 |
+
"node_modules/cookie-signature": {
|
| 104 |
+
"version": "1.0.6",
|
| 105 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
| 106 |
+
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
| 107 |
+
},
|
| 108 |
+
"node_modules/debug": {
|
| 109 |
+
"version": "2.6.9",
|
| 110 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
| 111 |
+
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
| 112 |
+
"dependencies": {
|
| 113 |
+
"ms": "2.0.0"
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
"node_modules/depd": {
|
| 117 |
+
"version": "2.0.0",
|
| 118 |
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
| 119 |
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
| 120 |
+
"engines": {
|
| 121 |
+
"node": ">= 0.8"
|
| 122 |
+
}
|
| 123 |
+
},
|
| 124 |
+
"node_modules/destroy": {
|
| 125 |
+
"version": "1.2.0",
|
| 126 |
+
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
| 127 |
+
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
| 128 |
+
"engines": {
|
| 129 |
+
"node": ">= 0.8",
|
| 130 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 131 |
+
}
|
| 132 |
+
},
|
| 133 |
+
"node_modules/dotenv": {
|
| 134 |
+
"version": "16.3.1",
|
| 135 |
+
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
|
| 136 |
+
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
|
| 137 |
+
"engines": {
|
| 138 |
+
"node": ">=12"
|
| 139 |
+
},
|
| 140 |
+
"funding": {
|
| 141 |
+
"url": "https://github.com/motdotla/dotenv?sponsor=1"
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"node_modules/ee-first": {
|
| 145 |
+
"version": "1.1.1",
|
| 146 |
+
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
| 147 |
+
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
| 148 |
+
},
|
| 149 |
+
"node_modules/encodeurl": {
|
| 150 |
+
"version": "1.0.2",
|
| 151 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
| 152 |
+
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
| 153 |
+
"engines": {
|
| 154 |
+
"node": ">= 0.8"
|
| 155 |
+
}
|
| 156 |
+
},
|
| 157 |
+
"node_modules/escape-html": {
|
| 158 |
+
"version": "1.0.3",
|
| 159 |
+
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
| 160 |
+
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
| 161 |
+
},
|
| 162 |
+
"node_modules/etag": {
|
| 163 |
+
"version": "1.8.1",
|
| 164 |
+
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
| 165 |
+
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
| 166 |
+
"engines": {
|
| 167 |
+
"node": ">= 0.6"
|
| 168 |
+
}
|
| 169 |
+
},
|
| 170 |
+
"node_modules/express": {
|
| 171 |
+
"version": "4.18.2",
|
| 172 |
+
"resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
|
| 173 |
+
"integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
|
| 174 |
+
"dependencies": {
|
| 175 |
+
"accepts": "~1.3.8",
|
| 176 |
+
"array-flatten": "1.1.1",
|
| 177 |
+
"body-parser": "1.20.1",
|
| 178 |
+
"content-disposition": "0.5.4",
|
| 179 |
+
"content-type": "~1.0.4",
|
| 180 |
+
"cookie": "0.5.0",
|
| 181 |
+
"cookie-signature": "1.0.6",
|
| 182 |
+
"debug": "2.6.9",
|
| 183 |
+
"depd": "2.0.0",
|
| 184 |
+
"encodeurl": "~1.0.2",
|
| 185 |
+
"escape-html": "~1.0.3",
|
| 186 |
+
"etag": "~1.8.1",
|
| 187 |
+
"finalhandler": "1.2.0",
|
| 188 |
+
"fresh": "0.5.2",
|
| 189 |
+
"http-errors": "2.0.0",
|
| 190 |
+
"merge-descriptors": "1.0.1",
|
| 191 |
+
"methods": "~1.1.2",
|
| 192 |
+
"on-finished": "2.4.1",
|
| 193 |
+
"parseurl": "~1.3.3",
|
| 194 |
+
"path-to-regexp": "0.1.7",
|
| 195 |
+
"proxy-addr": "~2.0.7",
|
| 196 |
+
"qs": "6.11.0",
|
| 197 |
+
"range-parser": "~1.2.1",
|
| 198 |
+
"safe-buffer": "5.2.1",
|
| 199 |
+
"send": "0.18.0",
|
| 200 |
+
"serve-static": "1.15.0",
|
| 201 |
+
"setprototypeof": "1.2.0",
|
| 202 |
+
"statuses": "2.0.1",
|
| 203 |
+
"type-is": "~1.6.18",
|
| 204 |
+
"utils-merge": "1.0.1",
|
| 205 |
+
"vary": "~1.1.2"
|
| 206 |
+
},
|
| 207 |
+
"engines": {
|
| 208 |
+
"node": ">= 0.10.0"
|
| 209 |
+
}
|
| 210 |
+
},
|
| 211 |
+
"node_modules/finalhandler": {
|
| 212 |
+
"version": "1.2.0",
|
| 213 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
| 214 |
+
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
|
| 215 |
+
"dependencies": {
|
| 216 |
+
"debug": "2.6.9",
|
| 217 |
+
"encodeurl": "~1.0.2",
|
| 218 |
+
"escape-html": "~1.0.3",
|
| 219 |
+
"on-finished": "2.4.1",
|
| 220 |
+
"parseurl": "~1.3.3",
|
| 221 |
+
"statuses": "2.0.1",
|
| 222 |
+
"unpipe": "~1.0.0"
|
| 223 |
+
},
|
| 224 |
+
"engines": {
|
| 225 |
+
"node": ">= 0.8"
|
| 226 |
+
}
|
| 227 |
+
},
|
| 228 |
+
"node_modules/forwarded": {
|
| 229 |
+
"version": "0.2.0",
|
| 230 |
+
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
| 231 |
+
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
| 232 |
+
"engines": {
|
| 233 |
+
"node": ">= 0.6"
|
| 234 |
+
}
|
| 235 |
+
},
|
| 236 |
+
"node_modules/fresh": {
|
| 237 |
+
"version": "0.5.2",
|
| 238 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
| 239 |
+
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
| 240 |
+
"engines": {
|
| 241 |
+
"node": ">= 0.6"
|
| 242 |
+
}
|
| 243 |
+
},
|
| 244 |
+
"node_modules/function-bind": {
|
| 245 |
+
"version": "1.1.2",
|
| 246 |
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
| 247 |
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
| 248 |
+
"funding": {
|
| 249 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 250 |
+
}
|
| 251 |
+
},
|
| 252 |
+
"node_modules/get-intrinsic": {
|
| 253 |
+
"version": "1.2.1",
|
| 254 |
+
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
| 255 |
+
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
| 256 |
+
"dependencies": {
|
| 257 |
+
"function-bind": "^1.1.1",
|
| 258 |
+
"has": "^1.0.3",
|
| 259 |
+
"has-proto": "^1.0.1",
|
| 260 |
+
"has-symbols": "^1.0.3"
|
| 261 |
+
},
|
| 262 |
+
"funding": {
|
| 263 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 264 |
+
}
|
| 265 |
+
},
|
| 266 |
+
"node_modules/has": {
|
| 267 |
+
"version": "1.0.4",
|
| 268 |
+
"resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
|
| 269 |
+
"integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
|
| 270 |
+
"engines": {
|
| 271 |
+
"node": ">= 0.4.0"
|
| 272 |
+
}
|
| 273 |
+
},
|
| 274 |
+
"node_modules/has-proto": {
|
| 275 |
+
"version": "1.0.1",
|
| 276 |
+
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
| 277 |
+
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
| 278 |
+
"engines": {
|
| 279 |
+
"node": ">= 0.4"
|
| 280 |
+
},
|
| 281 |
+
"funding": {
|
| 282 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 283 |
+
}
|
| 284 |
+
},
|
| 285 |
+
"node_modules/has-symbols": {
|
| 286 |
+
"version": "1.0.3",
|
| 287 |
+
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
| 288 |
+
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
| 289 |
+
"engines": {
|
| 290 |
+
"node": ">= 0.4"
|
| 291 |
+
},
|
| 292 |
+
"funding": {
|
| 293 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 294 |
+
}
|
| 295 |
+
},
|
| 296 |
+
"node_modules/http-errors": {
|
| 297 |
+
"version": "2.0.0",
|
| 298 |
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
| 299 |
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
| 300 |
+
"dependencies": {
|
| 301 |
+
"depd": "2.0.0",
|
| 302 |
+
"inherits": "2.0.4",
|
| 303 |
+
"setprototypeof": "1.2.0",
|
| 304 |
+
"statuses": "2.0.1",
|
| 305 |
+
"toidentifier": "1.0.1"
|
| 306 |
+
},
|
| 307 |
+
"engines": {
|
| 308 |
+
"node": ">= 0.8"
|
| 309 |
+
}
|
| 310 |
+
},
|
| 311 |
+
"node_modules/iconv-lite": {
|
| 312 |
+
"version": "0.4.24",
|
| 313 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
| 314 |
+
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
| 315 |
+
"dependencies": {
|
| 316 |
+
"safer-buffer": ">= 2.1.2 < 3"
|
| 317 |
+
},
|
| 318 |
+
"engines": {
|
| 319 |
+
"node": ">=0.10.0"
|
| 320 |
+
}
|
| 321 |
+
},
|
| 322 |
+
"node_modules/inherits": {
|
| 323 |
+
"version": "2.0.4",
|
| 324 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
| 325 |
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
| 326 |
+
},
|
| 327 |
+
"node_modules/ipaddr.js": {
|
| 328 |
+
"version": "1.9.1",
|
| 329 |
+
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
| 330 |
+
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
| 331 |
+
"engines": {
|
| 332 |
+
"node": ">= 0.10"
|
| 333 |
+
}
|
| 334 |
+
},
|
| 335 |
+
"node_modules/media-typer": {
|
| 336 |
+
"version": "0.3.0",
|
| 337 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
| 338 |
+
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
| 339 |
+
"engines": {
|
| 340 |
+
"node": ">= 0.6"
|
| 341 |
+
}
|
| 342 |
+
},
|
| 343 |
+
"node_modules/merge-descriptors": {
|
| 344 |
+
"version": "1.0.1",
|
| 345 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
| 346 |
+
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
| 347 |
+
},
|
| 348 |
+
"node_modules/methods": {
|
| 349 |
+
"version": "1.1.2",
|
| 350 |
+
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
| 351 |
+
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
| 352 |
+
"engines": {
|
| 353 |
+
"node": ">= 0.6"
|
| 354 |
+
}
|
| 355 |
+
},
|
| 356 |
+
"node_modules/mime": {
|
| 357 |
+
"version": "1.6.0",
|
| 358 |
+
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
| 359 |
+
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
| 360 |
+
"bin": {
|
| 361 |
+
"mime": "cli.js"
|
| 362 |
+
},
|
| 363 |
+
"engines": {
|
| 364 |
+
"node": ">=4"
|
| 365 |
+
}
|
| 366 |
+
},
|
| 367 |
+
"node_modules/mime-db": {
|
| 368 |
+
"version": "1.52.0",
|
| 369 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
| 370 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
| 371 |
+
"engines": {
|
| 372 |
+
"node": ">= 0.6"
|
| 373 |
+
}
|
| 374 |
+
},
|
| 375 |
+
"node_modules/mime-types": {
|
| 376 |
+
"version": "2.1.35",
|
| 377 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
| 378 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
| 379 |
+
"dependencies": {
|
| 380 |
+
"mime-db": "1.52.0"
|
| 381 |
+
},
|
| 382 |
+
"engines": {
|
| 383 |
+
"node": ">= 0.6"
|
| 384 |
+
}
|
| 385 |
+
},
|
| 386 |
+
"node_modules/ms": {
|
| 387 |
+
"version": "2.0.0",
|
| 388 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
| 389 |
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
| 390 |
+
},
|
| 391 |
+
"node_modules/negotiator": {
|
| 392 |
+
"version": "0.6.3",
|
| 393 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
| 394 |
+
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
| 395 |
+
"engines": {
|
| 396 |
+
"node": ">= 0.6"
|
| 397 |
+
}
|
| 398 |
+
},
|
| 399 |
+
"node_modules/object-inspect": {
|
| 400 |
+
"version": "1.12.3",
|
| 401 |
+
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
| 402 |
+
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
| 403 |
+
"funding": {
|
| 404 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 405 |
+
}
|
| 406 |
+
},
|
| 407 |
+
"node_modules/on-finished": {
|
| 408 |
+
"version": "2.4.1",
|
| 409 |
+
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
| 410 |
+
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
| 411 |
+
"dependencies": {
|
| 412 |
+
"ee-first": "1.1.1"
|
| 413 |
+
},
|
| 414 |
+
"engines": {
|
| 415 |
+
"node": ">= 0.8"
|
| 416 |
+
}
|
| 417 |
+
},
|
| 418 |
+
"node_modules/parseurl": {
|
| 419 |
+
"version": "1.3.3",
|
| 420 |
+
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
| 421 |
+
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
| 422 |
+
"engines": {
|
| 423 |
+
"node": ">= 0.8"
|
| 424 |
+
}
|
| 425 |
+
},
|
| 426 |
+
"node_modules/path-to-regexp": {
|
| 427 |
+
"version": "0.1.7",
|
| 428 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
| 429 |
+
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
|
| 430 |
+
},
|
| 431 |
+
"node_modules/proxy-addr": {
|
| 432 |
+
"version": "2.0.7",
|
| 433 |
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
| 434 |
+
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
| 435 |
+
"dependencies": {
|
| 436 |
+
"forwarded": "0.2.0",
|
| 437 |
+
"ipaddr.js": "1.9.1"
|
| 438 |
+
},
|
| 439 |
+
"engines": {
|
| 440 |
+
"node": ">= 0.10"
|
| 441 |
+
}
|
| 442 |
+
},
|
| 443 |
+
"node_modules/qs": {
|
| 444 |
+
"version": "6.11.0",
|
| 445 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
| 446 |
+
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
| 447 |
+
"dependencies": {
|
| 448 |
+
"side-channel": "^1.0.4"
|
| 449 |
+
},
|
| 450 |
+
"engines": {
|
| 451 |
+
"node": ">=0.6"
|
| 452 |
+
},
|
| 453 |
+
"funding": {
|
| 454 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 455 |
+
}
|
| 456 |
+
},
|
| 457 |
+
"node_modules/range-parser": {
|
| 458 |
+
"version": "1.2.1",
|
| 459 |
+
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
| 460 |
+
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
| 461 |
+
"engines": {
|
| 462 |
+
"node": ">= 0.6"
|
| 463 |
+
}
|
| 464 |
+
},
|
| 465 |
+
"node_modules/raw-body": {
|
| 466 |
+
"version": "2.5.1",
|
| 467 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
|
| 468 |
+
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
|
| 469 |
+
"dependencies": {
|
| 470 |
+
"bytes": "3.1.2",
|
| 471 |
+
"http-errors": "2.0.0",
|
| 472 |
+
"iconv-lite": "0.4.24",
|
| 473 |
+
"unpipe": "1.0.0"
|
| 474 |
+
},
|
| 475 |
+
"engines": {
|
| 476 |
+
"node": ">= 0.8"
|
| 477 |
+
}
|
| 478 |
+
},
|
| 479 |
+
"node_modules/safe-buffer": {
|
| 480 |
+
"version": "5.2.1",
|
| 481 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
| 482 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
| 483 |
+
"funding": [
|
| 484 |
+
{
|
| 485 |
+
"type": "github",
|
| 486 |
+
"url": "https://github.com/sponsors/feross"
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"type": "patreon",
|
| 490 |
+
"url": "https://www.patreon.com/feross"
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"type": "consulting",
|
| 494 |
+
"url": "https://feross.org/support"
|
| 495 |
+
}
|
| 496 |
+
]
|
| 497 |
+
},
|
| 498 |
+
"node_modules/safer-buffer": {
|
| 499 |
+
"version": "2.1.2",
|
| 500 |
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
| 501 |
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
| 502 |
+
},
|
| 503 |
+
"node_modules/send": {
|
| 504 |
+
"version": "0.18.0",
|
| 505 |
+
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
| 506 |
+
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
|
| 507 |
+
"dependencies": {
|
| 508 |
+
"debug": "2.6.9",
|
| 509 |
+
"depd": "2.0.0",
|
| 510 |
+
"destroy": "1.2.0",
|
| 511 |
+
"encodeurl": "~1.0.2",
|
| 512 |
+
"escape-html": "~1.0.3",
|
| 513 |
+
"etag": "~1.8.1",
|
| 514 |
+
"fresh": "0.5.2",
|
| 515 |
+
"http-errors": "2.0.0",
|
| 516 |
+
"mime": "1.6.0",
|
| 517 |
+
"ms": "2.1.3",
|
| 518 |
+
"on-finished": "2.4.1",
|
| 519 |
+
"range-parser": "~1.2.1",
|
| 520 |
+
"statuses": "2.0.1"
|
| 521 |
+
},
|
| 522 |
+
"engines": {
|
| 523 |
+
"node": ">= 0.8.0"
|
| 524 |
+
}
|
| 525 |
+
},
|
| 526 |
+
"node_modules/send/node_modules/ms": {
|
| 527 |
+
"version": "2.1.3",
|
| 528 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
| 529 |
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
| 530 |
+
},
|
| 531 |
+
"node_modules/serve-static": {
|
| 532 |
+
"version": "1.15.0",
|
| 533 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
|
| 534 |
+
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
|
| 535 |
+
"dependencies": {
|
| 536 |
+
"encodeurl": "~1.0.2",
|
| 537 |
+
"escape-html": "~1.0.3",
|
| 538 |
+
"parseurl": "~1.3.3",
|
| 539 |
+
"send": "0.18.0"
|
| 540 |
+
},
|
| 541 |
+
"engines": {
|
| 542 |
+
"node": ">= 0.8.0"
|
| 543 |
+
}
|
| 544 |
+
},
|
| 545 |
+
"node_modules/setprototypeof": {
|
| 546 |
+
"version": "1.2.0",
|
| 547 |
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
| 548 |
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
| 549 |
+
},
|
| 550 |
+
"node_modules/side-channel": {
|
| 551 |
+
"version": "1.0.4",
|
| 552 |
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
| 553 |
+
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
| 554 |
+
"dependencies": {
|
| 555 |
+
"call-bind": "^1.0.0",
|
| 556 |
+
"get-intrinsic": "^1.0.2",
|
| 557 |
+
"object-inspect": "^1.9.0"
|
| 558 |
+
},
|
| 559 |
+
"funding": {
|
| 560 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 561 |
+
}
|
| 562 |
+
},
|
| 563 |
+
"node_modules/statuses": {
|
| 564 |
+
"version": "2.0.1",
|
| 565 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
| 566 |
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
| 567 |
+
"engines": {
|
| 568 |
+
"node": ">= 0.8"
|
| 569 |
+
}
|
| 570 |
+
},
|
| 571 |
+
"node_modules/toidentifier": {
|
| 572 |
+
"version": "1.0.1",
|
| 573 |
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
| 574 |
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
| 575 |
+
"engines": {
|
| 576 |
+
"node": ">=0.6"
|
| 577 |
+
}
|
| 578 |
+
},
|
| 579 |
+
"node_modules/type-is": {
|
| 580 |
+
"version": "1.6.18",
|
| 581 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
| 582 |
+
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
| 583 |
+
"dependencies": {
|
| 584 |
+
"media-typer": "0.3.0",
|
| 585 |
+
"mime-types": "~2.1.24"
|
| 586 |
+
},
|
| 587 |
+
"engines": {
|
| 588 |
+
"node": ">= 0.6"
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
"node_modules/unpipe": {
|
| 592 |
+
"version": "1.0.0",
|
| 593 |
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
| 594 |
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
| 595 |
+
"engines": {
|
| 596 |
+
"node": ">= 0.8"
|
| 597 |
+
}
|
| 598 |
+
},
|
| 599 |
+
"node_modules/utils-merge": {
|
| 600 |
+
"version": "1.0.1",
|
| 601 |
+
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
| 602 |
+
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
| 603 |
+
"engines": {
|
| 604 |
+
"node": ">= 0.4.0"
|
| 605 |
+
}
|
| 606 |
+
},
|
| 607 |
+
"node_modules/vary": {
|
| 608 |
+
"version": "1.1.2",
|
| 609 |
+
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
| 610 |
+
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
| 611 |
+
"engines": {
|
| 612 |
+
"node": ">= 0.8"
|
| 613 |
+
}
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
}
|
package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "chat-vs-chat",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "",
|
| 5 |
+
"main": "index.js",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"test": "echo \"Error: no test specified\" && exit 1"
|
| 8 |
+
},
|
| 9 |
+
"keywords": [],
|
| 10 |
+
"author": "",
|
| 11 |
+
"license": "ISC",
|
| 12 |
+
"dependencies": {
|
| 13 |
+
"dotenv": "^16.3.1",
|
| 14 |
+
"express": "^4.18.2"
|
| 15 |
+
}
|
| 16 |
+
}
|
server.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const express = require("express");
|
| 2 |
+
const path = require("path");
|
| 3 |
+
const app = express();
|
| 4 |
+
|
| 5 |
+
// Middlewares
|
| 6 |
+
app.use(express.json());
|
| 7 |
+
app.use(express.urlencoded({ extended: true }));
|
| 8 |
+
|
| 9 |
+
// Utility function to fetch data from HuggingFace
|
| 10 |
+
async function query(url, data) {
|
| 11 |
+
console.log(data);
|
| 12 |
+
try {
|
| 13 |
+
const response = await fetch(url, {
|
| 14 |
+
headers: {
|
| 15 |
+
"Content-Type": "application/json",
|
| 16 |
+
},
|
| 17 |
+
method: "POST",
|
| 18 |
+
body: JSON.stringify(data),
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
if (!response.ok) {
|
| 22 |
+
throw new Error(
|
| 23 |
+
`Server responded with ${response.status}: ${response.statusText}`
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
const result = await response.json();
|
| 28 |
+
if (
|
| 29 |
+
result &&
|
| 30 |
+
Array.isArray(result) &&
|
| 31 |
+
result[0] &&
|
| 32 |
+
result[0].generated_text
|
| 33 |
+
) {
|
| 34 |
+
return result[0].generated_text;
|
| 35 |
+
} else {
|
| 36 |
+
throw new Error("Unexpected response format");
|
| 37 |
+
}
|
| 38 |
+
} catch (error) {
|
| 39 |
+
console.error(`Error querying model at ${url}:`, error.message);
|
| 40 |
+
return null;
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// API Routes
|
| 45 |
+
app.post("/api/model/mistralai", async (req, res) => {
|
| 46 |
+
const result = await query(
|
| 47 |
+
"https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.1",
|
| 48 |
+
req.body
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
if (result) {
|
| 52 |
+
res.json({ generated_text: result });
|
| 53 |
+
} else {
|
| 54 |
+
res.status(500).json({ error: "Failed to get response from model" });
|
| 55 |
+
}
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
app.post("/api/model/zephyr", async (req, res) => {
|
| 59 |
+
const result = await query(
|
| 60 |
+
"https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-alpha",
|
| 61 |
+
req.body
|
| 62 |
+
);
|
| 63 |
+
|
| 64 |
+
if (result) {
|
| 65 |
+
res.json({ generated_text: result });
|
| 66 |
+
} else {
|
| 67 |
+
res.status(500).json({ error: "Failed to get response from model" });
|
| 68 |
+
}
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
app.get("/", (req, res) => {
|
| 72 |
+
res.sendFile(path.join(__dirname, "index.html"));
|
| 73 |
+
});
|
| 74 |
+
|
| 75 |
+
// Catch-all route for all non-API URLs to redirect to root
|
| 76 |
+
app.get("*", (req, res) => {
|
| 77 |
+
res.redirect("/");
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
const PORT = process.env.PORT || 3000;
|
| 81 |
+
app.listen(PORT, () => {
|
| 82 |
+
console.log(`Server started on port ${PORT}`);
|
| 83 |
+
});
|