Skip to content

Commit

Permalink
✨ feat: Add GiteeAI (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Nov 19, 2024
1 parent 53d99a6 commit 0cd6dc1
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/GiteeAI/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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}
color={'#fff'}
{...rest}
/>
);
});

export default Avatar;
24 changes: 24 additions & 0 deletions src/GiteeAI/components/Combine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { memo } from 'react';

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

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

export type CombineProps = Omit<IconCombineProps, 'Icon' | 'Text'>;

const Combine = memo<CombineProps>(({ ...rest }) => {
return (
<IconCombine
Icon={Mono}
Text={Text as any}
aria-label={TITLE}
spaceMultiple={SPACE_MULTIPLE}
textMultiple={TEXT_MULTIPLE}
{...rest}
/>
);
});

export default Combine;
36 changes: 36 additions & 0 deletions src/GiteeAI/components/Mono.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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>
<g clipPath="url(#a)">
<path
clipRule="evenodd"
d="M15.08 14.637c.218.815.46 1.648.72 2.513.238.79-.472 1.1-.755.356a66.148 66.148 0 01-.864-2.402c-1.542.775-3.08 1.421-4.823 2.148.697 2.563 1.34 4.707 2.34 6.744.1.003.2.004.302.004 6.628 0 12-5.373 12-12 0-2.38-.693-4.598-1.888-6.464-3.117.281-5.881.738-8.42 1.308a39.775 39.775 0 001.077 6.587 97.459 97.459 0 003.64-1.718c.92-.46 1.808-.49.312.683a37.134 37.134 0 01-3.642 2.24zm6.614-9.712A11.993 11.993 0 0013.557.1c-.101 1.617-.07 3.658.052 5.603 2.44-.37 5.094-.627 8.085-.778zM11.962 0a37.821 37.821 0 00.152 5.948c-1.69.298-3.28.656-4.818 1.074-.067-.767-.1-1.467-.1-2.077a.8.8 0 00-1.6 0c0 .742.061 1.594.172 2.518-.767.234-1.524.484-2.276.75a.8.8 0 00.533 1.508c.65-.23 1.306-.458 1.969-.681.32 1.96.807 4.126 1.368 6.21.098.363.202.726.31 1.086-2.067.712-4.176 1.29-6.105 1.597A11.945 11.945 0 010 12C0 5.385 5.352.02 11.962 0zM2.515 19.352a11.985 11.985 0 008.237 4.584c-.797-1.463-1.792-3.706-2.628-6.182-1.86.712-3.769 1.208-5.61 1.598zm11.27-5.484a39.054 39.054 0 01-1.232-5.302 15.441 15.441 0 01-.277-1.388A74.043 74.043 0 007.46 8.556c.248 1.93.666 4.124 1.246 6.277l.264.983v.002l.013.046a56.801 56.801 0 002.134-.849 174.05 174.05 0 002.666-1.147z"
></path>
</g>
<defs>
<clipPath id="a">
<path d="M0 0h24v24H0z"></path>
</clipPath>
</defs>
</svg>
);
});

export default Icon;
25 changes: 25 additions & 0 deletions src/GiteeAI/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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 80 24"
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path d="M7.349 24c2.183 0 3.926-.426 5.228-1.278 1.303-.851 1.954-1.954 1.954-3.308 0-2.184-1.63-3.276-4.89-3.276H7.633c-.67 0-1.15-.065-1.441-.196-.291-.131-.437-.35-.437-.655s.095-.56.284-.765c.073-.087.167-.116.284-.087.465.13.91.196 1.331.196 1.5 0 2.718-.36 3.657-1.08.939-.721 1.408-1.788 1.408-3.2 0-.524-.094-.99-.284-1.397-.014-.03-.01-.062.011-.099a.107.107 0 01.099-.054h.502c.364 0 .67-.124.917-.372.247-.247.37-.553.37-.917v-.305c0-.35-.123-.652-.37-.907a1.228 1.228 0 00-.917-.382h-3.21c-.101 0-.21-.014-.327-.044a6.282 6.282 0 00-1.856-.262c-.946 0-1.812.164-2.598.492a4.502 4.502 0 00-1.954 1.572c-.516.72-.775 1.576-.775 2.566 0 .684.16 1.31.48 1.878.321.568.721 1.026 1.202 1.376.029.014.043.036.043.065 0 .03-.014.059-.043.088a3.49 3.49 0 00-.983 1.059c-.247.415-.371.84-.371 1.277 0 .932.371 1.653 1.113 2.162.03.015.044.04.044.077s-.015.069-.044.098c-.582.291-1.022.648-1.32 1.07A2.368 2.368 0 002 20.79c0 .728.247 1.34.742 1.834.495.495 1.132.848 1.91 1.06.78.21 1.678.316 2.697.316zm.305-11.771c-.48 0-.87-.171-1.168-.513-.298-.342-.447-.834-.447-1.474 0-.626.15-1.11.447-1.453.299-.342.688-.513 1.168-.513s.87.168 1.168.503.448.822.448 1.463c0 .64-.15 1.132-.448 1.474s-.687.513-1.168.513zm.306 9.281c-.83 0-1.488-.113-1.976-.338-.487-.226-.731-.565-.731-1.016 0-.364.167-.706.502-1.026.044-.044.11-.066.196-.066h.066c.364.073.917.11 1.66.11h1.2c.64 0 1.11.065 1.408.196.299.131.448.371.448.72 0 .408-.259.747-.775 1.016-.517.27-1.183.404-1.998.404zM18.526 4.083c.655 0 1.194-.19 1.616-.568.422-.378.633-.866.633-1.463 0-.597-.211-1.088-.633-1.474C19.72.192 19.182 0 18.526 0c-.67 0-1.219.193-1.648.58-.43.385-.644.876-.644 1.473 0 .597.214 1.085.644 1.463.43.379.979.568 1.648.568zm.677 14.501c.35 0 .651-.127.906-.382s.382-.557.382-.906V7.14c0-.35-.127-.652-.382-.907a1.238 1.238 0 00-.906-.382h-1.376c-.363 0-.669.128-.916.382a1.257 1.257 0 00-.372.907v10.155c0 .35.124.651.372.906s.553.382.916.382h1.376zm9.497.306c.553 0 1.098-.051 1.637-.153.35-.058.619-.247.808-.568.13-.218.196-.444.196-.677a2.64 2.64 0 00-.022-.327l-.087-.35a1.162 1.162 0 00-.546-.731 1.968 1.968 0 00-.982-.295c-1.004-.044-1.507-.699-1.507-1.966V9.128c0-.102.051-.153.153-.153h1.55c.35 0 .652-.127.906-.382.255-.255.382-.557.382-.906V7.14c0-.35-.127-.652-.382-.906a1.238 1.238 0 00-.906-.382h-1.55c-.102 0-.153-.051-.153-.153V3.8c0-.364-.127-.67-.382-.917a1.256 1.256 0 00-.906-.372h-.742c-.364 0-.684.12-.96.36-.277.24-.444.543-.503.907l-.24 1.922c-.014.102-.08.16-.196.174l-.502.044a1.35 1.35 0 00-.917.448c-.248.27-.371.586-.371.95v.37c0 .35.127.652.382.907.254.255.556.382.906.382h.283c.102 0 .153.051.153.153v4.74c0 1.586.364 2.82 1.092 3.7.728.881 1.863 1.322 3.406 1.322zm10.676 0c1.164 0 2.314-.27 3.449-.808.32-.146.524-.4.611-.765a.982.982 0 00.066-.349 1.27 1.27 0 00-.196-.655l-.066-.131a1.283 1.283 0 00-.764-.612 1.825 1.825 0 00-.48-.065c-.19 0-.372.03-.546.087a4.558 4.558 0 01-1.529.262c-1.717 0-2.758-.764-3.121-2.293-.015-.043-.008-.083.021-.12s.066-.054.11-.054h6.003c.379 0 .713-.12 1.004-.36s.444-.543.459-.907v-.415c0-1.834-.466-3.32-1.397-4.455-.932-1.135-2.285-1.703-4.06-1.703a5.56 5.56 0 00-2.239.47c-.72.312-1.36.75-1.92 1.31-.561.56-1.012 1.266-1.354 2.118-.343.851-.513 1.78-.513 2.784 0 2.053.607 3.676 1.822 4.87s2.762 1.79 4.64 1.79zm1.484-8.08h-3.995c-.102 0-.153-.037-.153-.11 0-.596.284-1.128.852-1.594.407-.349.895-.524 1.462-.524.655 0 1.146.186 1.474.557.327.371.506.87.535 1.496v.022c0 .102-.058.153-.175.153zm11.833 8.08c1.165 0 2.315-.27 3.45-.808.32-.146.524-.4.611-.765a.982.982 0 00.066-.349c0-.218-.066-.437-.197-.655l-.066-.131a1.278 1.278 0 00-.764-.612 1.815 1.815 0 00-.48-.065c-.19 0-.37.03-.545.087a4.563 4.563 0 01-1.53.262c-1.716 0-2.757-.764-3.12-2.293a.122.122 0 01.02-.12.135.135 0 01.11-.054h6.004c.378 0 .713-.12 1.004-.36.29-.24.444-.543.459-.907v-.415c0-1.834-.467-3.32-1.398-4.455-.93-1.135-2.285-1.703-4.06-1.703a5.56 5.56 0 00-2.238.47c-.72.312-1.36.75-1.92 1.31-.562.56-1.013 1.266-1.355 2.118-.342.851-.513 1.78-.513 2.784 0 2.053.608 3.676 1.823 4.87s2.762 1.79 4.64 1.79zm1.485-8.08h-3.995c-.103 0-.153-.037-.153-.11 0-.596.284-1.128.851-1.594.407-.349.895-.524 1.463-.524.655 0 1.146.186 1.473.557.328.371.507.87.535 1.496v.022c0 .102-.058.153-.174.153zM63.198 18.708h-2.286l6.096-13.333 6.238 13.333h-2.238l-4-8.428-3.81 8.428zM75.457 5.641h2.286v13.067h-2.286V5.641z"></path>
</svg>
);
});

export default Icon;
66 changes: 66 additions & 0 deletions src/GiteeAI/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
nav: Components
group: Provider
title: GiteeAI
atomId: GiteeAI
description: https://ai-assets.gitee.com/
---

## Icons

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

export default () => <GiteeAI size={64} />;
```

## Text

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

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

## Combine

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

export default () => (
<Flexbox gap={16}>
<GiteeAI.Combine size={64} />
</Flexbox>
);
```

## Avatars

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

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

## Colors

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

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

export default () => (
<Flexbox gap={16} horizontal>
<ColorPreview color={GiteeAI.colorPrimary} />
</Flexbox>
);
```
21 changes: 21 additions & 0 deletions src/GiteeAI/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Avatar from './components/Avatar';
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;
Combine: typeof Combine;
Text: typeof Text;
colorPrimary: string;
title: string;
};

const Icons = Mono as CompoundedIcon;
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/GiteeAI/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const TITLE = 'GiteeAI';
export const TEXT_MULTIPLE = 0.85;
export const SPACE_MULTIPLE = 0.2;
export const COLOR_PRIMARY = '#000';
2 changes: 2 additions & 0 deletions src/features/providerConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import DeepSeek from '@/DeepSeek';
import Doubao from '@/Doubao';
import Fireworks from '@/Fireworks';
import Gemini from '@/Gemini';
import GiteeAI from '@/GiteeAI';
import Github from '@/Github';
import Google from '@/Google';
import Groq from '@/Groq';
Expand Down Expand Up @@ -185,4 +186,5 @@ export const providerMappings: ProviderMapping[] = [
},
{ Icon: InternLM, combineMultiple: 0.95, keywords: [ModelProvider.InternLM] },
{ Icon: Higress, keywords: [ModelProvider.Higress] },
{ Icon: GiteeAI, combineMultiple: 0.95, keywords: [ModelProvider.GiteeAI] },
];
1 change: 1 addition & 0 deletions src/features/providerEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum ModelProvider {
DeepSeek = 'deepseek',
Doubao = 'Doubao',
FireworksAI = 'fireworksai',
GiteeAI = 'giteeai',
Github = 'github',
Google = 'google',
Groq = 'groq',
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export { default as FishAudio, type CompoundedIcon as FishAudioProps } from './F
export { default as Flux, type CompoundedIcon as FluxProps } from './Flux';
export { default as Gemini, type CompoundedIcon as GeminiProps } from './Gemini';
export { default as Gemma, type CompoundedIcon as GemmaProps } from './Gemma';
export { default as GiteeAI, type CompoundedIcon as GiteeAIProps } from './GiteeAI';
export { default as Github, type CompoundedIcon as GithubProps } from './Github';
export {
default as GithubCopilot,
Expand Down

0 comments on commit 0cd6dc1

Please sign in to comment.