Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
|
@@ -5,194 +5,263 @@ const subtitle = document.querySelector('.subtitle');
|
|
| 5 |
const aboutContent = document.querySelectorAll('#about .card-content p');
|
| 6 |
const featuresContent = document.querySelectorAll('#features .card-content li');
|
| 7 |
const instructionsContent = document.querySelectorAll('#instructions .card-content > *:not(h2)');
|
| 8 |
-
const teamContent = document.querySelector('#team
|
| 9 |
-
const linksContent = document.querySelectorAll('#links
|
| 10 |
-
const contactsContent = document.querySelector('#contacts
|
| 11 |
const footerContent = document.querySelector('footer p');
|
| 12 |
|
| 13 |
// Demo button elements
|
| 14 |
const demoButtons = document.querySelectorAll('.demo-button');
|
| 15 |
|
| 16 |
const translations = {
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
};
|
| 82 |
|
| 83 |
-
let currentLang =
|
| 84 |
|
| 85 |
-
// Function to handle demo button clicks
|
| 86 |
function handleDemoButtonClick(event) {
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
}
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
button.addEventListener('click', handleDemoButtonClick);
|
| 96 |
});
|
| 97 |
|
| 98 |
function updateContent(lang) {
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
// Instructions Section
|
| 119 |
-
document.querySelector('#instructions .card-title').textContent = translation.instructionsTitle;
|
| 120 |
-
instructionsContent[0].textContent = translation.instructionsContent;
|
| 121 |
-
|
| 122 |
-
const ol = document.createElement('ol');
|
| 123 |
-
for (let i = 0; i < translation.instructions.length; i++) {
|
| 124 |
-
const li = document.createElement('li');
|
| 125 |
-
li.textContent = translation.instructions[i];
|
| 126 |
-
li.appendChild(createCode(translation.instructionsCode[i]));
|
| 127 |
-
ol.appendChild(li);
|
| 128 |
-
}
|
| 129 |
-
const existingOl = instructionsContent[1].querySelector('ol')
|
| 130 |
-
if (existingOl) {
|
| 131 |
-
instructionsContent[1].removeChild(existingOl);
|
| 132 |
}
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
teamContent.textContent = translation.teamContent;
|
| 141 |
teamContent.appendChild(createLink('https://github.com/SparkleSavvy', translation.teamLink));
|
| 142 |
-
|
| 143 |
-
// Links Section
|
| 144 |
-
document.querySelector('#links .card-title').textContent = translation.linksTitle;
|
| 145 |
linksContent[0].textContent = "";
|
| 146 |
linksContent[0].appendChild(createLink(translation.linksHrefs[0], translation.links[0]));
|
| 147 |
linksContent[1].textContent = "";
|
| 148 |
linksContent[1].appendChild(createLink(translation.linksHrefs[1], translation.links[1]));
|
| 149 |
-
|
| 150 |
-
// Contacts Section
|
| 151 |
-
document.querySelector('#contacts .card-title').textContent = translation.contactsTitle;
|
| 152 |
contactsContent.textContent = translation.contactsContent;
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
| 174 |
}
|
| 175 |
|
| 176 |
function createLink(href, text) {
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
}
|
| 184 |
|
| 185 |
function createCode(text) {
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
}
|
| 190 |
|
| 191 |
function toggleLanguage() {
|
| 192 |
-
|
| 193 |
-
|
| 194 |
}
|
| 195 |
|
| 196 |
-
langToggle.addEventListener(
|
| 197 |
|
| 198 |
updateContent(currentLang);
|
|
|
|
| 5 |
const aboutContent = document.querySelectorAll('#about .card-content p');
|
| 6 |
const featuresContent = document.querySelectorAll('#features .card-content li');
|
| 7 |
const instructionsContent = document.querySelectorAll('#instructions .card-content > *:not(h2)');
|
| 8 |
+
const teamContent = document.querySelector('#info #team p'); // Updated selector
|
| 9 |
+
const linksContent = document.querySelectorAll('#info #links li a'); // Updated selector
|
| 10 |
+
const contactsContent = document.querySelector('#info #contacts p'); // Updated selector
|
| 11 |
const footerContent = document.querySelector('footer p');
|
| 12 |
|
| 13 |
// Demo button elements
|
| 14 |
const demoButtons = document.querySelectorAll('.demo-button');
|
| 15 |
|
| 16 |
const translations = {
|
| 17 |
+
en: {
|
| 18 |
+
title: "GASIFHFS Project",
|
| 19 |
+
subtitle: "Developing a Streamlit-based GUI for browser interaction",
|
| 20 |
+
aboutTitle: "About the Project",
|
| 21 |
+
aboutContent: [
|
| 22 |
+
"GASIFHFS is an open-source project aimed at creating a user-friendly graphical interface based on Streamlit for interacting with Google AI models via API. The project provides token streaming, supports up-to-date models, custom system prompts, image upload, and allows for adjusting the generation temperature and the number of output tokens. It also features support for rendering formulas using KaTeX.",
|
| 23 |
+
"Please note that this website is an informational page for the project. To use the AI directly, please visit our Hugging Face spaces (see Demos below).",
|
| 24 |
+
],
|
| 25 |
+
featuresTitle: "Features",
|
| 26 |
+
features: [
|
| 27 |
+
"Token streaming",
|
| 28 |
+
"Support for up-to-date models",
|
| 29 |
+
"Customizable system prompt",
|
| 30 |
+
"Image upload",
|
| 31 |
+
"Generation temperature setting",
|
| 32 |
+
"Output tokens number setting",
|
| 33 |
+
"LaTeX (KaTeX) support for rendering formulas",
|
| 34 |
+
],
|
| 35 |
+
instructionsTitle: "Instructions",
|
| 36 |
+
instructionsContent: "To run the project, follow these steps:",
|
| 37 |
+
instructions: [
|
| 38 |
+
"Clone the repository: ",
|
| 39 |
+
"Navigate to the project directory: ",
|
| 40 |
+
"Install the dependencies: ",
|
| 41 |
+
"Run the application: ",
|
| 42 |
+
],
|
| 43 |
+
instructionsCode: [
|
| 44 |
+
"git clone https://github.com/SparkleSavvy/GASIFHFS.git",
|
| 45 |
+
"cd GASIFHFS",
|
| 46 |
+
"pip install -r requirements.txt",
|
| 47 |
+
"streamlit run app.py",
|
| 48 |
+
],
|
| 49 |
+
instructionsContent2:
|
| 50 |
+
"A detailed description of the features and settings is available in the ",
|
| 51 |
+
instructionsLink: "README",
|
| 52 |
+
teamTitle: "Developer",
|
| 53 |
+
teamContent: "The project is developed by ",
|
| 54 |
+
teamLink: "SparkleSavvy",
|
| 55 |
+
linksTitle: "Links",
|
| 56 |
+
links: ["GitHub Repository", "Hugging Face Space"],
|
| 57 |
+
linksHrefs: [
|
| 58 |
+
"https://github.com/SparkleSavvy/GASIFHFS",
|
| 59 |
+
"https://huggingface.co/spaces/DEADS1KE/GASIFHFS",
|
| 60 |
+
],
|
| 61 |
+
contactsTitle: "Contacts",
|
| 62 |
+
contactsContent: "Discord: deads1ke",
|
| 63 |
+
footer: "© 2023 SparkleSavvy. GASIFHFS Project",
|
| 64 |
+
langToggle: "EN",
|
| 65 |
+
demosTitle: "Demos",
|
| 66 |
+
demos: [
|
| 67 |
+
{
|
| 68 |
+
buttonText: "Try GASIFHFS",
|
| 69 |
+
summary: "More Info",
|
| 70 |
+
description:
|
| 71 |
+
"This is the general-purpose version of GASIFHFS. It allows you to interact with various Gemini models, upload images, customize settings (temperature, max tokens, system prompt), and more.",
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
buttonText: "Try GASIFHFS-MATH",
|
| 75 |
+
summary: "More Info",
|
| 76 |
+
description:
|
| 77 |
+
"This is a specialized version of GASIFHFS designed for mathematical problem-solving. It uses a pre-configured system prompt to encourage the model to provide solutions with LaTeX formatting. It also supports multi-language responses.",
|
| 78 |
+
},
|
| 79 |
+
],
|
| 80 |
+
infoTitle: "Information", // Added title for grouped section
|
| 81 |
+
},
|
| 82 |
+
ru: {
|
| 83 |
+
title: "Проект GASIFHFS",
|
| 84 |
+
subtitle:
|
| 85 |
+
"Разработка графического интерфейса на базе Streamlit для работы в браузере",
|
| 86 |
+
aboutTitle: "О проекте",
|
| 87 |
+
aboutContent: [
|
| 88 |
+
"GASIFHFS - это проект с открытым исходным кодом, целью которого является создание удобного графического интерфейса на базе Streamlit для взаимодействия с ИИ моделями от Google через API. Проект предоставляет возможность стриминга токенов, поддерживает актуальные модели, системный промпт, загрузку изображений, а также настройку температуры и количества выходных токенов. Также реализована поддержка рендеринга формул с использованием KaTeX.",
|
| 89 |
+
"Обратите внимание, что этот сайт является информационной страницей проекта. Для непосредственного использования ИИ, пожалуйста, перейдите в наши пространства Hugging Face (см. Демо).",
|
| 90 |
+
],
|
| 91 |
+
featuresTitle: "Особенности",
|
| 92 |
+
features: [
|
| 93 |
+
"Стриминг токенов",
|
| 94 |
+
"Поддержка актуальных моделей",
|
| 95 |
+
"Настраиваемый системный промпт",
|
| 96 |
+
"Загрузка изображений",
|
| 97 |
+
"Настройка температуры генерации",
|
| 98 |
+
"Настройка количества выходных токенов",
|
| 99 |
+
"Поддержка LaTeX (KaTeX) для отображения формул",
|
| 100 |
+
],
|
| 101 |
+
instructionsTitle: "Инструкции",
|
| 102 |
+
instructionsContent: "Чтобы запустить проект, выполните следующие действия:",
|
| 103 |
+
instructions: [
|
| 104 |
+
"Склонируйте репозиторий: ",
|
| 105 |
+
"Перейдите в каталог проекта: ",
|
| 106 |
+
"Установите зависимости: ",
|
| 107 |
+
"Запустите приложение: ",
|
| 108 |
+
],
|
| 109 |
+
instructionsCode: [
|
| 110 |
+
"git clone https://github.com/SparkleSavvy/GASIFHFS.git",
|
| 111 |
+
"cd GASIFHFS",
|
| 112 |
+
"pip install -r requirements.txt",
|
| 113 |
+
"streamlit run app.py",
|
| 114 |
+
],
|
| 115 |
+
instructionsContent2:
|
| 116 |
+
"Подробное описание функций и настроек доступно в ",
|
| 117 |
+
instructionsLink: "README",
|
| 118 |
+
teamTitle: "Разработчик",
|
| 119 |
+
teamContent: "Проект разработан ",
|
| 120 |
+
teamLink: "SparkleSavvy",
|
| 121 |
+
linksTitle: "Ссылки",
|
| 122 |
+
links: ["GitHub репозиторий", "Hugging Face Space"],
|
| 123 |
+
linksHrefs: [
|
| 124 |
+
"https://github.com/SparkleSavvy/GASIFHFS",
|
| 125 |
+
"https://huggingface.co/spaces/DEADS1KE/GASIFHFS",
|
| 126 |
+
],
|
| 127 |
+
contactsTitle: "Контакты",
|
| 128 |
+
contactsContent: "Discord: deads1ke",
|
| 129 |
+
footer: "© 2025 SparkleSavvy. Проект GASIFHFS",
|
| 130 |
+
langToggle: "RU",
|
| 131 |
+
demosTitle: "Демо",
|
| 132 |
+
demos: [
|
| 133 |
+
{
|
| 134 |
+
buttonText: "Попробовать GASIFHFS",
|
| 135 |
+
summary: "Подробнее",
|
| 136 |
+
description:
|
| 137 |
+
"Это универсальная версия GASIFHFS. Она позволяет взаимодействовать с различными моделями Gemini, загружать изображения, настраивать параметры (температуру, максимальное количество токенов, системный промпт) и многое другое.",
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
buttonText: "Попробовать GASIFHFS-MATH",
|
| 141 |
+
summary: "Подробнее",
|
| 142 |
+
description:
|
| 143 |
+
"Это специализированная версия GASIFHFS, предназ��аченная для решения математических задач. В ней используется предварительно настроенный системный промпт, побуждающий модель предоставлять решения с использованием LaTeX-форматирования. Также поддерживаются ответы на разных языках.",
|
| 144 |
+
},
|
| 145 |
+
],
|
| 146 |
+
infoTitle: "Информация", // Added title for grouped section
|
| 147 |
+
},
|
| 148 |
};
|
| 149 |
|
| 150 |
+
let currentLang = "en";
|
| 151 |
|
|
|
|
| 152 |
function handleDemoButtonClick(event) {
|
| 153 |
+
const url = event.target.dataset.href;
|
| 154 |
+
if (url) {
|
| 155 |
+
window.open(url, "_blank");
|
| 156 |
+
}
|
| 157 |
}
|
| 158 |
|
| 159 |
+
demoButtons.forEach((button) => {
|
| 160 |
+
button.addEventListener("click", handleDemoButtonClick);
|
|
|
|
| 161 |
});
|
| 162 |
|
| 163 |
function updateContent(lang) {
|
| 164 |
+
const translation = translations[lang];
|
| 165 |
+
|
| 166 |
+
title.textContent = translation.title;
|
| 167 |
+
subtitle.textContent = translation.subtitle;
|
| 168 |
+
|
| 169 |
+
// About Section
|
| 170 |
+
document.querySelector("#about .card-title").textContent = translation.aboutTitle;
|
| 171 |
+
aboutContent[0].textContent = translation.aboutContent[0];
|
| 172 |
+
aboutContent[1].textContent = translation.aboutContent[1];
|
| 173 |
+
|
| 174 |
+
// Features Section
|
| 175 |
+
document.querySelector("#features .card-title").textContent =
|
| 176 |
+
translation.featuresTitle;
|
| 177 |
+
featuresContent.forEach((li, index) => {
|
| 178 |
+
li.textContent = translation.features[index];
|
| 179 |
+
if (index === 6) {
|
| 180 |
+
li.innerHTML =
|
| 181 |
+
'<span class="katex">LaTeX</span> (KaTeX) support for rendering formulas';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
}
|
| 183 |
+
});
|
| 184 |
+
|
| 185 |
+
// Instructions Section
|
| 186 |
+
document.querySelector("#instructions .card-title").textContent =
|
| 187 |
+
translation.instructionsTitle;
|
| 188 |
+
instructionsContent[0].textContent = translation.instructionsContent;
|
| 189 |
|
| 190 |
+
const ol = document.createElement("ol");
|
| 191 |
+
for (let i = 0; i < translation.instructions.length; i++) {
|
| 192 |
+
const li = document.createElement("li");
|
| 193 |
+
li.textContent = translation.instructions[i];
|
| 194 |
+
li.appendChild(createCode(translation.instructionsCode[i]));
|
| 195 |
+
ol.appendChild(li);
|
| 196 |
+
}
|
| 197 |
+
const existingOl = instructionsContent[1].querySelector("ol");
|
| 198 |
+
if (existingOl) {
|
| 199 |
+
instructionsContent[1].removeChild(existingOl);
|
| 200 |
+
}
|
| 201 |
+
instructionsContent[1].appendChild(ol);
|
| 202 |
|
| 203 |
+
instructionsContent[2].textContent = translation.instructionsContent2;
|
| 204 |
+
instructionsContent[2].appendChild(
|
| 205 |
+
createLink(
|
| 206 |
+
"https://github.com/SparkleSavvy/GASIFHFS/blob/main/README.md",
|
| 207 |
+
translation.instructionsLink
|
| 208 |
+
)
|
| 209 |
+
);
|
| 210 |
+
|
| 211 |
+
// Info Section (Grouped)
|
| 212 |
+
document.querySelector("#info .card-title").textContent = translation.infoTitle;
|
| 213 |
teamContent.textContent = translation.teamContent;
|
| 214 |
teamContent.appendChild(createLink('https://github.com/SparkleSavvy', translation.teamLink));
|
|
|
|
|
|
|
|
|
|
| 215 |
linksContent[0].textContent = "";
|
| 216 |
linksContent[0].appendChild(createLink(translation.linksHrefs[0], translation.links[0]));
|
| 217 |
linksContent[1].textContent = "";
|
| 218 |
linksContent[1].appendChild(createLink(translation.linksHrefs[1], translation.links[1]));
|
|
|
|
|
|
|
|
|
|
| 219 |
contactsContent.textContent = translation.contactsContent;
|
| 220 |
|
| 221 |
+
|
| 222 |
+
// Footer
|
| 223 |
+
footerContent.textContent = translation.footer;
|
| 224 |
+
|
| 225 |
+
// Language Toggle
|
| 226 |
+
langToggleText.textContent = translation.langToggle;
|
| 227 |
+
document.documentElement.lang = currentLang;
|
| 228 |
+
|
| 229 |
+
// Demos Section
|
| 230 |
+
document.querySelector("#demos .card-title").textContent =
|
| 231 |
+
translation.demosTitle;
|
| 232 |
+
const demoContainers = document.querySelectorAll("#demos .demo-container");
|
| 233 |
+
demoContainers.forEach((container, index) => {
|
| 234 |
+
const button = container.querySelector(".demo-button");
|
| 235 |
+
const details = container.querySelector("details");
|
| 236 |
+
const summary = details.querySelector("summary");
|
| 237 |
+
const description = details.querySelector("p");
|
| 238 |
+
|
| 239 |
+
button.textContent = translation.demos[index].buttonText;
|
| 240 |
+
summary.textContent = translation.demos[index].summary;
|
| 241 |
+
description.textContent = translation.demos[index].description;
|
| 242 |
+
});
|
| 243 |
}
|
| 244 |
|
| 245 |
function createLink(href, text) {
|
| 246 |
+
const link = document.createElement("a");
|
| 247 |
+
link.href = href;
|
| 248 |
+
link.textContent = text;
|
| 249 |
+
link.target = "_blank";
|
| 250 |
+
link.rel = "noopener noreferrer";
|
| 251 |
+
return link;
|
| 252 |
}
|
| 253 |
|
| 254 |
function createCode(text) {
|
| 255 |
+
const code = document.createElement("code");
|
| 256 |
+
code.textContent = text;
|
| 257 |
+
return code;
|
| 258 |
}
|
| 259 |
|
| 260 |
function toggleLanguage() {
|
| 261 |
+
currentLang = currentLang === "en" ? "ru" : "en";
|
| 262 |
+
updateContent(currentLang);
|
| 263 |
}
|
| 264 |
|
| 265 |
+
langToggle.addEventListener("click", toggleLanguage);
|
| 266 |
|
| 267 |
updateContent(currentLang);
|