Skip to content

Commit 0fdf0fd

Browse files
author
dreamer6680
committed
feat: add a linkfastgpt compontent
1 parent 90b8a4f commit 0fdf0fd

File tree

9 files changed

+78
-14
lines changed

9 files changed

+78
-14
lines changed

document/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { Alert } from '@/components/docs/Alert'; #高亮块组件
5151

5252
<Alert icon="🤖" context="success">
5353
快速开始体验
54-
- 海外版:[https://tryfastgpt.ai](https://tryfastgpt.ai)
54+
- 海外版:[https://fastgpt.io](https://fastgpt.io)
5555
- 国内版:[https://fastgpt.cn](https://fastgpt.cn)
5656
</Alert>
5757

@@ -62,6 +62,11 @@ import {Redirect} from '@/components/docs/Redirect' #重定向组件,如果你
6262
<Tabs items={['Javascript', 'Rust']}> #tabs组件用法,渲染效果参考`introduction`下`development`的`faq`文档
6363
<Tab value="Javascript">Javascript is weird</Tab>
6464
<Tab value="Rust">Rust is fast</Tab>
65+
66+
67+
import FastGPTLink from '@/components/docs/linkFastGPT'; #FastGPT跳转链接组件,通过接收一个域名环境变量,来实现跳转到海外或者国内
68+
69+
本文档介绍了如何设置开发环境以构建和测试 <FastGPTLink>FastGPT</FastGPTLink>
6570
</Tabs>
6671

6772
```
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use client';
2+
3+
import React, { useMemo } from 'react';
4+
5+
type FastGPTLinkProps = {
6+
children: React.ReactNode;
7+
className?: string;
8+
style?: React.CSSProperties;
9+
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
10+
};
11+
12+
const defaultStyles: React.CSSProperties = {
13+
color: '#3370ff',
14+
textDecoration: 'none',
15+
transition: 'all 0.2s ease-in-out'
16+
};
17+
18+
const hoverStyles: React.CSSProperties = {
19+
color: '#2152d9',
20+
textDecoration: 'underline'
21+
};
22+
23+
const FastGPTLink = ({ children, className, style, onClick, ...props }: FastGPTLinkProps) => {
24+
const href = useMemo(() => {
25+
return process.env.NEXT_PUBLIC_DOMAIN ?? 'https://fastgpt.io';
26+
}, []);
27+
28+
const [isHovered, setIsHovered] = React.useState(false);
29+
30+
const combinedStyles = {
31+
...defaultStyles,
32+
...(isHovered ? hoverStyles : {}),
33+
...style
34+
};
35+
36+
return (
37+
<a
38+
href={href}
39+
target="_blank"
40+
rel="noopener noreferrer"
41+
className={className}
42+
style={combinedStyles}
43+
onMouseEnter={() => setIsHovered(true)}
44+
onMouseLeave={() => setIsHovered(false)}
45+
onClick={(e) => {
46+
if (onClick) {
47+
e.preventDefault();
48+
onClick(e);
49+
}
50+
}}
51+
{...props}
52+
>
53+
{children}
54+
</a>
55+
);
56+
};
57+
58+
export default React.memo(FastGPTLink);

document/content/docs/introduction/development/intro.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ description: 对 FastGPT 进行开发调试
44
---
55

66
import { Alert } from '@/components/docs/Alert';
7+
import FastGPTLink from '@/components/docs/linkFastGPT';
78

8-
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://tryfastgpt.ai)
9+
本文档介绍了如何设置开发环境以构建和测试 <FastGPTLink>FastGPT</FastGPTLink>
910

1011
## 前置依赖项
1112

12-
您需要在计算机上安装和配置以下依赖项才能构建 [FastGPT](https://tryfastgpt.ai)
13+
您需要在计算机上安装和配置以下依赖项才能构建 <FastGPTLink>FastGPT</FastGPTLink>
1314

1415
- [Git](http://git-scm.com/)
1516
- [Docker](https://www.docker.com/)(构建镜像)

document/content/docs/introduction/guide/dashboard/workflow/http.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Pos
6868
"array": [1, 2, 3],
6969
"obj": {
7070
"name": "FastGPT",
71-
"url": "https://tryfastgpt.ai"
71+
"url": "https://fastgpt.io"
7272
}
7373
}
7474
```
@@ -107,7 +107,7 @@ HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Pos
107107
"array2": [1, 2, 3],
108108
"object": {
109109
"name": "FastGPT",
110-
"url": "https://tryfastgpt.ai"
110+
"url": "https://fastgpt.io"
111111
}
112112
}
113113
```

document/content/docs/introduction/index.en.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,将智能
99

1010
<Alert icon="🤖" context="success">
1111
快速开始体验
12-
- 海外版:[https://tryfastgpt.ai](https://tryfastgpt.ai)
12+
- 海外版:[https://fastgpt.io](https://fastgpt.io)
1313
- 国内版:[https://fastgpt.cn](https://fastgpt.cn)
1414
</Alert>
1515

document/content/docs/introduction/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,将智能
99

1010
<Alert icon="🤖" context="success">
1111
快速开始体验
12-
- 海外版:[https://tryfastgpt.ai](https://tryfastgpt.ai)
12+
- 海外版:[https://fastgpt.io](https://fastgpt.io)
1313
- 国内版:[https://fastgpt.cn](https://fastgpt.cn)
1414
</Alert>
1515

document/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

document/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"@orama/orama": "^3.1.11",
1313
"@orama/tokenizers": "^3.1.11",
14-
"algoliasearch": "^5.32.0",
14+
"algoliasearch": "^5.34.0",
1515
"fast-glob": "^3.3.3",
1616
"fs-extra": "^11.3.0",
1717
"fumadocs-core": "15.6.3",
@@ -41,4 +41,4 @@
4141
"typescript": "^5.8.3",
4242
"zod": "^4.0.5"
4343
}
44-
}
44+
}

document/update-index.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// @ts-check
22
import { algoliasearch } from 'algoliasearch';
3-
import { sync } from 'fumadocs-core/search/algolia';
3+
import { sync } from 'fumadocs-core/dist/search/algolia';
44
import * as fs from 'node:fs';
55

66
const content = fs.readFileSync('.next/server/app/static.json.body');
77

88
// now you can pass it to `sync`
9-
/** @type {import('fumadocs-core/search/algolia').DocumentRecord[]} **/
9+
/** @type {import('fumadocs-core/dist/search/algolia').DocumentRecord[]} **/
1010
const records = JSON.parse(content.toString());
1111

1212
const client = algoliasearch(process.env.ALGOLIA_APP_ID || '', process.env.ALGOLIA_API_KEY || '');
1313

1414
void sync(client, {
1515
indexName: 'document',
16-
documents: records,
17-
});
16+
documents: records
17+
});

0 commit comments

Comments
 (0)