mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +00:00
docs: v0.2 deprecation warning (#26509)
This commit is contained in:
parent
8b7843b343
commit
cfd11b2c34
@ -126,10 +126,8 @@ const config = {
|
|||||||
({
|
({
|
||||||
announcementBar: {
|
announcementBar: {
|
||||||
content:
|
content:
|
||||||
'Share your thoughts on AI agents. <a target="_blank" href="https://langchain.typeform.com/state-of-agents">Take the 3-min survey</a>.',
|
'A newer LangChain version is out! Check out the <a href="https://python.langchain.com/docs/introduction">latest version</a>.',
|
||||||
isCloseable: true,
|
isCloseable: false,
|
||||||
backgroundColor: "rgba(53, 151, 147, 0.1)",
|
|
||||||
textColor: "rgb(53, 151, 147)",
|
|
||||||
},
|
},
|
||||||
docs: {
|
docs: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
|
@ -248,16 +248,26 @@ nav, h1, h2, h3, h4 {
|
|||||||
no-repeat;
|
no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
div[class^=announcementBar_] {
|
div[class^='announcementBar_'] {
|
||||||
height:40px !important;
|
font-size: 20px;
|
||||||
font-size: 20px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-theme='dark'] div[class^=announcementBar_] {
|
/*
|
||||||
background-color: #1b1b1b;
|
--site-announcement-bar-stripe-color1: hsl(
|
||||||
color: #fff;
|
var(--site-primary-hue-saturation) 85%
|
||||||
}
|
);
|
||||||
|
--site-announcement-bar-stripe-color2: hsl(
|
||||||
|
var(--site-primary-hue-saturation) 95%
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
--site-announcement-bar-stripe-color1: rgb(197,186,254);
|
||||||
|
--site-announcement-bar-stripe-color2: rgb(255,246,224);
|
||||||
|
|
||||||
[data-theme='dark'] div[class^=announcementBar_] button {
|
background: repeating-linear-gradient(
|
||||||
color: #fff;
|
-35deg,
|
||||||
|
var(--site-announcement-bar-stripe-color1),
|
||||||
|
var(--site-announcement-bar-stripe-color1) 20px,
|
||||||
|
var(--site-announcement-bar-stripe-color2) 10px,
|
||||||
|
var(--site-announcement-bar-stripe-color2) 40px
|
||||||
|
);
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,10 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import Translate from '@docusaurus/Translate';
|
import Translate from '@docusaurus/Translate';
|
||||||
import {
|
|
||||||
useActivePlugin,
|
|
||||||
useDocVersionSuggestions,
|
|
||||||
} from '@docusaurus/plugin-content-docs/client';
|
|
||||||
import {ThemeClassNames} from '@docusaurus/theme-common';
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
||||||
import {
|
import { useLocalPathname } from '@docusaurus/theme-common/internal';
|
||||||
useDocsPreferredVersion,
|
|
||||||
useDocsVersion,
|
|
||||||
} from '@docusaurus/theme-common/internal';
|
|
||||||
function UnreleasedVersionLabel({siteTitle, versionMetadata}) {
|
function UnreleasedVersionLabel({siteTitle, versionMetadata}) {
|
||||||
return (
|
return (
|
||||||
<Translate
|
<Translate
|
||||||
@ -79,123 +71,40 @@ function LatestVersionSuggestionLabel({versionLabel, to, onClick}) {
|
|||||||
</Translate>
|
</Translate>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function DocVersionBannerEnabled({className, versionMetadata}) {
|
|
||||||
const {
|
|
||||||
siteConfig: {title: siteTitle},
|
|
||||||
} = useDocusaurusContext();
|
|
||||||
const {pluginId} = useActivePlugin({failfast: true});
|
|
||||||
const getVersionMainDoc = (version) =>
|
|
||||||
version.docs.find((doc) => doc.id === version.mainDocId);
|
|
||||||
const {savePreferredVersionName} = useDocsPreferredVersion(pluginId);
|
|
||||||
const {latestDocSuggestion, latestVersionSuggestion} =
|
|
||||||
useDocVersionSuggestions(pluginId);
|
|
||||||
// Try to link to same doc in latest version (not always possible), falling
|
|
||||||
// back to main doc of latest version
|
|
||||||
const latestVersionSuggestedDoc =
|
|
||||||
latestDocSuggestion ?? getVersionMainDoc(latestVersionSuggestion);
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={clsx(
|
|
||||||
className,
|
|
||||||
ThemeClassNames.docs.docVersionBanner,
|
|
||||||
'alert alert--warning margin-bottom--md',
|
|
||||||
)}
|
|
||||||
role="alert">
|
|
||||||
<div>
|
|
||||||
<BannerLabel siteTitle={siteTitle} versionMetadata={versionMetadata} />
|
|
||||||
</div>
|
|
||||||
<div className="margin-top--md">
|
|
||||||
<LatestVersionSuggestionLabel
|
|
||||||
versionLabel={latestVersionSuggestion.label}
|
|
||||||
to={latestVersionSuggestedDoc.path}
|
|
||||||
onClick={() => savePreferredVersionName(latestVersionSuggestion.name)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function LatestDocVersionBanner({className, versionMetadata}) {
|
|
||||||
const {
|
|
||||||
siteConfig: {title: siteTitle},
|
|
||||||
} = useDocusaurusContext();
|
|
||||||
const {pluginId} = useActivePlugin({failfast: true});
|
|
||||||
const getVersionMainDoc = (version) =>
|
|
||||||
version.docs.find((doc) => doc.id === version.mainDocId);
|
|
||||||
const {savePreferredVersionName} = useDocsPreferredVersion(pluginId);
|
|
||||||
const {latestDocSuggestion, latestVersionSuggestion} =
|
|
||||||
useDocVersionSuggestions(pluginId);
|
|
||||||
// Try to link to same doc in latest version (not always possible), falling
|
|
||||||
// back to main doc of latest version
|
|
||||||
const latestVersionSuggestedDoc =
|
|
||||||
latestDocSuggestion ?? getVersionMainDoc(latestVersionSuggestion);
|
|
||||||
const canaryPath = `/docs/0.2.x/${latestVersionSuggestedDoc.path.slice("/docs/".length)}`;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={clsx(
|
|
||||||
className,
|
|
||||||
ThemeClassNames.docs.docVersionBanner,
|
|
||||||
'alert alert--info margin-bottom--md',
|
|
||||||
)}
|
|
||||||
role="alert">
|
|
||||||
<div>
|
|
||||||
<Translate
|
|
||||||
id="theme.docs.versions.unmaintainedVersionLabel"
|
|
||||||
description="The label used to encourage the user to view the experimental 0.2.x version"
|
|
||||||
values={{
|
|
||||||
siteTitle,
|
|
||||||
versionLabel: <b>{versionMetadata.label}</b>,
|
|
||||||
}}>
|
|
||||||
{
|
|
||||||
'This is a stable version of documentation for {siteTitle}\'s version {versionLabel}.'
|
|
||||||
}
|
|
||||||
</Translate>
|
|
||||||
</div>
|
|
||||||
<div className="margin-top--md">
|
|
||||||
<Translate
|
|
||||||
id="theme.docs.versions.latestVersionSuggestionLabel"
|
|
||||||
description="The label used to tell the user to check the experimental version"
|
|
||||||
values={{
|
|
||||||
versionLabel: <b>{versionMetadata.label}</b>,
|
|
||||||
latestVersionLink: (
|
|
||||||
<b>
|
|
||||||
<Link to={canaryPath} onClick={() => savePreferredVersionName("0.2.x")}>
|
|
||||||
<Translate
|
|
||||||
id="theme.docs.versions.latestVersionLinkLabel"
|
|
||||||
description="The label used for the latest version suggestion link label">
|
|
||||||
this experimental version
|
|
||||||
</Translate>
|
|
||||||
</Link>
|
|
||||||
</b>
|
|
||||||
),
|
|
||||||
}}>
|
|
||||||
{
|
|
||||||
'You can also check out {latestVersionLink} for an updated experience.'
|
|
||||||
}
|
|
||||||
</Translate>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function DocVersionBanner({className}) {
|
export default function DocVersionBanner({className}) {
|
||||||
const versionMetadata = useDocsVersion();
|
const versionMetadata = {
|
||||||
|
badge: false,
|
||||||
|
banner: 'unmaintained',
|
||||||
|
isLast: false,
|
||||||
|
label: 'v0.2',
|
||||||
|
noIndex: false,
|
||||||
|
pluginId: 'default',
|
||||||
|
version: 'Latest',
|
||||||
|
}
|
||||||
|
console.log({versionMetadata});
|
||||||
|
const localPathname = useLocalPathname();
|
||||||
if (versionMetadata.banner) {
|
if (versionMetadata.banner) {
|
||||||
return (
|
return (
|
||||||
<DocVersionBannerEnabled
|
<div
|
||||||
className={className}
|
className={clsx(
|
||||||
versionMetadata={versionMetadata}
|
className,
|
||||||
/>
|
ThemeClassNames.docs.docVersionBanner,
|
||||||
|
'alert alert--warning margin-bottom--md',
|
||||||
|
)}
|
||||||
|
role="alert">
|
||||||
|
<div>
|
||||||
|
<BannerLabel siteTitle={"LangChain"} versionMetadata={versionMetadata} />
|
||||||
|
</div>
|
||||||
|
<div className="margin-top--md">
|
||||||
|
<LatestVersionSuggestionLabel
|
||||||
|
versionLabel={"Latest"}
|
||||||
|
to={`https://python.langchain.com${localPathname}`}
|
||||||
|
onClick={() => {}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
} else if (versionMetadata.isLast) {
|
|
||||||
// Uncomment when we are ready to direct people to new build
|
|
||||||
// return (
|
|
||||||
// <LatestDocVersionBanner
|
|
||||||
// className={className}
|
|
||||||
// versionMetadata={versionMetadata}
|
|
||||||
// />
|
|
||||||
// );
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user