Skip to content

Commit 419510f

Browse files
authored
✨ feat: add tencent cloud as provider (lobehub#68)
* ✨ feat: support tencent cloud * fix tests * fix tests
1 parent 2e77a37 commit 419510f

File tree

14 files changed

+280
-4
lines changed

14 files changed

+280
-4
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
"@types/pangu": "^4.0.2",
9595
"@types/react": "^19.0.3",
9696
"@types/react-dom": "^19.0.2",
97-
"@vitest/coverage-v8": "~1.2.2",
97+
"@vitest/coverage-v8": "^3.0.5",
98+
"ajv": "^8.17.1",
9899
"babel-plugin-antd-style": "^1.0.4",
99100
"clean-package": "^2.2.0",
100101
"commitlint": "^19.6.1",
@@ -125,7 +126,7 @@
125126
"svgo-browser": "^1.3.8",
126127
"tsx": "^4.19.2",
127128
"typescript": "^5.7.2",
128-
"vitest": "~1.2.2"
129+
"vitest": "^3.0.5"
129130
},
130131
"peerDependencies": {
131132
"antd": "^5.23.0",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use client';
2+
3+
import { memo } from 'react';
4+
5+
import IconAvatar, { type IconAvatarProps } from '@/features/IconAvatar';
6+
7+
import { COLOR_PRIMARY, TITLE } from '../style';
8+
import Mono from './Mono';
9+
10+
export type AvatarProps = Omit<IconAvatarProps, 'Icon'>;
11+
12+
const Avatar = memo<AvatarProps>(({ background, ...rest }) => {
13+
return (
14+
<IconAvatar Icon={Mono} aria-label={TITLE} background={background || COLOR_PRIMARY} {...rest} />
15+
);
16+
});
17+
18+
export default Avatar;

src/TencentCloud/components/Color.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use client';
2+
3+
import { forwardRef } from 'react';
4+
5+
import type { IconType } from '@/types';
6+
7+
import { TITLE } from '../style';
8+
9+
const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
10+
return (
11+
<svg
12+
height={size}
13+
ref={ref}
14+
style={{ flex: 'none', lineHeight: 1, ...style }}
15+
viewBox="0 0 24 24"
16+
width={size}
17+
xmlns="http://www.w3.org/2000/svg"
18+
{...rest}
19+
>
20+
<title>{TITLE}</title>
21+
<path
22+
d="M20.0483 17.1416C19.6945 17.4914 18.987 18.0161 17.7488 18.0161C17.2182 18.0161 16.5991 18.0161 16.3338 18.0161C15.98 18.0161 13.3268 18.0161 10.143 18.0161C12.4424 15.8298 14.3881 13.9932 14.565 13.8183C14.7419 13.6434 15.1841 13.2061 15.6263 12.8563C16.5107 12.0692 17.2182 11.9817 17.8373 11.9817C18.7217 11.9817 19.4292 12.3316 20.0483 12.8563C21.2864 13.9932 21.2864 16.0047 20.0483 17.1416ZM21.5518 11.457C20.6674 10.495 19.3408 9.88281 17.9257 9.88281C16.6875 9.88281 15.6263 10.3201 14.6534 11.0197C14.2997 11.3695 13.769 11.7194 13.3268 12.2441C12.9731 12.5939 5.36719 19.9401 5.36719 19.9401C5.80939 20.0276 6.34003 20.0276 6.78223 20.0276C7.22443 20.0276 16.0685 20.0276 16.4222 20.0276C17.1298 20.0276 17.6604 20.0276 18.191 19.9401C19.3408 19.8527 20.4905 19.4154 21.4633 18.5409C23.4975 16.6168 23.4975 13.381 21.5518 11.457Z"
23+
fill="#00A3FF"
24+
/>
25+
<path
26+
d="M9.1701 10.9323C8.19726 10.2326 7.22442 9.88281 6.07469 9.88281C4.65965 9.88281 3.33304 10.495 2.44864 11.457C0.502952 13.4685 0.502952 16.6168 2.53708 18.6283C3.42148 19.4154 4.30589 19.8527 5.36717 19.9401L7.4013 18.0161C7.04754 18.0161 6.60533 18.0161 6.25157 18.0161C5.10185 17.9287 4.39433 17.5789 3.95212 17.1416C2.71396 15.9172 2.71396 13.9932 3.86368 12.7688C4.48277 12.1566 5.19029 11.8943 6.07469 11.8943C6.60533 11.8943 7.4013 11.9817 8.19726 12.7688C8.55102 13.1186 9.52386 13.8183 9.87763 14.1681H9.96607L11.2927 12.8563V12.7688C10.6736 12.1566 9.70075 11.3695 9.1701 10.9323Z"
27+
fill="#00C8DC"
28+
/>
29+
<path
30+
d="M18.4564 8.74536C17.4836 6.12171 14.9188 4.28516 12.0003 4.28516C8.5511 4.28516 5.80945 6.82135 5.27881 9.96973C5.54413 9.96973 5.80945 9.88228 6.16321 9.88228C6.51697 9.88228 6.95917 9.96973 7.31294 9.96973C7.75514 7.78336 9.70082 6.20917 12.0003 6.20917C13.946 6.20917 15.6263 7.34608 16.4223 9.00773C16.4223 9.00773 16.5107 9.09518 16.5107 9.00773C17.1298 8.92027 17.8373 8.74536 18.4564 8.74536C18.4564 8.83282 18.4564 8.83282 18.4564 8.74536Z"
31+
fill="#006EFF"
32+
/>
33+
</svg>
34+
);
35+
});
36+
37+
export default Icon;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use client';
2+
3+
import { memo } from 'react';
4+
5+
import IconCombine, { type IconCombineProps } from '@/features/IconCombine';
6+
7+
import { SPACE_MULTIPLE, TEXT_MULTIPLE, TITLE } from '../style';
8+
import Color from './Color';
9+
import Mono from './Mono';
10+
import Text from './Text';
11+
12+
export interface CombineProps extends Omit<IconCombineProps, 'Icon' | 'Text'> {
13+
type?: 'color' | 'mono';
14+
}
15+
const Combine = memo<CombineProps>(({ type = 'mono', ...rest }) => {
16+
const Icon = type === 'color' ? Color : Mono;
17+
18+
return (
19+
<IconCombine
20+
Icon={Icon}
21+
Text={Text}
22+
aria-label={TITLE}
23+
spaceMultiple={SPACE_MULTIPLE}
24+
textMultiple={TEXT_MULTIPLE}
25+
{...rest}
26+
/>
27+
);
28+
});
29+
30+
export default Combine;

src/TencentCloud/components/Mono.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use client';
2+
3+
import { forwardRef } from 'react';
4+
5+
import type { IconType } from '@/types';
6+
7+
import { TITLE } from '../style';
8+
9+
const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
10+
return (
11+
<svg
12+
fill="currentColor"
13+
fillRule="evenodd"
14+
height={size}
15+
ref={ref}
16+
style={{ flex: 'none', lineHeight: 1, ...style }}
17+
viewBox="0 0 24 24"
18+
width={size}
19+
xmlns="http://www.w3.org/2000/svg"
20+
{...rest}
21+
>
22+
<title>{TITLE}</title>
23+
<path d="M20.0483 17.1416C19.6945 17.4914 18.987 18.0161 17.7488 18.0161C17.2182 18.0161 16.5991 18.0161 16.3338 18.0161C15.98 18.0161 13.3268 18.0161 10.143 18.0161C12.4424 15.8298 14.3881 13.9932 14.565 13.8183C14.7419 13.6434 15.1841 13.2061 15.6263 12.8563C16.5107 12.0692 17.2182 11.9817 17.8373 11.9817C18.7217 11.9817 19.4292 12.3316 20.0483 12.8563C21.2864 13.9932 21.2864 16.0047 20.0483 17.1416ZM21.5518 11.457C20.6674 10.495 19.3408 9.88281 17.9257 9.88281C16.6875 9.88281 15.6263 10.3201 14.6534 11.0197C14.2997 11.3695 13.769 11.7194 13.3268 12.2441C12.9731 12.5939 5.36719 19.9401 5.36719 19.9401C5.80939 20.0276 6.34003 20.0276 6.78223 20.0276C7.22443 20.0276 16.0685 20.0276 16.4222 20.0276C17.1298 20.0276 17.6604 20.0276 18.191 19.9401C19.3408 19.8527 20.4905 19.4154 21.4633 18.5409C23.4975 16.6168 23.4975 13.381 21.5518 11.457Z" />
24+
<path d="M9.1701 10.9323C8.19726 10.2326 7.22442 9.88281 6.07469 9.88281C4.65965 9.88281 3.33304 10.495 2.44864 11.457C0.502952 13.4685 0.502952 16.6168 2.53708 18.6283C3.42148 19.4154 4.30589 19.8527 5.36717 19.9401L7.4013 18.0161C7.04754 18.0161 6.60533 18.0161 6.25157 18.0161C5.10185 17.9287 4.39433 17.5789 3.95212 17.1416C2.71396 15.9172 2.71396 13.9932 3.86368 12.7688C4.48277 12.1566 5.19029 11.8943 6.07469 11.8943C6.60533 11.8943 7.4013 11.9817 8.19726 12.7688C8.55102 13.1186 9.52386 13.8183 9.87763 14.1681H9.96607L11.2927 12.8563V12.7688C10.6736 12.1566 9.70075 11.3695 9.1701 10.9323Z" />
25+
<path d="M18.4564 8.74536C17.4836 6.12171 14.9188 4.28516 12.0003 4.28516C8.5511 4.28516 5.80945 6.82135 5.27881 9.96973C5.54413 9.96973 5.80945 9.88228 6.16321 9.88228C6.51697 9.88228 6.95917 9.96973 7.31294 9.96973C7.75514 7.78336 9.70082 6.20917 12.0003 6.20917C13.946 6.20917 15.6263 7.34608 16.4223 9.00773C16.4223 9.00773 16.5107 9.09518 16.5107 9.00773C17.1298 8.92027 17.8373 8.74536 18.4564 8.74536C18.4564 8.83282 18.4564 8.83282 18.4564 8.74536Z" />
26+
</svg>
27+
);
28+
});
29+
30+
export default Icon;

src/TencentCloud/components/Text.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use client';
2+
3+
import { forwardRef } from 'react';
4+
5+
import type { IconType } from '@/types';
6+
7+
import { TITLE } from '../style';
8+
9+
const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
10+
return (
11+
<svg
12+
fill="currentColor"
13+
fillRule="evenodd"
14+
height={size}
15+
ref={ref}
16+
style={{ flex: 'none', lineHeight: 1, ...style }}
17+
viewBox="0 0 64 24"
18+
xmlns="http://www.w3.org/2000/svg"
19+
{...rest}
20+
>
21+
<title>{TITLE}</title>
22+
<path d="M29.2209 2.75544V4.39062H32.6553V10.4282H28.5849V12.0634H32.6553V22.0002H34.5633V12.0634H38.8881V21.6229H42.3225V19.9877H40.7961V2.75544H29.2209ZM34.4361 10.1766V4.39062H38.8881V10.4282H34.5633V10.1766H34.4361Z" />
23+
<path d="M8.99607 17.3455H18.0273V18.9807H8.99607V17.3455Z" />
24+
<path d="M2.7632 14.3275C2.7632 17.2205 2.636 19.6104 2 21.4971C2 21.6229 2 21.6229 2.1272 21.6229C2.1272 21.6229 3.5264 21.6229 3.7808 21.6229C4.4168 18.8557 4.4168 16.5916 4.4168 14.9564H6.70641V19.9877H5.18C5.0528 19.9877 5.0528 19.9877 5.0528 20.1135L5.56161 21.6229H8.48721V2.75544H2.8904L2.7632 14.3275ZM4.544 9.79929H6.83361V13.8243H4.544V9.79929ZM6.83361 4.39062V8.28989H4.544V4.39062H6.83361Z" />
25+
<path d="M18.6633 9.4212H20.8257V7.9118H14.3385C14.4657 7.40867 14.5929 6.77976 14.9745 6.40241H20.5713V4.89301H19.0449C19.1721 4.01253 19.6809 2.88048 19.6809 2.88048C19.6809 2.7547 19.6809 2.7547 19.5537 2.7547H18.1545L17.5185 4.89301H15.4833C15.6105 4.01253 15.7377 3.00626 15.9921 2.12578C15.9921 2 15.9921 2 15.8649 2C15.7377 2 14.7201 2 14.3385 2C14.2113 3.13205 14.0841 4.13831 13.7025 5.01879H12.5577L11.9217 2.88048H10.5225C10.3953 2.88048 10.3953 2.88048 10.3953 3.00626C10.3953 3.13205 10.6497 4.13831 11.0313 5.01879H9.50487V6.52819H13.0665C12.9393 7.03132 12.8121 7.66024 12.4305 8.03759H8.99607V9.54698H11.6673C10.5225 11.0564 9.50487 11.6853 8.99607 12.0626C8.99607 12.1884 8.99607 13.6978 8.99607 13.6978C8.99607 13.8236 9.12327 13.8236 9.25047 13.6978C9.75927 13.572 10.3953 13.0689 10.7769 12.5658H17.0097V14.8299H12.1761L12.3033 13.4463C12.3033 13.3205 12.3033 13.3205 12.1761 13.3205C12.0489 13.3205 10.6497 13.3205 10.6497 13.3205L10.5225 16.0877C10.5225 16.2135 10.5225 16.2135 10.6497 16.2135C10.7769 16.2135 19.0449 16.2135 19.0449 16.2135V20.2385H15.3561C15.2289 20.2385 15.2289 20.2385 15.2289 20.3643L15.7377 21.8737H21.0801V14.8299H19.0449V11.8111C19.8081 12.44 20.5713 13.0689 21.3345 13.3205C21.4617 13.4463 21.5889 13.4463 21.5889 13.3205C21.5889 13.3205 21.5889 11.8111 21.5889 11.6853C20.8257 11.4337 19.6809 10.8048 18.6633 9.4212ZM16.6281 9.4212C16.8825 10.0501 17.3913 10.679 17.9001 11.0564H12.4305C12.9393 10.5532 13.1937 9.92433 13.7025 9.4212H16.6281Z" />
26+
<path d="M30.2386 16.2143C30.2386 16.2143 28.7122 17.3464 27.1858 18.4784V7.91266H23.1153V9.79941H25.4049V19.9878C24.7689 20.491 24.2601 20.6168 24.2601 20.6168L25.4049 22.0004L30.3658 18.3527L30.2386 16.2143C30.6202 16.2143 30.493 16.0886 30.2386 16.2143Z" />
27+
<path d="M25.6593 6.27748H27.4402C27.6946 6.27748 27.6946 6.1517 27.6946 6.1517L25.1505 2.25243H23.2425L23.1153 2.37821C23.2425 2.50399 25.6593 6.27748 25.6593 6.27748Z" />
28+
<path d="M60.2579 3.13223H46.0115V5.01898H60.2579V3.13223Z" />
29+
<path d="M51.2266 11.8114H62.4202V9.9247H43.9762V11.8114H49.0642C47.9194 14.5787 45.5026 21.371 45.3754 21.4967C45.3754 21.6225 45.3754 21.6225 45.5026 21.6225H61.4026C61.5298 21.6225 61.5298 21.4967 61.5298 21.4967L59.2402 15.3334H57.3322C57.205 15.3334 57.205 15.4592 57.205 15.4592C57.205 15.5849 58.8586 19.8616 58.8586 19.8616H48.4282L51.2266 11.8114Z" />
30+
</svg>
31+
);
32+
});
33+
34+
export default Icon;

src/TencentCloud/index.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
nav: Components
3+
group: Model
4+
title: TencentCloud (腾讯云)
5+
atomId: TencentCloud
6+
description: https://cloud.tencent.com
7+
---
8+
9+
## Icons
10+
11+
```tsx
12+
import { TencentCloud } from '@lobehub/icons';
13+
import { Flexbox } from 'react-layout-kit';
14+
15+
export default () => (
16+
<Flexbox gap={16} horizontal>
17+
<TencentCloud size={64} />
18+
<TencentCloud.Color size={64} />
19+
</Flexbox>
20+
);
21+
```
22+
23+
## Text
24+
25+
```tsx
26+
import { TencentCloud } from '@lobehub/icons';
27+
28+
export default () => <TencentCloud.Text size={48} />;
29+
```
30+
31+
## Combine
32+
33+
```tsx
34+
import { TencentCloud } from '@lobehub/icons';
35+
import { Flexbox } from 'react-layout-kit';
36+
37+
export default () => (
38+
<Flexbox gap={16} align={'flex-start'}>
39+
<TencentCloud.Combine size={64} />
40+
<TencentCloud.Combine size={64} type={'color'} />
41+
</Flexbox>
42+
);
43+
```
44+
45+
## Avatars
46+
47+
```tsx
48+
import { TencentCloud } from '@lobehub/icons';
49+
import { Flexbox } from 'react-layout-kit';
50+
51+
export default () => (
52+
<Flexbox gap={16} horizontal>
53+
<TencentCloud.Avatar size={64} />
54+
<TencentCloud.Avatar size={64} shape={'square'} />
55+
</Flexbox>
56+
);
57+
```
58+
59+
## Colors
60+
61+
```tsx
62+
import { TencentCloud } from '@lobehub/icons';
63+
import { Flexbox } from 'react-layout-kit';
64+
65+
import ColorPreview from '../components/ColorPreview';
66+
67+
export default () => (
68+
<Flexbox gap={16} horizontal>
69+
<ColorPreview color={TencentCloud.colorPrimary} />
70+
</Flexbox>
71+
);
72+
```

src/TencentCloud/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use client';
2+
3+
import Avatar from './components/Avatar';
4+
import Color from './components/Color';
5+
import Combine from './components/Combine';
6+
import Mono from './components/Mono';
7+
import Text from './components/Text';
8+
import { COLOR_PRIMARY, TITLE } from './style';
9+
10+
export type CompoundedIcon = typeof Mono & {
11+
Avatar: typeof Avatar;
12+
Color: typeof Color;
13+
Combine: typeof Combine;
14+
Text: typeof Text;
15+
colorPrimary: string;
16+
title: string;
17+
};
18+
19+
const Icons = Mono as CompoundedIcon;
20+
Icons.Color = Color;
21+
Icons.Text = Text;
22+
Icons.Combine = Combine;
23+
Icons.Avatar = Avatar;
24+
Icons.colorPrimary = COLOR_PRIMARY;
25+
Icons.title = TITLE;
26+
27+
export default Icons;

src/TencentCloud/style.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const TITLE = 'TencentCloud';
2+
export const TEXT_MULTIPLE = 0.75;
3+
export const SPACE_MULTIPLE = 0.2;
4+
export const COLOR_PRIMARY = '#2151d1';

src/features/modelConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const modelMappings: ModelMapping[] = [
7777
{ Icon: OpenAI, keywords: ['^gpt-', '/gpt-', 'openai', 'text-embedding-', 'tts-', 'whisper-'] },
7878
{ Icon: ChatGLM, keywords: ['glm-', 'chatglm'] },
7979
{ Icon: CodeGeeX, keywords: ['^codegeex'] },
80-
{ Icon: DeepSeek, keywords: ['deepseek'] },
8180
{ Icon: Claude, keywords: ['claude'] },
8281
{ Icon: Aws, keywords: ['titan'] },
8382
{ Icon: Fireworks, keywords: ['accounts/fireworks/models/fire'] },
@@ -149,4 +148,5 @@ export const modelMappings: ModelMapping[] = [
149148
],
150149
},
151150
{ Icon: Udio, keywords: ['udio'] },
151+
{ Icon: DeepSeek, keywords: ['deepseek'] },
152152
];

0 commit comments

Comments
 (0)