DEADS1KE commited on
Commit
2d8ced5
·
verified ·
1 Parent(s): bf2fc92

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +221 -152
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 .card-content p');
9
- const linksContent = document.querySelectorAll('#links .card-content li a');
10
- const contactsContent = document.querySelector('#contacts .card-content p');
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: ["Token streaming", "Support for up-to-date models", "Customizable system prompt", "Image upload", "Generation temperature setting", "Output tokens number setting", "LaTeX (KaTeX) support for rendering formulas"],
27
- instructionsTitle: "Instructions",
28
- instructionsContent: "To run the project, follow these steps:",
29
- instructions: ["Clone the repository: ", "Navigate to the project directory: ", "Install the dependencies: ", "Run the application: "],
30
- instructionsCode: ["git clone https://github.com/SparkleSavvy/GASIFHFS.git", "cd GASIFHFS", "pip install -r requirements.txt", "streamlit run app.py"],
31
- instructionsContent2: "A detailed description of the features and settings is available in the ",
32
- instructionsLink: "README",
33
- teamTitle: "Developer",
34
- teamContent: "The project is developed by ",
35
- teamLink: "SparkleSavvy",
36
- linksTitle: "Links",
37
- links: ["GitHub Repository", "Hugging Face Space"],
38
- linksHrefs: ["https://github.com/SparkleSavvy/GASIFHFS", "https://huggingface.co/spaces/DEADS1KE/GASIFHFS"],
39
- contactsTitle: "Contacts",
40
- contactsContent: "Discord: deads1ke",
41
- footer: "© 2023 SparkleSavvy. GASIFHFS Project",
42
- langToggle: "EN",
43
- demosTitle: "Demos", // Added demos title
44
- demos: [ // Added demos descriptions
45
- { buttonText: "Try GASIFHFS", summary: "More Info", description: "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." },
46
- { buttonText: "Try GASIFHFS-MATH", summary: "More Info", description: "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." },
47
- ]
48
- },
49
- ru: {
50
- title: "Проект GASIFHFS",
51
- subtitle: "Разработка графического интерфейса на базе Streamlit для работы в браузере",
52
- aboutTitle: "О проекте",
53
- aboutContent: [
54
- "GASIFHFS - это проект с открытым исходным кодом, целью которого является создание удобного графического интерфейса на базе Streamlit для взаимодействия с ИИ моделями от Google через API. Проект предоставляет возможность стриминга токенов, поддерживает актуальные модели, системный промпт, загрузку изображений, а также настройку температуры и количества выходных токенов. Также реализована поддержка рендеринга формул с использованием KaTeX.",
55
- "Обратите внимание, что этот сайт является информационной страницей проекта. Для непосредственного испол��зования ИИ, пожалуйста, перейдите в наши пространства Hugging Face (см. Демо).",
56
- ],
57
- featuresTitle: "Особенности",
58
- features: ["Стриминг токенов", "Поддержка актуальных моделей", "Настраиваемый системный промпт", "Загрузка изображений", "Настройка температуры генерации", "Настройка количества выходных токенов", "Поддержка LaTeX (KaTeX) для отображения формул"],
59
- instructionsTitle: "Инструкции",
60
- instructionsContent: "Чтобы запустить проект, выполните следующие действия:",
61
- instructions: ["Склонируйте репозиторий: ", "Перейдите в каталог проекта: ", "Установите зависимости: ", "Запустите приложение: "],
62
- instructionsCode: ["git clone https://github.com/SparkleSavvy/GASIFHFS.git", "cd GASIFHFS", "pip install -r requirements.txt", "streamlit run app.py"],
63
- instructionsContent2: "Подробное описание функций и настроек доступно в ",
64
- instructionsLink: "README",
65
- teamTitle: "Разработчик",
66
- teamContent: "Проект разработан ",
67
- teamLink: "SparkleSavvy",
68
- linksTitle: "Ссылки",
69
- links: ["GitHub репозиторий", "Hugging Face Space"],
70
- linksHrefs: ["https://github.com/SparkleSavvy/GASIFHFS", "https://huggingface.co/spaces/DEADS1KE/GASIFHFS"],
71
- contactsTitle: "Контакты",
72
- contactsContent: "Discord: deads1ke",
73
- footer: "© 2023 SparkleSavvy. Проект GASIFHFS",
74
- langToggle: "RU",
75
- demosTitle: "Демо", // Added demos title
76
- demos: [ // Added demos descriptions
77
- { buttonText: "Попробовать GASIFHFS", summary: "Подробнее", description: "Это универсальная версия GASIFHFS. Она позволяет взаимодействовать с различными моделями Gemini, загружать изображения, настраивать параметры (температуру, максимальное количество токенов, системный промпт) и многое другое." },
78
- { buttonText: "Попробовать GASIFHFS-MATH", summary: "Подробнее", description: "Это специализированная версия GASIFHFS, предназначенная для решения математических задач. В ней используется предварительно настроенный системный промпт, побуждающий модель предоставлять решения с использованием LaTeX-форматирования. Также поддерживаются ответы на разных языках." },
79
- ]
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  };
82
 
83
- let currentLang = 'en';
84
 
85
- // Function to handle demo button clicks
86
  function handleDemoButtonClick(event) {
87
- const url = event.target.dataset.href;
88
- if (url) {
89
- window.open(url, '_blank'); // Open in a new tab
90
- }
91
  }
92
 
93
- // Attach click event listeners to demo buttons
94
- demoButtons.forEach(button => {
95
- button.addEventListener('click', handleDemoButtonClick);
96
  });
97
 
98
  function updateContent(lang) {
99
- const translation = translations[lang];
100
-
101
- title.textContent = translation.title;
102
- subtitle.textContent = translation.subtitle;
103
-
104
- // About Section
105
- document.querySelector('#about .card-title').textContent = translation.aboutTitle;
106
- aboutContent[0].textContent = translation.aboutContent[0];
107
- aboutContent[1].textContent = translation.aboutContent[1];
108
-
109
- // Features Section
110
- document.querySelector('#features .card-title').textContent = translation.featuresTitle;
111
- featuresContent.forEach((li, index) => {
112
- li.textContent = translation.features[index];
113
- if (index === 6) {
114
- li.innerHTML = '<span class="katex">LaTeX</span> (KaTeX) support for rendering formulas'; // Keep KaTeX
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
- instructionsContent[1].appendChild(ol);
 
 
 
 
 
134
 
135
- instructionsContent[2].textContent = translation.instructionsContent2;
136
- instructionsContent[2].appendChild(createLink('https://github.com/SparkleSavvy/GASIFHFS/blob/main/README.md', translation.instructionsLink));
 
 
 
 
 
 
 
 
 
 
137
 
138
- // Team Section
139
- document.querySelector('#team .card-title').textContent = translation.teamTitle;
 
 
 
 
 
 
 
 
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
- // Footer
155
- footerContent.textContent = translation.footer;
156
-
157
- // Language Toggle
158
- langToggleText.textContent = translation.langToggle;
159
- document.documentElement.lang = currentLang;
160
-
161
- // Demos Section
162
- document.querySelector('#demos .card-title').textContent = translation.demosTitle;
163
- const demoContainers = document.querySelectorAll('#demos .demo-container');
164
- demoContainers.forEach((container, index) => {
165
- const button = container.querySelector('.demo-button');
166
- const details = container.querySelector('details');
167
- const summary = details.querySelector('summary');
168
- const description = details.querySelector('p');
169
-
170
- button.textContent = translation.demos[index].buttonText;
171
- summary.textContent = translation.demos[index].summary;
172
- description.textContent = translation.demos[index].description;
173
- });
 
 
174
  }
175
 
176
  function createLink(href, text) {
177
- const link = document.createElement('a');
178
- link.href = href;
179
- link.textContent = text;
180
- link.target = "_blank";
181
- link.rel = "noopener noreferrer";
182
- return link;
183
  }
184
 
185
  function createCode(text) {
186
- const code = document.createElement('code');
187
- code.textContent = text;
188
- return code;
189
  }
190
 
191
  function toggleLanguage() {
192
- currentLang = currentLang === 'en' ? 'ru' : 'en';
193
- updateContent(currentLang);
194
  }
195
 
196
- langToggle.addEventListener('click', toggleLanguage);
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);