Skip to content

Commit

Permalink
✨ feat: Add LangChain
Browse files Browse the repository at this point in the history
  • Loading branch information
CanisMinor authored and CanisMinor committed Dec 7, 2024
1 parent bd13e5f commit 7926983
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/LangChain/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use client';

import { memo } from 'react';

import IconAvatar, { type IconAvatarProps } from '@/features/IconAvatar';

import { COLOR_PRIMARY, TITLE } from '../style';
import Mono from './Mono';

export type AvatarProps = Omit<IconAvatarProps, 'Icon'>;

const Avatar = memo<AvatarProps>(({ background, ...rest }) => {
return (
<IconAvatar Icon={Mono} aria-label={TITLE} background={background || COLOR_PRIMARY} {...rest} />
);
});

export default Avatar;
35 changes: 35 additions & 0 deletions src/LangChain/components/Color.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, ...style }}
viewBox="0 0 24 24"
width={size}
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path
d="M8.373 14.538c.013-.06.024-.119.038-.171l.061.147c.115.283.229.564.506.723-.012.258-.334.362-.552.33-.048-.115-.115-.23-.255-.166-.143.057-.3-.01-.266-.187.333-.013.407-.377.468-.676zM18.385 9.21c-.318 0-.616.123-.839.346l-.902.9a1.18 1.18 0 00-.343.925l.006.057c.032.265.149.504.337.691.13.13.273.212.447.27a.884.884 0 01-.247.788l-.056.055a1.962 1.962 0 01-.779-.48c-.301-.3-.5-.68-.576-1.096l-.01-.058-.046.037c-.03.025-.06.052-.088.08l-.902.899a1.183 1.183 0 00.84 2.02c.304 0 .607-.116.838-.347l.902-.9a1.183 1.183 0 00-.436-1.948.972.972 0 01.276-.853c.302.103.57.27.796.495.3.3.5.679.575 1.097l.01.058.047-.037c.03-.025.06-.052.088-.08l.902-.9a1.182 1.182 0 00-.84-2.02z"
fill="#1C3C3C"
/>
<path
clipRule="evenodd"
d="M17.901 5.92H6.1C2.736 5.92 0 8.648 0 12.002c0 3.354 2.736 6.083 6.099 6.083H17.9c3.363 0 6.099-2.729 6.099-6.083S21.264 5.92 17.901 5.92zm-5.821 9.536c-.195.04-.414.047-.562-.108-.045.101-.136.078-.221.057a.755.755 0 00-.061-.014l-.026.074c-.329.022-.575-.313-.732-.565a4.959 4.959 0 00-.473-.214c-.172-.07-.345-.141-.509-.232a2.281 2.281 0 00-.004.175c-.002.248-.004.51-.227.66-.007.299.236.296.476.293.207-.002.41-.005.447.188-.016.002-.033.002-.05.002-.046 0-.092 0-.127.035-.117.113-.242.064-.372.013-.12-.047-.243-.095-.367-.02-.112.056-.191.11-.262.156a.962.962 0 01-.548.196c-.024-.036-.014-.06.006-.081a.58.58 0 00.043-.056c.019-.029.035-.058.051-.086.054-.095.103-.183.242-.223-.185-.029-.344.056-.5.14l-.004.002-.065.034c-.097.04-.154.009-.212-.024-.082-.045-.168-.093-.376.04-.04-.032-.02-.06.002-.086.091-.11.21-.127.345-.12-.351-.196-.604-.058-.81.055-.182.1-.327.179-.471-.013-.065.018-.102.064-.138.11a.612.612 0 01-.047.056c-.035-.039-.027-.084-.018-.13a.792.792 0 00.008-.056l-.027-.011c-.053-.022-.105-.044-.09-.125-.117-.04-.2.03-.286.095-.054-.042-.01-.096.032-.147.019-.024.037-.046.045-.066.038-.066.103-.068.166-.07.054 0 .108-.002.145-.042.133-.076.297-.037.462.002a1 1 0 00.354.043c.203.026.454-.182.352-.39-.186-.236-.184-.536-.183-.824v-.145c-.016-.11-.172-.236-.328-.363-.12-.097-.24-.194-.298-.284-.16-.18-.285-.387-.409-.593l-.015-.025c-.212-.409-.297-.871-.382-1.332-.103-.554-.205-1.106-.526-1.562-.266.146-.612.077-.841-.12-.12.11-.13.252-.138.403l-.001.014c-.297-.297-.26-.856-.023-1.186.097-.13.213-.237.342-.331.03-.022.04-.042.039-.075.235-1.054 1.836-.85 2.342-.104.167.209.281.448.395.687.137.287.273.573.5.806.22.24.452.469.684.698.359.354.718.708 1.032 1.104.49.596.839 1.294 1.144 1.998.05.093.08.195.11.296.044.152.089.303.2.423.026.036.084.089.149.15.156.145.357.332.289.415a.21.21 0 00.05.06c.032.03.074.06.116.09.122.088.25.18.16.253zm7.778-3.594l-.902.9c-.24.24-.537.418-.859.516l-.017.005-.006.016a2.052 2.052 0 01-.474.731l-.902.9a2.073 2.073 0 01-1.474.608 2.077 2.077 0 01-1.474-3.549l.902-.9c.242-.24.531-.413.859-.514l.016-.005.006-.015c.105-.277.265-.523.475-.734l.902-.9a2.073 2.073 0 011.474-.608c.558 0 1.08.216 1.474.609.394.392.61.914.61 1.47a2.06 2.06 0 01-.61 1.47z"
fill="#1C3C3C"
fillRule="evenodd"
/>
</svg>
);
});

export default Icon;
30 changes: 30 additions & 0 deletions src/LangChain/components/Combine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client';

import { memo } from 'react';

import IconCombine, { type IconCombineProps } from '@/features/IconCombine';

import { SPACE_MULTIPLE, TEXT_MULTIPLE, TITLE } from '../style';
import Color from './Color';
import Mono from './Mono';
import Text from './Text';

export interface CombineProps extends Omit<IconCombineProps, 'Icon' | 'Text'> {
type?: 'color' | 'mono';
}
const Combine = memo<CombineProps>(({ type = 'mono', ...rest }) => {
const Icon = type === 'color' ? Color : Mono;

return (
<IconCombine
Icon={Icon}
Text={Text}
aria-label={TITLE}
spaceMultiple={SPACE_MULTIPLE}
textMultiple={TEXT_MULTIPLE}
{...rest}
/>
);
});

export default Combine;
32 changes: 32 additions & 0 deletions src/LangChain/components/Mono.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';

import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
fill="currentColor"
fillRule="evenodd"
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, ...style }}
viewBox="0 0 24 24"
width={size}
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path d="M8.373 14.538c.013-.06.024-.119.038-.171l.061.147c.115.283.229.564.506.723-.012.258-.334.362-.552.33-.048-.115-.115-.23-.255-.166-.143.057-.3-.01-.266-.187.333-.013.407-.377.468-.676zM18.385 9.21c-.318 0-.616.123-.839.346l-.902.9a1.18 1.18 0 00-.343.925l.006.057c.032.265.149.504.337.691.13.13.273.212.447.27a.884.884 0 01-.247.788l-.056.055a1.962 1.962 0 01-.779-.48c-.301-.3-.5-.68-.576-1.096l-.01-.058-.046.037c-.03.025-.06.052-.088.08l-.902.899a1.183 1.183 0 00.84 2.02c.304 0 .607-.116.838-.347l.902-.9a1.183 1.183 0 00-.436-1.948.972.972 0 01.276-.853c.302.103.57.27.796.495.3.3.5.679.575 1.097l.01.058.047-.037c.03-.025.06-.052.088-.08l.902-.9a1.182 1.182 0 00-.84-2.02z" />
<path
clipRule="evenodd"
d="M17.901 5.92H6.1C2.736 5.92 0 8.648 0 12.002c0 3.354 2.736 6.083 6.099 6.083H17.9c3.363 0 6.099-2.729 6.099-6.083S21.264 5.92 17.901 5.92zm-5.821 9.536c-.195.04-.414.047-.562-.108-.045.101-.136.078-.221.057a.755.755 0 00-.061-.014l-.026.074c-.329.022-.575-.313-.732-.565a4.959 4.959 0 00-.473-.214c-.172-.07-.345-.141-.509-.232a2.281 2.281 0 00-.004.175c-.002.248-.004.51-.227.66-.007.299.236.296.476.293.207-.002.41-.005.447.188-.016.002-.033.002-.05.002-.046 0-.092 0-.127.035-.117.113-.242.064-.372.013-.12-.047-.243-.095-.367-.02-.112.056-.191.11-.262.156a.962.962 0 01-.548.196c-.024-.036-.014-.06.006-.081a.58.58 0 00.043-.056c.019-.029.035-.058.051-.086.054-.095.103-.183.242-.223-.185-.029-.344.056-.5.14l-.004.002-.065.034c-.097.04-.154.009-.212-.024-.082-.045-.168-.093-.376.04-.04-.032-.02-.06.002-.086.091-.11.21-.127.345-.12-.351-.196-.604-.058-.81.055-.182.1-.327.179-.471-.013-.065.018-.102.064-.138.11a.612.612 0 01-.047.056c-.035-.039-.027-.084-.018-.13a.792.792 0 00.008-.056l-.027-.011c-.053-.022-.105-.044-.09-.125-.117-.04-.2.03-.286.095-.054-.042-.01-.096.032-.147.019-.024.037-.046.045-.066.038-.066.103-.068.166-.07.054 0 .108-.002.145-.042.133-.076.297-.037.462.002a1 1 0 00.354.043c.203.026.454-.182.352-.39-.186-.236-.184-.536-.183-.824v-.145c-.016-.11-.172-.236-.328-.363-.12-.097-.24-.194-.298-.284-.16-.18-.285-.387-.409-.593l-.015-.025c-.212-.409-.297-.871-.382-1.332-.103-.554-.205-1.106-.526-1.562-.266.146-.612.077-.841-.12-.12.11-.13.252-.138.403l-.001.014c-.297-.297-.26-.856-.023-1.186.097-.13.213-.237.342-.331.03-.022.04-.042.039-.075.235-1.054 1.836-.85 2.342-.104.167.209.281.448.395.687.137.287.273.573.5.806.22.24.452.469.684.698.359.354.718.708 1.032 1.104.49.596.839 1.294 1.144 1.998.05.093.08.195.11.296.044.152.089.303.2.423.026.036.084.089.149.15.156.145.357.332.289.415a.21.21 0 00.05.06c.032.03.074.06.116.09.122.088.25.18.16.253zm7.778-3.594l-.902.9c-.24.24-.537.418-.859.516l-.017.005-.006.016a2.052 2.052 0 01-.474.731l-.902.9a2.073 2.073 0 01-1.474.608 2.077 2.077 0 01-1.474-3.549l.902-.9c.242-.24.531-.413.859-.514l.016-.005.006-.015c.105-.277.265-.523.475-.734l.902-.9a2.073 2.073 0 011.474-.608c.558 0 1.08.216 1.474.609.394.392.61.914.61 1.47a2.06 2.06 0 01-.61 1.47z"
/>
</svg>
);
});

export default Icon;
36 changes: 36 additions & 0 deletions src/LangChain/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use client';

import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
fill="currentColor"
fillRule="evenodd"
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, ...style }}
viewBox="0 0 117 24"
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path d="M99.476 0c-1.04 0-1.795.755-1.795 1.794 0 1.04.755 1.795 1.795 1.795 1.039 0 1.794-.755 1.794-1.795S100.515 0 99.476 0zM74.402 6.575c.933-.696 2.122-1.063 3.459-1.063l.001.003c3.194 0 5.257 2.008 5.257 5.117v8.373H80.32v-8c0-1.921-.842-2.855-2.575-2.855-1.61 0-3.343 1.09-3.343 3.481v7.372h-2.799V.4h2.799v6.175zM67.41 13.62c-.58 1.875-2.07 2.91-4.193 2.91-3.035 0-4.923-2.306-4.923-6.016s1.904-6.016 4.97-6.016c2.122 0 3.344.832 3.967 2.695l.29.872 2.642-1.24-.248-.699c-1.006-2.835-3.33-4.332-6.72-4.332-2.304 0-4.26.832-5.656 2.405-1.381 1.557-2.113 3.74-2.113 6.316 0 5.297 3.058 8.72 7.791 8.72 3.336 0 5.92-1.744 6.911-4.668l.253-.748-2.714-1.032-.257.832zM4.798 2.027H2v16.975h12.003v-2.704H4.798V2.027zM28.074 19.002h2.794v-.03h.037l.005-.125c.001-.036.012-.376-.04-.9V11.63c0-2.377 1.733-3.459 3.343-3.459 1.732 0 2.575.934 2.575 2.855v7.976h2.799v-8.348c0-3.171-2.015-5.142-5.257-5.142-1.377 0-2.607.392-3.572 1.135l-.026-.902h-2.658v13.257z" />
<path
clipRule="evenodd"
d="M47.342 5.512c1.41 0 2.661.417 3.634 1.207h.002l.056-.974h2.588v11.86c0 2.038-.571 3.633-1.7 4.74C50.804 23.444 49.201 24 47.157 24c-3.012 0-5.083-1.321-5.542-3.535l-.024-.111 2.719-.83.025.139c.206 1.113 1.21 1.678 2.985 1.678 2.11 0 3.397-1.22 3.477-3.275-.936.69-2.124 1.052-3.455 1.052-3.773 0-6.117-2.626-6.117-6.815 0-4.188 2.344-6.79 6.117-6.79zm.163 10.949c2.064 0 3.296-1.512 3.296-4.04v-.327c-.02-2.42-1.282-3.923-3.296-3.923-2.213 0-3.482 1.492-3.482 4.133s1.269 4.157 3.482 4.157z"
/>
<path d="M105.869 6.647c.966-.743 2.194-1.135 3.572-1.135h.003c3.242 0 5.257 1.97 5.257 5.142v8.348h-2.799v-7.976c0-1.921-.843-2.855-2.575-2.855-1.611 0-3.343 1.082-3.343 3.459v7.372h-2.799V5.745h2.657l.027.902zM100.833 5.745H98.05v6.572a7.787 7.787 0 00-2.71-1.46v-.669c0-2.928-1.922-4.676-5.142-4.676-2.615 0-4.572 1.229-5.369 3.369l-.214.577 2.243 1.654.385-1.003c.507-1.323 1.447-1.94 2.955-1.94 1.51 0 2.344.727 2.344 2.157v.075a9.34 9.34 0 00-.271-.008c-2.996-.048-5.182.653-6.496 2.08-1.345 1.46-1.228 3.1-1.21 3.28l.013.126h.012c.21 2.042 1.993 3.354 4.586 3.354 1.427 0 2.747-.398 3.744-1.124l.011.892h2.41v-4.147l-.053-.038c-.34-.25-.934-.571-1.828-.684a6.523 6.523 0 00-.403-.039 4.706 4.706 0 00-.392-.01h-.125v.382c0 .877-1.008 2.111-3.25 2.111-1.654 0-1.901-.696-1.901-1.11v-.043a1.73 1.73 0 01.502-1.066c.522-.54 1.698-1.172 4.334-1.131 1.908.03 3.373.563 4.353 1.586 1.203 1.256 1.43 2.975 1.47 3.648v.542h2.785V5.745z" />
<path
clipRule="evenodd"
d="M15.466 8.823c.796-2.14 2.753-3.368 5.368-3.368 3.22 0 5.14 1.747 5.14 4.675v8.813h-2.407l-.012-.892c-.998.726-2.316 1.124-3.745 1.124-2.798 0-4.606-1.52-4.606-3.77s1.713-3.694 5.092-4.292l2.882-.508v-.337c0-1.43-.835-2.156-2.344-2.156-1.508 0-2.447.616-2.955 1.939l-.385 1.003L15.251 9.4l.215-.577zm7.712 5.585v-1.181l-2.22.406c-2.931.544-2.931 1.407-2.931 1.776 0 .415.245 1.11 1.9 1.11 2.242 0 3.25-1.234 3.25-2.11z"
/>
</svg>
);
});

export default Icon;
72 changes: 72 additions & 0 deletions src/LangChain/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
nav: Components
group: Application
title: LangChain
atomId: LangChain
description: https://langchain.com
---

## Icons

```tsx
import { LangChain } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16} horizontal>
<LangChain size={64} />
<LangChain.Color size={64} />
</Flexbox>
);
```

## Text

```tsx
import { LangChain } from '@lobehub/icons';

export default () => <LangChain.Text size={48} />;
```

## Combine

```tsx
import { LangChain } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16} align={'flex-start'}>
<LangChain.Combine size={64} />
<LangChain.Combine size={64} type={'color'} />
</Flexbox>
);
```

## Avatars

```tsx
import { LangChain } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16} horizontal>
<LangChain.Avatar size={64} />
<LangChain.Avatar size={64} shape={'square'} />
</Flexbox>
);
```

## Colors

```tsx
import { LangChain } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

import ColorPreview from '../components/ColorPreview';

export default () => (
<Flexbox gap={16} horizontal>
<ColorPreview color={LangChain.colorPrimary} />
</Flexbox>
);
```
27 changes: 27 additions & 0 deletions src/LangChain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use client';

import Avatar from './components/Avatar';
import Color from './components/Color';
import Combine from './components/Combine';
import Mono from './components/Mono';
import Text from './components/Text';
import { COLOR_PRIMARY, TITLE } from './style';

export type CompoundedIcon = typeof Mono & {
Avatar: typeof Avatar;
Color: typeof Color;
Combine: typeof Combine;
Text: typeof Text;
colorPrimary: string;
title: string;
};

const Icons = Mono as CompoundedIcon;
Icons.Color = Color;
Icons.Text = Text;
Icons.Combine = Combine;
Icons.Avatar = Avatar;
Icons.colorPrimary = COLOR_PRIMARY;
Icons.title = TITLE;

export default Icons;
4 changes: 4 additions & 0 deletions src/LangChain/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const TITLE = 'LangChain';
export const TEXT_MULTIPLE = 0.5;
export const SPACE_MULTIPLE = 0.2;
export const COLOR_PRIMARY = '#1C3C3C';
1 change: 1 addition & 0 deletions src/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export { default as Hunyuan, type CompoundedIcon as HunyuanProps } from './Hunyu
export { default as InternLM, type CompoundedIcon as InternLMProps } from './InternLM';
export { default as Kimi, type CompoundedIcon as KimiProps } from './Kimi';
export { default as Kling, type CompoundedIcon as KlingProps } from './Kling';
export { default as LangChain, type CompoundedIcon as LangChainProps } from './LangChain';
export { default as Langfuse, type CompoundedIcon as LangfuseProps } from './Langfuse';
export { default as LLaVA, type CompoundedIcon as LLaVAProps } from './LLaVA';
export { default as LmStudio, type CompoundedIcon as LmStudioProps } from './LmStudio';
Expand Down
19 changes: 19 additions & 0 deletions src/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,25 @@ const toc: IconToc[] = [
},
title: 'LLaVA',
},
{
color: '#1C3C3C',
desc: 'https://langchain.com',
docsUrl: 'lang-chain',
fullTitle: 'LangChain',
group: 'application',
id: 'LangChain',
param: {
hasAvatar: true,
hasBrand: false,
hasBrandColor: false,
hasColor: true,
hasCombine: true,
hasText: true,
hasTextCn: false,
hasTextColor: false,
},
title: 'LangChain',
},
{
color: '#000',
desc: 'https://langfuse.com',
Expand Down

0 comments on commit 7926983

Please sign in to comment.