{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'GitHub加速' && linkText !== 'GitHub加速' ) { link.textContent = 'GitHub加速'; link.href = 'https://githubproxy.cc'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== 'Vibevoice' ) { link.textContent = 'Vibevoice'; link.href = 'https://vibevoice.info/'; replacedLinks.add(link); } // 替换Pricing链接 - 仅替换一次 else if ( (linkHref.includes('/pricing') || linkHref === '/pricing' || linkText === 'Pricing' || linkText.match(/^s*Pricings*$/i)) && linkText !== 'SoraWatermarkRemover' ) { link.textContent = 'SoraWatermarkRemover'; link.href = 'https://sora2watermarkremover.net/'; replacedLinks.add(link); } // 替换Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) && linkText !== 'VoxCPM' ) { link.textContent = 'VoxCPM'; link.href = 'https://voxcpm.net'; replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'GitHub加速'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n```\n1. Centered variant:\n```html\n\n\n\n \n \n Layout Component - Centered\n \n\n\n
\n
\n
\n This is an example of a centered layout component. The text is automatically centered under the container.\n
\n
\n
\n\n\n```\nIn these examples, the first variant has a full-width container with text that is centered under it. The second variant has a centered container with rounded edges. Both variants showcase the functionality of TailwindCSS by demonstrating its ability to apply responsive design, color variables and utility classes.\n\nFeel free to modify this layout component to fit your requirements and personal preferences. Happy coding!","role":"assistant"}],"string":"[\n {\n \"content\": \"I would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered.\",\n \"role\": \"user\"\n },\n {\n \"content\": \"As an AI assistant, I'm here to help you create a layout component styled with TailwindCSS. You can refer to the documentation for more information on how to use TailwindCSS. However, to help you get started, here is a basic layout component with two variants - full-width and centered.\\n\\n1. Full-width variant:\\n```html\\n\\n\\n\\n \\n \\n Layout Component - Full-width\\n \\n\\n\\n
\\n
\\n
\\n This is an example of a full-width layout component. The text is automatically centered under the container.\\n
\\n
\\n
\\n\\n\\n```\\n1. Centered variant:\\n```html\\n\\n\\n\\n \\n \\n Layout Component - Centered\\n \\n\\n\\n
\\n
\\n
\\n This is an example of a centered layout component. The text is automatically centered under the container.\\n
\\n
\\n
\\n\\n\\n```\\nIn these examples, the first variant has a full-width container with text that is centered under it. The second variant has a centered container with rounded edges. Both variants showcase the functionality of TailwindCSS by demonstrating its ability to apply responsive design, color variables and utility classes.\\n\\nFeel free to modify this layout component to fit your requirements and personal preferences. Happy coding!\",\n \"role\": \"assistant\"\n }\n]"},"rejected":{"kind":"list like","value":[{"content":"I would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered.","role":"user"},{"content":"Hello! I'd be happy to help you create a layout component styled with TailwindCSS. To ensure that my responses are safe, respectful, and factually consistent, I'll be following the guidelines you've outlined.\n\nTo create a layout component with two variants (full-width and centered), we can use Tailwind's built-in utility classes. Here's an example of how you could do this:\n\nFirst, create a new component in your Tailwind project called `LayoutComponent.vue`. In this component, you'll need to define the two variants of the layout that you want to use. You can do this using two separate classes, one for the full-width variant and one for the centered variant.\n```html\n\n\n\n```\nIn this example, we're defining two utility classes: `w-full` and `md-w-1/2`. The `w-full` class sets the width to 100%, while the `md-w-1/2` class sets the width to 50% on medium-sized screens and above.\n\nNext, you can use these classes in your components to apply the appropriate layout for each variant. For example:\n```html\n\n```\nIn this example, we're using the `w-full` and `md-w-1/2` classes to apply the full-width and centered layouts to the content within the `LayoutComponent` component.\n\nThat's it! With these utility classes, you can easily create two variants of a layout component using TailwindCSS.\n\nRemember to always use factual and accurate information when creating your components, and avoid using harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. If you have any further questions or need additional assistance, please don't hesitate to ask.","role":"assistant"}],"string":"[\n {\n \"content\": \"I would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered.\",\n \"role\": \"user\"\n },\n {\n \"content\": \"Hello! I'd be happy to help you create a layout component styled with TailwindCSS. To ensure that my responses are safe, respectful, and factually consistent, I'll be following the guidelines you've outlined.\\n\\nTo create a layout component with two variants (full-width and centered), we can use Tailwind's built-in utility classes. Here's an example of how you could do this:\\n\\nFirst, create a new component in your Tailwind project called `LayoutComponent.vue`. In this component, you'll need to define the two variants of the layout that you want to use. You can do this using two separate classes, one for the full-width variant and one for the centered variant.\\n```html\\n\\n\\n\\n```\\nIn this example, we're defining two utility classes: `w-full` and `md-w-1/2`. The `w-full` class sets the width to 100%, while the `md-w-1/2` class sets the width to 50% on medium-sized screens and above.\\n\\nNext, you can use these classes in your components to apply the appropriate layout for each variant. For example:\\n```html\\n\\n```\\nIn this example, we're using the `w-full` and `md-w-1/2` classes to apply the full-width and centered layouts to the content within the `LayoutComponent` component.\\n\\nThat's it! With these utility classes, you can easily create two variants of a layout component using TailwindCSS.\\n\\nRemember to always use factual and accurate information when creating your components, and avoid using harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. If you have any further questions or need additional assistance, please don't hesitate to ask.\",\n \"role\": \"assistant\"\n }\n]"},"messages":{"kind":"list like","value":[{"content":"I would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered.","role":"user"},{"content":"As an AI assistant, I'm here to help you create a layout component styled with TailwindCSS. You can refer to the documentation for more information on how to use TailwindCSS. However, to help you get started, here is a basic layout component with two variants - full-width and centered.\n\n1. Full-width variant:\n```html\n\n\n\n \n \n Layout Component - Full-width\n \n\n\n
\n
\n
\n This is an example of a full-width layout component. The text is automatically centered under the container.\n
\n
\n
\n\n\n```\n1. Centered variant:\n```html\n\n\n\n \n \n Layout Component - Centered\n \n\n\n
\n
\n
\n This is an example of a centered layout component. The text is automatically centered under the container.\n
\n
\n
\n\n\n```\nIn these examples, the first variant has a full-width container with text that is centered under it. The second variant has a centered container with rounded edges. Both variants showcase the functionality of TailwindCSS by demonstrating its ability to apply responsive design, color variables and utility classes.\n\nFeel free to modify this layout component to fit your requirements and personal preferences. Happy coding!","role":"assistant"}],"string":"[\n {\n \"content\": \"I would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered.\",\n \"role\": \"user\"\n },\n {\n \"content\": \"As an AI assistant, I'm here to help you create a layout component styled with TailwindCSS. You can refer to the documentation for more information on how to use TailwindCSS. However, to help you get started, here is a basic layout component with two variants - full-width and centered.\\n\\n1. Full-width variant:\\n```html\\n\\n\\n\\n \\n \\n Layout Component - Full-width\\n \\n\\n\\n
\\n
\\n
\\n This is an example of a full-width layout component. The text is automatically centered under the container.\\n
\\n
\\n
\\n\\n\\n```\\n1. Centered variant:\\n```html\\n\\n\\n\\n \\n \\n Layout Component - Centered\\n \\n\\n\\n
\\n
\\n
\\n This is an example of a centered layout component. The text is automatically centered under the container.\\n
\\n
\\n
\\n\\n\\n```\\nIn these examples, the first variant has a full-width container with text that is centered under it. The second variant has a centered container with rounded edges. Both variants showcase the functionality of TailwindCSS by demonstrating its ability to apply responsive design, color variables and utility classes.\\n\\nFeel free to modify this layout component to fit your requirements and personal preferences. Happy coding!\",\n \"role\": \"assistant\"\n }\n]"},"score_chosen":{"kind":"number","value":7.5,"string":"7.5"},"score_rejected":{"kind":"number","value":6,"string":"6"},"reference_response":{"kind":"string","value":"<|system|>\n \n<|user|>\nI would like to create a layout component styled with tailwindcss. The component should have two variants, full-width and centered. \n<|assistant|>\nHere's a simple example:\n\nHTML:\n\n```html\n
\n

My Layout Component

\n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean commodo, magna vel rhoncus fringilla, lorem nulla ullamcorper, vel sagittis sapien nec massa. Etiam bibendum ex ipsum, quis tincidunt nisi interdum sit amet.\n

\n
\n $49.99\n \n
\n
\n```\n\nCSS:\n\n```css\n/* Full-width variant */\n.full-width {\n width: 100%;\n}\n\n/* Centered variant */\n.centered {\n margin: 50px auto;\n max-width: 720px;\n}\n```\n\nJavaScript:\n\n```javascript\n// Example usage\nconst fullWidth = document.getElementById('full-width');\nconst centered = document.getElementById('centered');\n\nfullWidth.classList.add('full-width');\ncentered.classList.add('centered');\n```\n\nIn this example, we define a flex container with some styles and basic content (a heading, a price, and a button). We then add two classes that define the layout variations: `.full-width` and `.centered`.\n\nTo use these variations in the HTML, we add the `.full-width` class to the `div` element that wraps the content and the `.centered` class to another `div` element that will be centered on the page.\n\nFinally, we can set the class based on user input or any other condition using JavaScript. In this example, we use `getElementById` to select the HTML elements by their ID and call `addClass` to add the respective class."},"resp0":{"kind":"string","value":"Sure! Here's an example of how you could create a layout component with two variants using Tailwind CSS:\n\n```\n\n\n\n\n\n```\n\nIn this example, we have defined two CSS classes for the container element: `.container` for the default full-width variant and `.container.centered` for the centered variant. These classes set the maximum width and margin of the container, as well as the text alignment for the centered variant.\n\nIn the template, we have a `
` section with a button that toggles the `.container` class between the two variants. We also have a `
` section that contains your content and a `