gpt-4o-2024-08-06· OpenAI
WildChat-4.8M (AI2)
Пожалуйста, сформируй полный HTML-код (ничего не пропускай), выделив его обратными…
- User
Пожалуйста, сформируй полный HTML-код (ничего не пропускай), выделив его обратными тройными кавычками, для следующего запроса: "Перепиши код на модульную структуру. Обязательно должен быть модуль перевода, который хранит в себе объект всех переводов". В прошлой итерации код выглядел следующим образом: "
#container { width: 90%; max-width: 600px; display: flex; flex-direction: column; align-items: center; gap: 15px; height: 90%; box-sizing: border-box; } h1 { margin: 0; font-size: 2.5em; color: #333; } #language-switch { position: absolute; top: 10px; right: 10px; width: 80px; user-select: none; } .custom-select { position: relative; display: inline-block; } .select-selected { background-color: #4CAF50; color: white; padding: 8px 12px; border-radius: 8px; cursor: pointer; text-align: center; transition: background-color 0.3s ease; } .select-selected:hover { background-color: #45a049; } .select-items { position: absolute; background-color: white; border: 1px solid #ddd; border-radius: 8px; width: 100%; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); z-index: 99; display: none; animation: slideDown 0.3s forwards; } .select-items.open { display: block; animation: slideDown 0.3s forwards; } .select-items div { color: #333; padding: 8px 12px; cursor: pointer; transition: background-color 0.3s; } .select-items div:hover { background-color: #f1f1f1; } textarea { width: 100%; flex-grow: 1; resize: none; padding: 10px; font-size: 1em; border-radius: 8px; border: 1px solid #ccc; box-sizing: border-box; min-height: 100px; max-height: 200px; } textarea:focus { outline: none; border-color: blue; } button { padding: 10px 20px; font-size: 1.2em; border-radius: 8px; border: none; background-color: #4CAF50; color: white; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #45a049; } @keyframes slideDown { from { max-height: 0; opacity: 0; } to { max-height: 500px; opacity: 1; } } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } </style><script> function switchLanguage(language) { const textElements = { title: { ru: "AI Stories", en: "AI Stories" }, button: { ru: "Придумать историю", en: "Generate Story" }, placeholder: { ru: "Введите текст здесь...", en: "Enter text here..." } }; document.querySelector('h1').innerText = textElements.title[language]; document.querySelector('button').innerText = textElements.button[language]; document.querySelector('textarea').placeholder = textElements.placeholder[language]; } document.addEventListener('DOMContentLoaded', () => { const selected = document.querySelector('.select-selected'); const items = document.querySelector('.select-items'); selected.addEventListener('click', function() { items.classList.toggle('open'); }); document.querySelectorAll('.select-items div').forEach(item => { item.addEventListener('click', function() { selected.textContent = this.textContent; items.classList.remove('open'); switchLanguage(this.getAttribute('data-value')); }); }); document.addEventListener('click', function(e) { if (!e.target.closest('.custom-select')) { items.classList.remove('open'); } }); document.getElementById('generate-story').addEventListener('click', () => { const storyInput = document.getElementById('story-input').value; const currentLanguage = document.querySelector('.select-selected').textContent.toLowerCase(); const prompt = `Придумай историю на основе запроса "${storyInput}" на языке "${currentLanguage}"`; requestAI(prompt, { responseCallback: ({ data, modData, message }) => { console.log('Response message:', message); }, errorCallback: ({ message }) => { console.error(message); }, }); }); }); function requestAI(prompt, { url = 'https://nexra.aryahcr.cc/api/chat/complements', model = 'gpt-4o', stream = false, markdown = false, type = 'text', messages = [], responseCallback = () => {}, successCallback = () => {}, errorCallback = () => {}, } = {}) { if (type === 'text') { messages.push({ role: 'user', content: prompt }); let body = { messages, model, stream, markdown, }; if (url.indexOf('/gptweb') !== -1) { body = { prompt, markdown, }; } if (messages.length > 1 && model === 'llama-3.1') { body.messages = [{ role: 'user', content: JSON.stringify({ messages: messages }) }]; } if (model === 'Bing') { body['conversation_style'] = 'balanced'; } if (model === 'blackbox') { body['websearch'] = false; } fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(body), }).then(response => response.text()).then((data) => { const modData = JSON.parse(data.slice(data.indexOf('{'))); const message = modData.message || modData.gpt; responseCallback({ data, modData, message, isStream: stream, isStreaming: false }); successCallback({ data, modData, message, isStream: stream, isStreaming: false }); }).catch((error) => { errorCallback({ message: `Ошибка в функции requestAI (type: text, stream: false): ${error}`, error }); }); } } </script> - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.