Skip to content
14 changes: 11 additions & 3 deletions src/components/RightSidebar/LlmsLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ interface LlmsLinkProps {
section: string
supportedLanguages: string[]
currentPageLanguage?: string | null
displayName?: string
downloadName?: string
}

// Map section slugs to display names
Expand All @@ -21,7 +23,13 @@ const SECTION_DISPLAY_NAMES: Record<string, string> = {
// Add more as needed
}

export function LlmsLink({ section, supportedLanguages, currentPageLanguage }: LlmsLinkProps) {
export function LlmsLink({
section,
supportedLanguages,
currentPageLanguage,
displayName,
downloadName,
}: LlmsLinkProps) {
// Subscribe to the language store for reactive updates
const storeLanguage = useStore(selectedLanguage)

Expand Down Expand Up @@ -50,13 +58,13 @@ export function LlmsLink({ section, supportedLanguages, currentPageLanguage }: L
} else {
// Single file section - include product name
llmsHref = `/${section}/llms-full.txt`
const productName = SECTION_DISPLAY_NAMES[section] || section.toUpperCase()
const productName = displayName || SECTION_DISPLAY_NAMES[section] || section.toUpperCase()
llmsLabel = `Complete ${productName} docs (TXT)`
}

return (
<li className={styles.headerLink}>
<a href={llmsHref} target="_blank" className={styles.llmsLink}>
<a href={llmsHref} target="_blank" download={downloadName} className={styles.llmsLink}>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
Expand Down
20 changes: 14 additions & 6 deletions src/components/RightSidebar/MoreMenu.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
import * as CONFIG from "../../config"
import { SUPPORTED_LLM_SECTIONS, LLM_SECTIONS_CONFIG } from "../../config/llms"
import { LlmsLink } from "./LlmsLink"
import type { Solution } from "../../config/solutions/index.ts"

const { editHref, frontmatter } = Astro.props
interface Props {
editHref?: string
frontmatter?: { sdkLang?: string }
solution?: Solution
}

const { editHref, frontmatter, solution } = Astro.props
const pathname = Astro.url.pathname
const section = pathname.split("/").filter(Boolean)[0]
// Determine language from frontmatter or filename
Expand All @@ -12,12 +19,11 @@ const filename = pathname.split("/").pop() || ""
const filenameLang = filename.match(/-(go|ts)(?:\/|$)/) ? filename.match(/-(go|ts)(?:\/|$)/)?.[1] : null
const currentPageLang = sdkLang || filenameLang

const showMoreSection = CONFIG.COMMUNITY_INVITE_URL || editHref

// Check if section supports LLMs
const llmsExists = (SUPPORTED_LLM_SECTIONS as readonly string[]).includes(section)
const llmsExists = !!solution || (SUPPORTED_LLM_SECTIONS as readonly string[]).includes(section)
const cfg = LLM_SECTIONS_CONFIG[section as keyof typeof LLM_SECTIONS_CONFIG]
const supportedLanguages = cfg?.languages || []
const supportedLanguages = solution ? [] : cfg?.languages || []
const showMoreSection = llmsExists || CONFIG.COMMUNITY_INVITE_URL || editHref
---

{showMoreSection && <h2 class="heading">More</h2>}
Expand All @@ -26,7 +32,9 @@ const supportedLanguages = cfg?.languages || []
llmsExists && (
<LlmsLink
client:load
section={section}
section={solution ? `solutions/${solution.slug}` : section}
displayName={solution?.title}
downloadName={solution ? `${solution.slug}-llms-full.txt` : undefined}
supportedLanguages={supportedLanguages}
currentPageLanguage={currentPageLang}
/>
Expand Down
19 changes: 4 additions & 15 deletions src/components/Solutions/SolutionDisclaimer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Rendered by SolutionLayout at the end of the main column on EVERY solution page.
// Never import this from an MDX file: legal compliance must not depend on an author
// remembering to paste it.
import { SOLUTION_DISCLAIMER } from "~/config/solutions/disclaimer.ts"
import alertIcon from "~/components/Alert/Assets/alert-icon.svg"
---

Expand All @@ -11,21 +12,9 @@ import alertIcon from "~/components/Alert/Assets/alert-icon.svg"
<h2 class="solution-disclaimer__title">Disclaimer</h2>
</div>
<p class="solution-disclaimer__text">
Please note, this repo contains community examples only — these are not Chainlink products or services and are not
supported or maintained by Chainlink. This code represents an example of using a Chainlink product or service, and
is intended for demonstration and educational purposes only. It is provided “AS IS” and “AS AVAILABLE” without
warranties of any kind, may not have been audited, and may omit checks or error handling. Each party intending to
use this example code does so entirely at their own risk and must perform its own audits, security and code review,
key management, and testing before any production deployment and ensure the operation and performance of such code
matches expectations. Neither Chainlink Labs nor the Chainlink Foundation deploys, operates, monitors, maintains or
endorses any deployment of this code. Note that this is not a Chainlink product, feature or service, and there are
no commitments made with respect to the code, including compatibility with future Chainlink releases. You should not
rely on this code without first conducting your own technical, engineering, and security review. This code is also
outside the scope of any Chainlink bug bounty programs. Neither Chainlink Labs, the Chainlink Foundation, nor
Chainlink node operators are responsible for outcomes due to errors in this example or how it is deployed or
operated, or liable for any resulting claims or damages. Use of the Chainlink Network is subject to the Chainlink
Foundation <a href="https://chain.link/terms">Terms of Service</a>, which provides important information and
disclosures. By using this code, you acknowledge and agree to these terms.
{SOLUTION_DISCLAIMER.beforeTerms}{" "}<a href={SOLUTION_DISCLAIMER.termsUrl}>{SOLUTION_DISCLAIMER.termsLabel}</a>{
SOLUTION_DISCLAIMER.afterTerms
}
</p>
</aside>

Expand Down
3 changes: 3 additions & 0 deletions src/config/llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type LlmsSectionConfig = {
excludeGlobs?: string[]
order?: string[]
languages?: string[] // Supported languages for this section (if applicable)
maxBytes?: number // Optional size ceiling for larger complete corpora; other sections use the validator default.
}

// Central list of sections that expose llms-full.txt or llms-full-[lang].txt
Expand Down Expand Up @@ -48,6 +49,8 @@ export const LLM_SECTIONS_CONFIG: Record<SupportedSection, LlmsSectionConfig> =
ccip: {
root: "src/content/ccip",
includeGlobs: ["**/*.mdx"],
// Preserving all ordered-list and accordion content in the v1/v2 corpus exceeds the default 5 MB limit.
maxBytes: 8_000_000,
},
"data-feeds": {
root: "src/content/data-feeds",
Expand Down
9 changes: 9 additions & 0 deletions src/config/solutions/disclaimer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** Single source for the disclaimer shown on solution pages and in their Markdown/TXT exports. */
export const SOLUTION_DISCLAIMER = {
beforeTerms:
"Please note, this repo contains community examples only — these are not Chainlink products or services and are not supported or maintained by Chainlink. This code represents an example of using a Chainlink product or service, and is intended for demonstration and educational purposes only. It is provided “AS IS” and “AS AVAILABLE” without warranties of any kind, may not have been audited, and may omit checks or error handling. Each party intending to use this example code does so entirely at their own risk and must perform its own audits, security and code review, key management, and testing before any production deployment and ensure the operation and performance of such code matches expectations. Neither Chainlink Labs nor the Chainlink Foundation deploys, operates, monitors, maintains or endorses any deployment of this code. Note that this is not a Chainlink product, feature or service, and there are no commitments made with respect to the code, including compatibility with future Chainlink releases. You should not rely on this code without first conducting your own technical, engineering, and security review. This code is also outside the scope of any Chainlink bug bounty programs. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for outcomes due to errors in this example or how it is deployed or operated, or liable for any resulting claims or damages. Use of the Chainlink Network is subject to the Chainlink Foundation",
termsLabel: "Terms of Service",
termsUrl: "https://chain.link/terms",
afterTerms:
", which provides important information and disclosures. By using this code, you acknowledge and agree to these terms.",
} as const
Loading
Loading