Compare commits
250 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb59b60761 | ||
|
|
9334a0dcf6 | ||
|
|
c614f8b9ca | ||
|
|
478386c612 | ||
|
|
dfcffc7fc1 | ||
|
|
b4238257b6 | ||
|
|
38f47956cd | ||
|
|
7fed4d697f | ||
|
|
5ed89130ef | ||
|
|
3671e55001 | ||
|
|
3bcc3430fb | ||
|
|
d6233cd7b1 | ||
|
|
64708ea424 | ||
|
|
85a11d08b2 | ||
|
|
a7569037fe | ||
|
|
4726034344 | ||
|
|
9a57e94b79 | ||
|
|
761e35c226 | ||
|
|
5ebe0017a0 | ||
|
|
036097243a | ||
|
|
84de95d294 | ||
|
|
fdab383b26 | ||
|
|
060492dbf7 | ||
|
|
9d5fd24085 | ||
|
|
903f39fe17 | ||
|
|
2ef98c24be | ||
|
|
6d00f73e91 | ||
|
|
813eaacfd0 | ||
|
|
322ca757af | ||
|
|
a177a302d4 | ||
|
|
034108c218 | ||
|
|
0632dfed80 | ||
|
|
6c16fa9166 | ||
|
|
ac4854a47b | ||
|
|
b9a6b71fe9 | ||
|
|
aba50e958e | ||
|
|
52cbfeace3 | ||
|
|
bebf565c06 | ||
|
|
c9bb39d802 | ||
|
|
454a479fd8 | ||
|
|
d057ad3a45 | ||
|
|
a206d77287 | ||
|
|
14bd1b5404 | ||
|
|
450167c951 | ||
|
|
67445b40bc | ||
|
|
d3731d221a | ||
|
|
f6e2d13e21 | ||
|
|
77e6cf4157 | ||
|
|
fd3f32d083 | ||
|
|
f7544ea47b | ||
|
|
a1a9a0b463 | ||
|
|
dbfe1fca31 | ||
|
|
94f3b7f2d6 | ||
|
|
22a0f6bcfa | ||
|
|
c1d08c0ccc | ||
|
|
a4c19fbd0a | ||
|
|
ace84f015e | ||
|
|
bb7adc96ed | ||
|
|
ad63210f45 | ||
|
|
fa106eb24c | ||
|
|
3248e95d53 | ||
|
|
3e57c7f559 | ||
|
|
eaaf6f5978 | ||
|
|
6288dc9492 | ||
|
|
de573e4303 | ||
|
|
b3acd570f7 | ||
|
|
19904e648b | ||
|
|
785ba03239 | ||
|
|
366fe0eada | ||
|
|
225554f22c | ||
|
|
5627a4bfde | ||
|
|
113c57bcbe | ||
|
|
649de7f028 | ||
|
|
26d800981c | ||
|
|
40b1d22d9d | ||
|
|
2d0e6bd085 | ||
|
|
226cae5ab9 | ||
|
|
238381256d | ||
|
|
5fab3734fa | ||
|
|
884c2d9553 | ||
|
|
918d7fb257 | ||
|
|
0719f7bd4a | ||
|
|
9b74437417 | ||
|
|
bebbba399a | ||
|
|
14e22687e3 | ||
|
|
61347d9aaa | ||
|
|
5bf0dd0ef1 | ||
|
|
5545e84bb9 | ||
|
|
86c27e85ef | ||
|
|
fdeb1590d7 | ||
|
|
f8b8fcc172 | ||
|
|
5bbaa8264a | ||
|
|
0f3418daf5 | ||
|
|
7417de74da | ||
|
|
fe9cb437e5 | ||
|
|
2827c633cd | ||
|
|
dd1e2d5eb7 | ||
|
|
6293801bfa | ||
|
|
7f2aa97de7 | ||
|
|
2196930005 | ||
|
|
231afc4ac5 | ||
|
|
2dc0b0fbec | ||
|
|
72bb3f667b | ||
|
|
02d6b7c788 | ||
|
|
e098b2f1dc | ||
|
|
832a4d6638 | ||
|
|
4d570ecd4f | ||
|
|
067f3f4098 | ||
|
|
d682a8252f | ||
|
|
c6dd3076c5 | ||
|
|
b4f3a77b01 | ||
|
|
7141189102 | ||
|
|
3ba9c21828 | ||
|
|
7b388b287a | ||
|
|
e9ba00d38f | ||
|
|
a109c59cc6 | ||
|
|
91bc573571 | ||
|
|
2712ef21ff | ||
|
|
593af8f7dc | ||
|
|
96ebec9809 | ||
|
|
f35ba8e5a7 | ||
|
|
e36d9d794f | ||
|
|
10dcdb5491 | ||
|
|
025d405fe2 | ||
|
|
fe71efbbd2 | ||
|
|
56f6e69bc7 | ||
|
|
998e7833e8 | ||
|
|
110bf9391f | ||
|
|
48f2c95bb9 | ||
|
|
9f37e56173 | ||
|
|
af1cff6230 | ||
|
|
3760726354 | ||
|
|
6ddf0b23fc | ||
|
|
f680bdf54d | ||
|
|
834d36981f | ||
|
|
2fdca621e6 | ||
|
|
8c7f4a3a30 | ||
|
|
41da52d6ed | ||
|
|
446d9cb1b9 | ||
|
|
48a5853550 | ||
|
|
c129874d59 | ||
|
|
cc6fa4207a | ||
|
|
e27abe1f6b | ||
|
|
5cecef5836 | ||
|
|
ee89d0d7a4 | ||
|
|
6eeb1b4da1 | ||
|
|
b6c9bb4a65 | ||
|
|
20aad33850 | ||
|
|
02b51317b4 | ||
|
|
ba933c7450 | ||
|
|
856d7ce48f | ||
|
|
23f22cda18 | ||
|
|
0a9a7691b4 | ||
|
|
8d25a1d3ec | ||
|
|
2d1e53c3b5 | ||
|
|
71d0093768 | ||
|
|
cd554f573e | ||
|
|
2d016b7462 | ||
|
|
65515e7952 | ||
|
|
5906daff9f | ||
|
|
55cefccad1 | ||
|
|
87dac54f1e | ||
|
|
45b8d7e8de | ||
|
|
a478621730 | ||
|
|
a233ab9584 | ||
|
|
8d2a192515 | ||
|
|
dcaf972767 | ||
|
|
f9d43ac009 | ||
|
|
abcf48d5ec | ||
|
|
bf5145e632 | ||
|
|
f37cdabb15 | ||
|
|
e99c91aaa6 | ||
|
|
a4787bce5c | ||
|
|
f24e41f5ec | ||
|
|
85de3c1d64 | ||
|
|
c6f682310c | ||
|
|
991398b8d2 | ||
|
|
f452554663 | ||
|
|
57ff38e16f | ||
|
|
f7b55b501f | ||
|
|
cf7145ab54 | ||
|
|
1eedb9caba | ||
|
|
6390d64417 | ||
|
|
3d80eb288b | ||
|
|
5cb196535f | ||
|
|
982325d066 | ||
|
|
36f8755d09 | ||
|
|
fc96bb99cc | ||
|
|
1e4ffc2481 | ||
|
|
ee7496467b | ||
|
|
b5c98a4f63 | ||
|
|
090c880860 | ||
|
|
dd2a9bdee5 | ||
|
|
8d60ef505f | ||
|
|
b14514c105 | ||
|
|
11ffaaf2c5 | ||
|
|
e2ae571d15 | ||
|
|
f548e24e7d | ||
|
|
5605f1a892 | ||
|
|
88d10451c9 | ||
|
|
8a7bd689ae | ||
|
|
a9cdece341 | ||
|
|
babf03c218 | ||
|
|
9e169a48e3 | ||
|
|
e223390231 | ||
|
|
3257744c76 | ||
|
|
e1e112eaff | ||
|
|
5c37d29451 | ||
|
|
3a16f1a21c | ||
|
|
fa7b73f942 | ||
|
|
f8610d750d | ||
|
|
96a03e9927 | ||
|
|
a3b0ef066b | ||
|
|
9d084b633c | ||
|
|
4b4bea196a | ||
|
|
e247545afa | ||
|
|
93b44fc8f5 | ||
|
|
9aa6fd4904 | ||
|
|
c8bc9838e3 | ||
|
|
5c8c7fb9f2 | ||
|
|
d902d29c71 | ||
|
|
9d29b471bc | ||
|
|
4a33e04a08 | ||
|
|
a9ab9ebe8e | ||
|
|
24596a6e21 | ||
|
|
5cc01b8509 | ||
|
|
980b4d3db5 | ||
|
|
2b25e3cc2d | ||
|
|
565bfc8486 | ||
|
|
b17d14bb7d | ||
|
|
c11131d653 | ||
|
|
f7f4a8de4d | ||
|
|
6385794603 | ||
|
|
b8b26ad700 | ||
|
|
05611df056 | ||
|
|
d0085a23e6 | ||
|
|
bc6864c3dc | ||
|
|
b20d075d35 | ||
|
|
19c8a06d51 | ||
|
|
fcb915c988 | ||
|
|
9bffb9ffc0 | ||
|
|
c1d7c08c7a | ||
|
|
a5d590e0bd | ||
|
|
db544afa7c | ||
|
|
a259d034b8 | ||
|
|
9fc6a8c74a | ||
|
|
5c8f2f95f7 | ||
|
|
f1e16b209a | ||
|
|
ced23e1695 | ||
|
|
1db816150b |
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 微信交流群
|
||||
url: https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg
|
||||
- name: 飞书话题群
|
||||
url: https://oss.laf.run/otnvvf-imgs/1719505774252.jpg
|
||||
about: FastGPT 全是问题群
|
||||
|
||||
BIN
.github/imgs/intro1.png
vendored
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 259 KiB |
BIN
.github/imgs/intro2.png
vendored
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 371 KiB |
BIN
.github/imgs/intro3.png
vendored
|
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 259 KiB |
BIN
.github/imgs/intro4.png
vendored
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 228 KiB |
96
.github/workflows/build-sandbox-image.yml
vendored
@@ -10,6 +10,7 @@ jobs:
|
||||
build-fastgpt-sandbox-images:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
# install env
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -30,22 +31,53 @@ jobs:
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
# login docker
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_PAT }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
|
||||
# Set tag
|
||||
- name: Set image name and tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build and publish image for main branch or tag push event
|
||||
env:
|
||||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
|
||||
Git_Tag: ${{ env.Git_Tag }}
|
||||
Git_Latest: ${{ env.Git_Latest }}
|
||||
Ali_Tag: ${{ env.Ali_Tag }}
|
||||
Ali_Latest: ${{ env.Ali_Latest }}
|
||||
Docker_Hub_Tag: ${{ env.Docker_Hub_Tag }}
|
||||
Docker_Hub_Latest: ${{ env.Docker_Hub_Latest }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
-f projects/sandbox/Dockerfile \
|
||||
@@ -55,54 +87,10 @@ jobs:
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${DOCKER_REPO_TAGGED} \
|
||||
-t ${Git_Tag} \
|
||||
-t ${Git_Latest} \
|
||||
-t ${Ali_Tag} \
|
||||
-t ${Ali_Latest} \
|
||||
-t ${Docker_Hub_Tag} \
|
||||
-t ${Docker_Hub_Latest} \
|
||||
.
|
||||
push-to-ali-hub:
|
||||
needs: build-fastgpt-sandbox-images
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Pull image from GitHub Container Registry
|
||||
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
- name: Tag image with Docker Hub repository name and version tag
|
||||
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
- name: Push image to Docker Hub
|
||||
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
push-to-docker-hub:
|
||||
needs: build-fastgpt-sandbox-images
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Pull image from GitHub Container Registry
|
||||
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
- name: Tag image with Docker Hub repository name and version tag
|
||||
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
- name: Push image to Docker Hub
|
||||
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
|
||||
|
||||
3
.github/workflows/docs-deploy-kubeconfig.yml
vendored
@@ -16,6 +16,9 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Change baseURL
|
||||
run: sed -i 's|^baseURL =.*|baseURL = "https://doc.fastgpt.cn"|g' ./docSite/hugo.toml
|
||||
|
||||
- name: Get current date and time
|
||||
id: datetime
|
||||
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
2
.github/workflows/docs-deploy-vercel.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
|
||||
- name: Add cdn for images
|
||||
run: |
|
||||
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/docs)
|
||||
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/zh-cn/docs)
|
||||
|
||||
# Step 3 - Install Hugo (specific version)
|
||||
- name: Install Hugo
|
||||
|
||||
2
.github/workflows/docs-preview.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
|
||||
- name: Add cdn for images
|
||||
run: |
|
||||
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/docs)
|
||||
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/zh-cn/docs)
|
||||
|
||||
# Step 3 - Install Hugo (specific version)
|
||||
- name: Install Hugo
|
||||
|
||||
91
.github/workflows/fastgpt-image.yml
vendored
@@ -11,6 +11,7 @@ jobs:
|
||||
build-fastgpt-images:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
# install env
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -31,19 +32,45 @@ jobs:
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
# login docker
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_PAT }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
|
||||
# Set tag
|
||||
- name: Set image name and tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:latest" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build and publish image for main branch or tag push event
|
||||
env:
|
||||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
|
||||
@@ -56,56 +83,10 @@ jobs:
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${DOCKER_REPO_TAGGED} \
|
||||
-t ${Git_Tag} \
|
||||
-t ${Git_Latest} \
|
||||
-t ${Ali_Tag} \
|
||||
-t ${Ali_Latest} \
|
||||
-t ${Docker_Hub_Tag} \
|
||||
-t ${Docker_Hub_Latest} \
|
||||
.
|
||||
push-to-docker-hub:
|
||||
needs: build-fastgpt-images
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.repository == 'labring/FastGPT'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Pull image from GitHub Container Registry
|
||||
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
- name: Tag image with Docker Hub repository name and version tag
|
||||
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
- name: Push image to Docker Hub
|
||||
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
push-to-ali-hub:
|
||||
needs: build-fastgpt-images
|
||||
if: github.repository == 'labring/FastGPT'
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Pull image from GitHub Container Registry
|
||||
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
- name: Tag image with Docker Hub repository name and version tag
|
||||
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
- name: Push image to Docker Hub
|
||||
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
|
||||
5
.github/workflows/helm-release.yaml
vendored
@@ -24,11 +24,6 @@ jobs:
|
||||
export APP_VERSION=${{ steps.vars.outputs.tag }}
|
||||
export HELM_VERSION=${{ steps.vars.outputs.tag }}
|
||||
export HELM_REPO=ghcr.io/${{ github.repository_owner }}
|
||||
if [[ ! "$line" =~ ^v ]]
|
||||
then
|
||||
unset APP_VERSION
|
||||
unset HELM_VERSION
|
||||
fi
|
||||
helm dependency update files/helm/fastgpt
|
||||
helm package files/helm/fastgpt --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin
|
||||
helm push bin/fastgpt-${HELM_VERSION}-helm.tgz oci://${HELM_REPO}
|
||||
|
||||
4
.github/workflows/preview-image.yml
vendored
@@ -4,12 +4,10 @@ on:
|
||||
paths:
|
||||
- 'projects/app/**'
|
||||
- 'packages/**'
|
||||
branches:
|
||||
- 'main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-fastgpt-images:
|
||||
preview-fastgpt-images:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
2
.npmrc
@@ -1 +1,3 @@
|
||||
public-hoist-pattern[]=*tiktoken*
|
||||
public-hoist-pattern[]=*@zilliz/milvus2-sdk-node*
|
||||
registry=https://registry.npmjs.org/
|
||||
@@ -3,4 +3,6 @@ dist
|
||||
**/.DS_Store
|
||||
node_modules
|
||||
docSite/
|
||||
*.md
|
||||
*.md
|
||||
|
||||
cl100l_base.ts
|
||||
5
.vscode/extensions.json
vendored
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"inlang.vs-code-extension"
|
||||
]
|
||||
}
|
||||
6
.vscode/i18n-ally-custom-framework.yml
vendored
@@ -26,13 +26,14 @@ usageMatchRegex:
|
||||
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]userT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]chatT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
||||
|
||||
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
||||
# and works like how the i18next framework identifies the namespace scope from the
|
||||
# useTranslation() hook.
|
||||
# You should unescape RegEx strings in order to fit in the YAML file
|
||||
# To help with this, you can use https://www.freeformatter.com/json-escape.html
|
||||
scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"
|
||||
scopeRangeRegex: "([^:]+):"
|
||||
|
||||
# An array of strings containing refactor templates.
|
||||
# The "$1" will be replaced by the keypath specified.
|
||||
@@ -41,6 +42,5 @@ scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"
|
||||
# refactorTemplates:
|
||||
# - i18n.get("$1")
|
||||
|
||||
|
||||
# If set to true, only enables this custom framework (will disable all built-in frameworks)
|
||||
monopoly: true
|
||||
monopoly: false
|
||||
|
||||
6
.vscode/nextapi.code-snippets
vendored
@@ -35,17 +35,19 @@
|
||||
"scope": "typescriptreact",
|
||||
"prefix": "context",
|
||||
"body": [
|
||||
"import { ReactNode } from 'react';",
|
||||
"import React, { ReactNode } from 'react';",
|
||||
"import { createContext } from 'use-context-selector';",
|
||||
"",
|
||||
"type ContextType = {$1};",
|
||||
"",
|
||||
"export const Context = createContext<ContextType>({});",
|
||||
"",
|
||||
"export const ContextProvider = ({ children }: { children: ReactNode }) => {",
|
||||
"const ContextProvider = ({ children }: { children: ReactNode }) => {",
|
||||
" const contextValue: ContextType = {};",
|
||||
" return <Context.Provider value={contextValue}>{children}</Context.Provider>;",
|
||||
"};",
|
||||
"",
|
||||
"export default ContextProvider"
|
||||
],
|
||||
"description": "FastGPT usecontext template"
|
||||
}
|
||||
|
||||
22
.vscode/settings.json
vendored
@@ -1,16 +1,28 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.mouseWheelZoom": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"prettier.prettierPath": "node_modules/prettier",
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"prettier.prettierPath": "",
|
||||
"i18n-ally.localesPaths": [
|
||||
"projects/app/i18n",
|
||||
"packages/web/i18n",
|
||||
],
|
||||
"i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"i18n-ally.enabledParsers": [
|
||||
"json",
|
||||
"yaml",
|
||||
"js",
|
||||
"ts"
|
||||
],
|
||||
"i18n-ally.keystyle": "flat",
|
||||
"i18n-ally.sortKeys": true,
|
||||
"i18n-ally.keepFulfilled": false,
|
||||
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
|
||||
"i18n-ally.displayLanguage": "zh", // 显示语言
|
||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key"
|
||||
"i18n-ally.namespace": true,
|
||||
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
|
||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
|
||||
"i18n-ally.translate.engines": ["deepl", "google"],
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
}
|
||||
}
|
||||
2
LICENSE
@@ -5,7 +5,7 @@ The FastGPT is licensed under the Apache License 2.0, with the following additio
|
||||
1. FastGPT is permitted to be used for commercialization. You can use FastGPT as a "backend-as-a-service" for your other applications, or delivering it to enterprises as an application development platform. However, when the following conditions are met, you must contact the producer to obtain a commercial license:
|
||||
|
||||
a. Multi-tenant SaaS service: Unless explicitly authorized by FastGPT in writing, you may not use the FastGPT.AI source code to operate a multi-tenant SaaS service that is similar to the FastGPT.
|
||||
b. LOGO and copyright information: In the process of using FastGPT, you may not remove or moFastGPT the LOGO or copyright information in the FastGPT console.
|
||||
b. LOGO and copyright information: In the process of using FastGPT, you may not remove or modify the LOGO or copyright information in the FastGPT console.
|
||||
|
||||
Please contact yujinlong@sealos.io by email to inquire about licensing matters.
|
||||
|
||||
|
||||
20
README.md
@@ -52,10 +52,10 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
`1` 应用编排能力
|
||||
- [x] 提供简易模式,无需操作编排
|
||||
- [x] 工作流编排
|
||||
- [x] 源文件引用追踪
|
||||
- [x] 工具调用
|
||||
- [x] 插件 - 工作流封装能力
|
||||
- [ ] Code sandbox
|
||||
- [x] Code sandbox
|
||||
- [ ] 循环调用
|
||||
|
||||
`2` 知识库能力
|
||||
- [x] 多库复用,混用
|
||||
@@ -65,7 +65,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
- [x] 支持 txt,md,html,pdf,docx,pptx,csv,xlsx (有需要更多可 PR file loader)
|
||||
- [x] 支持 url 读取、CSV 批量导入
|
||||
- [x] 混合检索 & 重排
|
||||
- [ ] 支持文件阅读器
|
||||
- [ ] 标签过滤
|
||||
|
||||
`3` 应用调试能力
|
||||
- [x] 知识库单点搜索测试
|
||||
@@ -100,13 +100,11 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
- **⚡ 快速部署**
|
||||
|
||||
> [Sealos](https://sealos.io) 的服务器在国外,不需要额外处理网络问题,无需服务器、无需魔法、无需域名,支持高并发 & 动态伸缩。点击以下按钮即可一键部署 👇
|
||||
> 使用 [Sealos](https://sealos.io) 服务,无需采购服务器、无需域名,支持高并发 & 动态伸缩,并且数据库应用采用 kubeblocks 的数据库,在 IO 性能方面,远超于简单的 Docker 容器部署。
|
||||
|
||||
[](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Dfastgpt)
|
||||
[点击查看 Sealos 一键部署 FastGPT 教程](https://doc.fastgpt.in/docs/development/sealos/)
|
||||
|
||||
由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。相关使用教程可查看:[Sealos 部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos/)
|
||||
|
||||
* [快开始本地开发](https://doc.fastgpt.in/docs/development/intro/)
|
||||
* [快速开始本地开发](https://doc.fastgpt.in/docs/development/intro/)
|
||||
* [部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos)
|
||||
* [系统配置文件说明](https://doc.fastgpt.in/docs/development/configuration/)
|
||||
* [多模型配置](https://doc.fastgpt.in/docs/development/one-api/)
|
||||
@@ -120,9 +118,9 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
## 🏘️ 社区交流群
|
||||
|
||||
wx 扫一下加入:
|
||||
扫码加入飞书话题群 (新开,逐渐弃用微信群):
|
||||
|
||||

|
||||

|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -214,4 +212,4 @@ wx 扫一下加入:
|
||||
1. 允许作为后台服务直接商用,但不允许提供 SaaS 服务。
|
||||
2. 未经商业授权,任何形式的商用服务均需保留相关版权信息。
|
||||
3. 完整请查看 [FastGPT Open Source License](./LICENSE)
|
||||
4. 联系方式:yujinlong@sealos.io,[点击查看商业版定价策略](https://doc.fastgpt.in/docs/commercial)
|
||||
4. 联系方式:Dennis@sealos.io,[点击查看商业版定价策略](https://doc.fastgpt.in/docs/commercial)
|
||||
|
||||
BIN
bin/fastgpt-v1.0.0-helm.tgz
Normal file
72
dev.md
@@ -23,6 +23,77 @@ pnpm dev
|
||||
make dev name=app
|
||||
```
|
||||
|
||||
Note: If the Node version is >= 20, you need to pass the `--no-node-snapshot` parameter to Node when running `pnpm i`
|
||||
|
||||
```sh
|
||||
NODE_OPTIONS=--no-node-snapshot pnpm i
|
||||
```
|
||||
|
||||
## I18N
|
||||
|
||||
### Install i18n-ally Plugin
|
||||
|
||||
1. Open the Extensions Marketplace in VSCode, search for and install the `i18n Ally` plugin.
|
||||
|
||||
### Code Optimization Examples
|
||||
|
||||
#### Fetch Specific Namespace Translations in `getServerSideProps`
|
||||
|
||||
```typescript
|
||||
// pages/yourPage.tsx
|
||||
export async function getServerSideProps(context: any) {
|
||||
return {
|
||||
props: {
|
||||
currentTab: context?.query?.currentTab || TabEnum.info,
|
||||
...(await serverSideTranslations(context.locale, ['publish', 'user']))
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
#### Use useTranslation Hook in Page
|
||||
|
||||
```typescript
|
||||
// pages/yourPage.tsx
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const YourComponent = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
mr={2}
|
||||
onClick={() => setShowSelected(false)}
|
||||
>
|
||||
{t('common:close')}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default YourComponent;
|
||||
```
|
||||
|
||||
#### Handle Static File Translations
|
||||
|
||||
```typescript
|
||||
// utils/i18n.ts
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
|
||||
const staticContent = {
|
||||
id: 'simpleChat',
|
||||
avatar: 'core/workflow/template/aiChat',
|
||||
name: i18nT('app:template.simple_robot'),
|
||||
};
|
||||
|
||||
export default staticContent;
|
||||
```
|
||||
|
||||
### Standardize Translation Format
|
||||
|
||||
- Use the t(namespace:key) format to ensure consistent naming.
|
||||
- Translation keys should use lowercase letters and underscores, e.g., common.close.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -37,4 +108,3 @@ docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/f
|
||||
# Make cmd: Build image with proxy
|
||||
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 proxy=taobao
|
||||
```
|
||||
|
||||
|
||||
BIN
docSite/assets/imgs/ai-translate-1.png
Normal file
|
After Width: | Height: | Size: 222 KiB |
BIN
docSite/assets/imgs/ai-translate-2.png
Normal file
|
After Width: | Height: | Size: 204 KiB |
BIN
docSite/assets/imgs/ai-translate-3.png
Normal file
|
After Width: | Height: | Size: 220 KiB |
BIN
docSite/assets/imgs/collection-tags-1.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docSite/assets/imgs/collection-tags-2.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
docSite/assets/imgs/collection-tags-3.png
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
docSite/assets/imgs/combine-subtitle.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
docSite/assets/imgs/cut-text.png
Normal file
|
After Width: | Height: | Size: 161 KiB |
BIN
docSite/assets/imgs/extract-subtitle.png
Normal file
|
After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 150 KiB |
BIN
docSite/assets/imgs/fastgpt-api1.jpg
Normal file
|
After Width: | Height: | Size: 143 KiB |
BIN
docSite/assets/imgs/feishu-bot-1.png
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
docSite/assets/imgs/feishu-bot-10.jpg
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
docSite/assets/imgs/feishu-bot-11.jpg
Normal file
|
After Width: | Height: | Size: 128 KiB |
BIN
docSite/assets/imgs/feishu-bot-12.jpg
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
docSite/assets/imgs/feishu-bot-13.jpg
Normal file
|
After Width: | Height: | Size: 187 KiB |
BIN
docSite/assets/imgs/feishu-bot-2.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
docSite/assets/imgs/feishu-bot-3.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
docSite/assets/imgs/feishu-bot-4.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
docSite/assets/imgs/feishu-bot-5.png
Normal file
|
After Width: | Height: | Size: 170 KiB |
BIN
docSite/assets/imgs/feishu-bot-6.png
Normal file
|
After Width: | Height: | Size: 161 KiB |
BIN
docSite/assets/imgs/feishu-bot-7.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
docSite/assets/imgs/feishu-bot-8.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
docSite/assets/imgs/feishu-bot-9.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
docSite/assets/imgs/fileinpu-1.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
docSite/assets/imgs/fileinpu-2.png
Normal file
|
After Width: | Height: | Size: 215 KiB |
BIN
docSite/assets/imgs/fileinpu-3.jpg
Normal file
|
After Width: | Height: | Size: 214 KiB |
BIN
docSite/assets/imgs/fileinpu-4.jpg
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
docSite/assets/imgs/fileinpu-5.jpg
Normal file
|
After Width: | Height: | Size: 246 KiB |
BIN
docSite/assets/imgs/fileinpu-6.jpg
Normal file
|
After Width: | Height: | Size: 179 KiB |
BIN
docSite/assets/imgs/fileinpu-7.jpg
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
docSite/assets/imgs/format-original-text.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
docSite/assets/imgs/gpt-translate-example.png
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
docSite/assets/imgs/loop-execution.png
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
docSite/assets/imgs/offiaccount-1.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
docSite/assets/imgs/offiaccount-2.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
BIN
docSite/assets/imgs/offiaccount-3.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
docSite/assets/imgs/offiaccount-4.png
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
docSite/assets/imgs/offiaccount-5.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
docSite/assets/imgs/offiaccount-6.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
docSite/assets/imgs/offiaccount-7.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
docSite/assets/imgs/offiaccount-8.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
docSite/assets/imgs/offiaccount-9.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
docSite/assets/imgs/sealos-deploy1.jpg
Normal file
|
After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 209 KiB |
BIN
docSite/assets/imgs/zilliz_key.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
@@ -1,133 +0,0 @@
|
||||
---
|
||||
title: " 打造高质量 AI 知识库(过期)"
|
||||
description: " 利用 FastGPT 打造高质量 AI 知识库"
|
||||
icon: "school"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 300
|
||||
---
|
||||
|
||||
## 前言
|
||||
|
||||
自从去年 12 月 ChatGPT 发布后,带动了新的一轮应用交互革命。尤其是 GPT-3.5 接口全面放开后,LLM 应用雨后春笋般快速涌现,但因为 GPT 的可控性、随机性和合规性等问题,很多应用场景都没法落地。
|
||||
|
||||
3 月时候,在 Twitter 上刷到一个老哥使用 GPT 训练自己的博客记录,并且成本非常低(比起 FT)。他给出了一个完整的流程图:
|
||||
|
||||

|
||||
|
||||
看到这个推文后,我灵机一动,应用场景就十分清晰了。直接上手开干,在经过不到 1 个月时间,FastGPT 在原来多助手管理基础上,加入了向量搜索。于是便有了最早的一期视频:
|
||||
|
||||
{{< bilibili BV1Wo4y1p7i1 >}}
|
||||
|
||||
3 个月过去了,FastGPT 延续着早期的思路去完善和扩展,目前在向量搜索 + LLM 线性问答方面的功能基本上完成了。不过我们始终没有出一期关于如何构建知识库的教程,趁着 V4 在开发中,我们计划介绍一期《如何在 FastGPT 上构建高质量知识库》,以便大家更好的使用。
|
||||
|
||||
## FastGPT 知识库完整逻辑
|
||||
|
||||
在正式构建知识库前,我们先来了解下 FastGPT 是如何进行知识库检索的。首先了解几个基本概念:
|
||||
|
||||
1. 向量:将人类直观的语言(文字、图片、视频等)转成计算机可识别的语言(数组)。
|
||||
2. 向量相似度:两个向量之间可以进行计算,得到一个相似度,即代表:两个语言相似的程度。
|
||||
3. 语言大模型的一些特点:上下文理解、总结和推理。
|
||||
|
||||
结合上述 3 个概念,便有了 “向量搜索 + 大模型 = 知识库问答” 的公式。下图是 FastGPT V3 中知识库问答功能的完整逻辑:
|
||||
|
||||

|
||||
|
||||
与大部分其他知识库问答产品不一样的是, FastGPT 采用了 QA 问答对进行存储,而不是仅进行 chunk(文本分块)处理。目的是为了减少向量化内容的长度,让向量能更好的表达文本的含义,从而提高搜索精准度。
|
||||
此外 FastGPT 还提供了搜索测试和对话测试两种途径对数据进行调整,从而方便用户调整自己的数据。根据上述流程和方式,我们以构建一个 FastGPT 常见问题机器人为例,展示如何构建一个高质量的 AI 知识库。
|
||||
|
||||
## 构建知识库应用
|
||||
|
||||
首先,先创建一个 FastGPT 常见问题知识库
|
||||
|
||||

|
||||
|
||||
### 通过 QA 拆分,获取基础知识
|
||||
|
||||
我们先直接把 FastGPT Git 上一些已有文档,进行 QA 拆分,从而获取一些 FastGPT 基础的知识。下面是 README 例子。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### 修正 QA
|
||||
|
||||
通过 README 我们一共得到了 11 组数据,整体的质量还是不错的,图片和链接都提取出来了。不过最后一个知识点出现了一些截断,我们需要手动的修正一下。
|
||||
|
||||
此外,我们观察到第一列第三个知识点。这个知识点是介绍了 FastGPT 一些资源链接,但是 QA 拆分将答案放置在了 A 中,但通常来说用户的提问并不会直接问“有哪些链接”,通常会问:“部署教程”,“问题文档”之类的。因此,我们需要将这个知识点进行简单的一个处理,如下图:
|
||||
|
||||

|
||||
|
||||
我们先来创建一个应用,看看效果如何。 首先需要去创建一个应用,并且在知识库中关联相关的知识库。另外还需要在配置页的提示词中,告诉 GPT:“知识库的范围”。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
整体的效果还是不错的,链接和对应的图片都可以顺利的展示。
|
||||
|
||||
### 录入社区常见问题
|
||||
|
||||
接着,我们再把 FastGPT 常见问题的文档导入,由于平时整理不当,我们只能手动的录入对应的问答。
|
||||
|
||||

|
||||
|
||||
导入结果如上图。可以看到,我们均采用的是问答对的格式,而不是粗略的直接导入。目的就是为了模拟用户问题,进一步的提高向量搜索的匹配效果。可以为同一个问题设置多种问法,效果更佳。
|
||||
FastGPT 还提供了 openapi 功能,你可以在本地对特殊格式的文件进行处理后,再上传到 FastGPT,具体可以参考:[FastGPT Api Docs](https://doc.fastgpt.in/docs/development/openapi)
|
||||
|
||||
## 知识库微调和参数调整
|
||||
|
||||
FastGPT 提供了搜索测试和对话测试两种途径对知识库进行微调,我们先来使用搜索测试对知识库进行调整。我们建议你提前收集一些用户问题进行测试,根据预期效果进行跳转。可以先进行搜索测试调整,判断知识点是否合理。
|
||||
|
||||
### 搜索测试
|
||||
|
||||

|
||||
|
||||
你可能会遇到下面这种情况,由于“知识库”这个关键词导致一些无关内容的相似度也被搜索进去,此时就需要给第四条记录也增加一个“知识库”关键词,从而去提高它的相似度。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### 提示词设置
|
||||
|
||||
提示词的作用是引导模型对话的方向。在设置提示词时,遵守 2 个原则:
|
||||
|
||||
1. 告诉 Gpt 回答什么方面内容。
|
||||
2. 给知识库一个基本描述,从而让 Gpt 更好的判断用户的问题是否属于知识库范围。
|
||||
|
||||

|
||||
|
||||
### 更好的限定模型聊天范围
|
||||
|
||||
首先,你可以通过调整知识库搜索时的相似度和最大搜索数量,实现从知识库层面限制聊天范围。通常我们可以设置相似度为 0.82,并设置空搜索回复内容。这意味着,如果用户的问题无法在知识库中匹配时,会直接回复预设的内容。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
由于 openai 向量模型并不是针对中文,所以当问题中有一些知识库内容的关键词时,相似度
|
||||
会较高,此时无法从知识库层面进行限定。需要通过限定词进行调整,例如:
|
||||
|
||||
> 我的问题如果不是关于 FastGPT 的,请直接回复:“我不确定”。你仅需要回答知识库中的内容,不在其中的内容,不需要回答。
|
||||
|
||||
效果如下:
|
||||
|
||||

|
||||
|
||||
当然,gpt35 在一定情况下依然是不可控的。
|
||||
|
||||
### 通过对话调整知识库
|
||||
|
||||
与搜索测试类似,你可以直接在对话页里,点击“引用”,来随时修改知识库内容。
|
||||
|
||||

|
||||
|
||||
## 总结
|
||||
|
||||
1. 向量搜索是一种可以比较文本相似度的技术。
|
||||
2. 大模型具有总结和推理能力,可以从给定的文本中回答问题。
|
||||
3. 最有效的知识库构建方式是 QA 和手动构建。
|
||||
4. Q 的长度不宜过长。
|
||||
5. 需要调整提示词,来引导模型回答知识库内容。
|
||||
6. 可以通过调整搜索相似度、最大搜索数量和限定词来控制模型回复的范围。
|
||||
@@ -1,70 +0,0 @@
|
||||
---
|
||||
title: " 接入飞书(社区文章)"
|
||||
description: "FastGPT 接入飞书机器人"
|
||||
icon: "chat"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 503
|
||||
---
|
||||
|
||||
# FastGPT 一分钟接入飞书
|
||||
|
||||
[Feishu OpenAI GitHub 地址](https://github.com/ConnectAI-E/Feishu-OpenAI)
|
||||
|
||||
[查看视频教程](https://www.bilibili.com/video/BV1Su4y1r7R3/?spm_id_from=333.999.list.card_archive.click)
|
||||
|
||||
由于 FastGPT 的 API 接口和 OpenAI 的规范一致,可以无需变更第三方应用即可使用 FastGPT 上编排好的应用。API 使用可参考 [这篇文章](/docs/use-cases/openapi/)。编排示例,可参考 [高级编排介绍](/docs/workflow/intro)
|
||||
|
||||
## 1. 获取 FastGPT 的 OpenAPI 秘钥
|
||||
|
||||
依次选择应用 -> 「API 访问」,然后点击「API 密钥」来创建密钥。 [参考这篇文章](/docs/use-cases/openapi/)
|
||||
|
||||

|
||||
|
||||
## 2. 部署飞书服务
|
||||
|
||||
推荐使用 Railway 一键部署
|
||||
|
||||
[](https://railway.app/template/10D-TF?referralCode=oMcVS2)
|
||||
|
||||
参考环境变量配置:
|
||||
|
||||

|
||||
|
||||
FastGPT 集成**重点参数:**
|
||||
|
||||
```bash
|
||||
#上一步FastGPT的OpenAPI 秘钥
|
||||
OPENAI_KEY=fastgpt-z51pkjqm9nrk03a1rx2funoy
|
||||
#调用OpenAI的BaseUrl要换成FastGPT的
|
||||
API_URL=https://api.fastgpt.in/api/openapi
|
||||
```
|
||||
|
||||
## 3. 创建飞书机器人
|
||||
|
||||
1. 前往 [开发者平台](https://open.feishu.cn/app?lang=zh-CN) 创建应用 , 并获取到 APPID 和 Secret
|
||||
2. 前往`应用功能-机器人`, 创建机器人
|
||||
3. 从 cpolar、serverless 或 Railway 获得公网地址,在飞书机器人后台的 `事件订阅` 板块填写。例如,
|
||||
- `http://xxxx.r6.cpolar.top` 为 cpolar 暴露的公网地址
|
||||
- `/webhook/event` 为统一的应用路由
|
||||
- 最终的回调地址为 `http://xxxx.r6.cpolar.top/webhook/event`
|
||||
4. 在飞书机器人后台的 `机器人` 板块,填写消息卡片请求网址。例如,
|
||||
- `http://xxxx.r6.cpolar.top` 为 cpolar 暴露的公网地址
|
||||
- `/webhook/card` 为统一的应用路由
|
||||
- 最终的消息卡片请求网址为 `http://xxxx.r6.cpolar.top/webhook/card`
|
||||
5. 在事件订阅板块,搜索三个词`机器人进群`、 `接收消息`、 `消息已读`, 把他们后面所有的权限全部勾选。 进入权限管理界面,搜索`图片`, 勾选`获取与上传图片或文件资源`。 最终会添加下列回调事件
|
||||
- im:resource(获取与上传图片或文件资源)
|
||||
- im:message
|
||||
- im:message.group_at_msg(获取群组中所有消息)
|
||||
- im:message.group_at_msg:readonly(接收群聊中 @ 机器人消息事件)
|
||||
- im:message.p2p_msg(获取用户发给机器人的单聊消息)
|
||||
- im:message.p2p_msg:readonly(读取用户发给机器人的单聊消息)
|
||||
- im:message:send_as_bot(获取用户在群组中 @ 机器人的消息)
|
||||
- im:chat:readonly(获取群组信息)
|
||||
- im:chat(获取与更新群组信息)
|
||||
|
||||
## 4. 测试飞书机器人
|
||||
|
||||
私聊机器人,或者群里艾特它,就可以基于 FastGPT 的应用进行回答啦
|
||||
|
||||

|
||||
@@ -1,489 +0,0 @@
|
||||
---
|
||||
title: '发送飞书webhook通知'
|
||||
description: '利用工具调用模块,发送一个飞书webhook通知'
|
||||
icon: 'image'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 404
|
||||
---
|
||||
|
||||
该文章展示如何发送一个简单的飞书webhook通知,以此类推,发送其他类型的通知也可以这么操作。
|
||||
|
||||
| | |
|
||||
| --------------------- | --------------------- |
|
||||
|  |  |
|
||||
|
||||
## 1. 准备飞书机器人
|
||||
|
||||
| | | |
|
||||
| --------------------- | --------------------- |--------------------- |
|
||||
|  |  | |
|
||||
|
||||
## 2. 导入编排代码
|
||||
|
||||
复制下面配置,点击「高级编排」右上角的导入按键,导入该配置,导入后将飞书提供的接口地址复制到「HTTP 模块」。
|
||||
|
||||
{{% details title="编排配置" closed="true" %}}
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"nodeId": "userGuide",
|
||||
"name": "core.module.template.App system setting",
|
||||
"intro": "core.app.tip.userGuideTip",
|
||||
"avatar": "/imgs/workflow/userGuide.png",
|
||||
"flowNodeType": "userGuide",
|
||||
"position": {
|
||||
"x": -92.26884681344463,
|
||||
"y": 710.9354029649536
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "welcomeText",
|
||||
"type": "hidden",
|
||||
"valueType": "string",
|
||||
"label": "core.app.Welcome Text",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"value": "",
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "variables",
|
||||
"type": "hidden",
|
||||
"valueType": "any",
|
||||
"label": "core.module.Variable",
|
||||
"value": [],
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "questionGuide",
|
||||
"valueType": "boolean",
|
||||
"type": "switch",
|
||||
"label": "",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"value": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "tts",
|
||||
"type": "hidden",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"value": {
|
||||
"type": "web"
|
||||
},
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"nodeId": "userChatInput",
|
||||
"name": "core.module.template.Chat entrance",
|
||||
"intro": "当用户发送一个内容后,流程将会从这个模块开始执行。",
|
||||
"avatar": "/imgs/workflow/userChatInput.svg",
|
||||
"flowNodeType": "questionInput",
|
||||
"position": {
|
||||
"x": 241.60980819261408,
|
||||
"y": 1330.9528898009685
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"type": "systemInput",
|
||||
"valueType": "string",
|
||||
"label": "core.module.input.label.user question",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"label": "core.module.input.label.user question",
|
||||
"type": "source",
|
||||
"valueType": "string",
|
||||
"targets": [
|
||||
{
|
||||
"nodeId": "n84rvg",
|
||||
"key": "userChatInput"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nodeId": "n84rvg",
|
||||
"name": "工具调用(实验)",
|
||||
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
||||
"avatar": "/imgs/workflow/tool.svg",
|
||||
"flowNodeType": "tools",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 809.4264785615641,
|
||||
"y": 873.3971746859133
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "model",
|
||||
"type": "settingLLMModel",
|
||||
"label": "core.module.input.label.aiModel",
|
||||
"required": true,
|
||||
"valueType": "string",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"llmModelType": "all",
|
||||
"value": "gpt-3.5-turbo",
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "temperature",
|
||||
"type": "hidden",
|
||||
"label": "",
|
||||
"value": 0,
|
||||
"valueType": "number",
|
||||
"min": 0,
|
||||
"max": 10,
|
||||
"step": 1,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "maxToken",
|
||||
"type": "hidden",
|
||||
"label": "",
|
||||
"value": 2000,
|
||||
"valueType": "number",
|
||||
"min": 100,
|
||||
"max": 4000,
|
||||
"step": 50,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "systemPrompt",
|
||||
"type": "textarea",
|
||||
"max": 3000,
|
||||
"valueType": "string",
|
||||
"label": "core.ai.Prompt",
|
||||
"description": "core.app.tip.chatNodeSystemPromptTip",
|
||||
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "history",
|
||||
"type": "numberInput",
|
||||
"label": "core.module.input.label.chat history",
|
||||
"required": true,
|
||||
"min": 0,
|
||||
"max": 30,
|
||||
"valueType": "chatHistory",
|
||||
"value": 6,
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"type": "custom",
|
||||
"label": "",
|
||||
"required": true,
|
||||
"valueType": "string",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"label": "core.module.input.label.user question",
|
||||
"type": "hidden",
|
||||
"valueType": "string",
|
||||
"targets": []
|
||||
},
|
||||
{
|
||||
"key": "selectedTools",
|
||||
"valueType": "tools",
|
||||
"type": "hidden",
|
||||
"targets": [
|
||||
{
|
||||
"nodeId": "3mbu91",
|
||||
"key": "selectedTools"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "",
|
||||
"description": "",
|
||||
"valueType": "boolean",
|
||||
"type": "hidden",
|
||||
"targets": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nodeId": "3mbu91",
|
||||
"name": "HTTP 请求",
|
||||
"intro": "调用飞书webhook,发送一个通知",
|
||||
"avatar": "/imgs/workflow/http.png",
|
||||
"flowNodeType": "httpRequest468",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1483.6437630977423,
|
||||
"y": 798.9716928475544
|
||||
},
|
||||
"inputs": [
|
||||
|
||||
{
|
||||
"key": "system_httpMethod",
|
||||
"type": "custom",
|
||||
"valueType": "string",
|
||||
"label": "",
|
||||
"value": "POST",
|
||||
"required": true,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_httpReqUrl",
|
||||
"type": "hidden",
|
||||
"valueType": "string",
|
||||
"label": "",
|
||||
"description": "core.module.input.description.Http Request Url",
|
||||
"placeholder": "https://api.ai.com/getInventory",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"value": "这里填写你的飞书机器人地址",
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_httpHeader",
|
||||
"type": "custom",
|
||||
"valueType": "any",
|
||||
"value": [],
|
||||
"label": "",
|
||||
"description": "core.module.input.description.Http Request Header",
|
||||
"placeholder": "core.module.input.description.Http Request Header",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_httpParams",
|
||||
"type": "hidden",
|
||||
"valueType": "any",
|
||||
"value": [],
|
||||
"label": "",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_httpJsonBody",
|
||||
"type": "hidden",
|
||||
"valueType": "any",
|
||||
"value": "{\r\n \"msg_type\": \"text\",\r\n \"content\": {\r\n \"text\": \"{{text}}\"\r\n }\r\n}",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "DYNAMIC_INPUT_KEY",
|
||||
"type": "target",
|
||||
"valueType": "any",
|
||||
"label": "core.workflow.inputType.dynamicTargetInput",
|
||||
"description": "core.module.input.description.dynamic input",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": true,
|
||||
"hideInApp": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_addInputParam",
|
||||
"type": "addInputParam",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"description": true,
|
||||
"dataType": true
|
||||
},
|
||||
"defaultEditField": {
|
||||
"label": "",
|
||||
"key": "",
|
||||
"description": "",
|
||||
"inputType": "target",
|
||||
"valueType": "string"
|
||||
},
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"valueType": "string",
|
||||
"type": "hidden",
|
||||
"key": "text",
|
||||
"label": "text",
|
||||
"toolDescription": "需要发送的通知内容",
|
||||
"required": true,
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "httpRawResponse",
|
||||
"label": "原始响应",
|
||||
"description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
|
||||
"valueType": "any",
|
||||
"type": "source",
|
||||
"targets": [
|
||||
{
|
||||
"nodeId": "rzx4mj",
|
||||
"key": "switch"
|
||||
},
|
||||
{
|
||||
"nodeId": "psdhs1",
|
||||
"key": "switch"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "system_addOutputParam",
|
||||
"type": "addOutputParam",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"targets": [],
|
||||
"editField": {
|
||||
"key": true,
|
||||
"description": true,
|
||||
"dataType": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
"defaultEditField": {
|
||||
"label": "",
|
||||
"key": "",
|
||||
"description": "",
|
||||
"outputType": "source",
|
||||
"valueType": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "source",
|
||||
"valueType": "string",
|
||||
"key": "prompt",
|
||||
"label": "prompt",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"edit": true,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"description": true,
|
||||
"dataType": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
"targets": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nodeId": "rzx4mj",
|
||||
"name": "工具调用终止",
|
||||
"intro": "该模块需配置工具调用使用。当该模块被执行时,本次工具调用将会强制结束,并且不再调用AI针对工具调用结果回答问题。",
|
||||
"avatar": "/imgs/workflow/toolStop.svg",
|
||||
"flowNodeType": "stopTool",
|
||||
"position": {
|
||||
"x": 2145.5070710160267,
|
||||
"y": 1306.3581817783079
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "triggerAndFinish",
|
||||
"label": "",
|
||||
"description": "core.module.input.description.Trigger",
|
||||
"valueType": "any",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"nodeId": "psdhs1",
|
||||
"name": "指定回复",
|
||||
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
|
||||
"avatar": "/imgs/workflow/reply.png",
|
||||
"flowNodeType": "answerNode",
|
||||
"position": {
|
||||
"x": 2117.0429459850598,
|
||||
"y": 1658.4125434513746
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "triggerAndFinish",
|
||||
"label": "",
|
||||
"description": "core.module.input.description.Trigger",
|
||||
"valueType": "any",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "text",
|
||||
"type": "textarea",
|
||||
"valueType": "any",
|
||||
"label": "core.module.input.label.Response content",
|
||||
"description": "core.module.input.description.Response content",
|
||||
"placeholder": "core.module.input.description.Response content",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"value": "笑死发送成功啦",
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "",
|
||||
"description": "",
|
||||
"valueType": "boolean",
|
||||
"type": "hidden",
|
||||
"targets": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
{{% /details %}}
|
||||
|
||||
|
||||
## 3. 流程说明
|
||||
|
||||
1. 为工具调用挂载一个HTTP模块,功能描述写上:调用飞书webhook,发送一个通知。
|
||||
2. HTTP模块的输入参数中,填写飞书机器人的地址,填写发送的通知内容。
|
||||
3. HTTP模块输出连接上一个工具终止模块,用于强制结束工具调用。不终止的话,会把调用结果返回给模型,模型会继续回答一次问题,浪费 Tokens
|
||||
4. HTTP模块输出再连上一个指定回复,直接回复一个发送成功,用于替代AI的回答。
|
||||
@@ -19,16 +19,18 @@ FastGPT 商业版是基于 FastGPT 开源版的增强版本,增加了一些独
|
||||
| 应用管理与高级编排 | ✅ | ✅ | ✅ |
|
||||
| 文档知识库 | ✅ | ✅ | ✅ |
|
||||
| 外部使用 | ✅ | ✅ | ✅ |
|
||||
| 最大应用数量 | 500 | 无限制 | 由付费套餐决定 |
|
||||
| 最大知识库数量(单个知识库内容无限制) | 30 | 无限制 | 由付费套餐决定 |
|
||||
| 自定义版权信息 | ❌ | ✅ | 设计中 |
|
||||
| 多租户与支付 | ❌ | ✅ | ✅ |
|
||||
| 团队空间 | ❌ | ✅ | ✅ |
|
||||
| 应用发布安全配置 | ❌ | ✅ | ✅ |
|
||||
| 内容审核 | ❌ | ✅ | ✅ |
|
||||
| web站点同步 | ❌ | ✅ | ✅ |
|
||||
| 管理后台 | ❌ | ✅ | ✅ |
|
||||
| 管理后台 | ❌ | ✅ | 不需要 |
|
||||
| 增强训练模式 | ❌ | ✅ | ✅ |
|
||||
| 第三方应用快速接入(飞书、公众号) | ❌ | ✅ | ✅ |
|
||||
| 图片知识库 | ❌ | 设计中 | 设计中 |
|
||||
| 自动规划召回 | ❌ | 设计中 | 设计中 |
|
||||
| 对话日志运营分析 | ❌ | 设计中 | 设计中 |
|
||||
| 完整商业授权 | ❌ | ✅ | ✅ |
|
||||
{{< /table >}}
|
||||
@@ -60,6 +60,8 @@ Tips: 可以通过点击上下文按键查看完整的上下文组成,便于
|
||||
|
||||
### 引用模板和提示词设计
|
||||
|
||||
简易模式已移除该功能,仅在工作流中可配置,可点击工作流中`AI对话节点`内,知识库引用旁边的`setting icon`进行配置。随着模型的增强,这部分功能将逐步弱化。
|
||||
|
||||
引用模板和引用提示词通常是成对出现,引用提示词依赖引用模板。
|
||||
|
||||
FastGPT 知识库采用 QA 对(不一定都是问答格式,仅代表两个变量)的格式存储,在转义成字符串时候会根据**引用模板**来进行格式化。知识库包含多个可用变量: q, a, sourceId(数据的ID), index(第n个数据), source(数据的集合名、文件名),score(距离得分,0-1) 可以通过 {{q}} {{a}} {{sourceId}} {{index}} {{source}} {{score}} 按需引入。下面一个模板例子:
|
||||
@@ -4,7 +4,7 @@ description: "FastGPT 对话问题引导"
|
||||
icon: "code"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 350
|
||||
weight: 108
|
||||
---
|
||||
|
||||

|
||||
50
docSite/content/zh-cn/docs/course/collection_tags.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "知识库集合标签"
|
||||
description: "FastGPT 知识库集合标签使用说明"
|
||||
icon: "developer_guide"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 109
|
||||
---
|
||||
|
||||
知识库集合标签是 FastGPT 商业版特有功能。它允许你对知识库中的数据集合添加标签进行分类,更高效地管理知识库数据。
|
||||
|
||||
而进一步可以在问答中,搜索知识库时添加集合过滤,实现更精确的搜索。
|
||||
|
||||
| | | |
|
||||
| --------------------- | --------------------- | --------------------- |
|
||||
|  |  |  |
|
||||
|
||||
## 标签基础操作说明
|
||||
|
||||
在知识库详情页面,可以对标签进行管理,可执行的操作有
|
||||
|
||||
- 创建标签
|
||||
- 修改标签名
|
||||
- 删除标签
|
||||
- 将一个标签赋给多个数据集合
|
||||
- 给一个数据集合添加多个标签
|
||||
|
||||
也可以利用标签对数据集合进行筛选
|
||||
|
||||
## 知识库搜索-集合过滤说明
|
||||
|
||||
利用标签可以在知识库搜索时,通过填写「集合过滤」这一栏来实现更精确的搜索,具体的填写示例如下
|
||||
|
||||
```json
|
||||
{
|
||||
"tags": {
|
||||
"$and": ["标签 1","标签 2"],
|
||||
"$or": ["有 $and 标签时,and 生效,or 不生效"]
|
||||
},
|
||||
"createTime": {
|
||||
"$gte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间",
|
||||
"$lte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在填写时有两个注意的点,
|
||||
|
||||
- 标签值可以为 `string` 类型的标签名,也可以为 `null`,而 `null` 代表着未设置标签的数据集合
|
||||
- 标签过滤有 `$and` 和 `$or` 两种条件类型,在同时设置了 `$and` 和 `$or` 的情况下,只有 `$and` 会生效
|
||||
97
docSite/content/zh-cn/docs/course/feishu.md
Normal file
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: "接入飞书机器人教程"
|
||||
description: "FastGPT 接入飞书机器人教程"
|
||||
icon: "chat"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 111
|
||||
---
|
||||
|
||||
从 4.8.10 版本起,FastGPT 商业版支持直接接入飞书机器人,无需额外的 API。
|
||||
|
||||
## 1. 申请飞书应用
|
||||
|
||||
开一个免费的测试企业更方便进行调试。
|
||||
|
||||
1. 在[飞书开放平台](https://open.feishu.cn/app)的开发者后台申请企业自建应用。
|
||||
|
||||

|
||||
|
||||
添加一个**机器人**应用。
|
||||
|
||||
## 2. 在 FastGPT 新建发布渠道
|
||||
|
||||
在fastgpt中选择想要接入的应用,在 发布渠道 页面,新建一个接入飞书机器人的发布渠道,填写好基础信息。
|
||||
|
||||

|
||||
|
||||
## 3. 获取应用的 App ID, App Secret 两个凭证
|
||||
|
||||
在飞书开放平台开发者后台,刚刚创建的企业自建应用中,找到 App ID 和 App Secret,填入 FastGPT 新建发布渠道的对话框里面。
|
||||
|
||||

|
||||
|
||||
填入两个参数到 FastGPT 配置弹窗中。
|
||||
|
||||

|
||||
|
||||
(可选)在飞书开放平台开发者后台,点击事件与回调 -> 加密策略 获取 Encrypt Key,并填入飞书机器人接入的对话框里面
|
||||
|
||||

|
||||
|
||||
Encrypt Key 用于加密飞书服务器与 FastGPT 之间通信。
|
||||
建议如果使用 Https 协议,则不需要 Encrypt Key。如果使用 Http 协议通信,则建议使用 Encrypt Key
|
||||
Verification Token 默认生成的这个 Token 用于校验来源。但我们使用飞书官方推荐的另一种更为安全的校验方式,因此可以忽略这个配置项。
|
||||
## 4. 配置回调地址
|
||||
|
||||
新建好发布渠道后,点击**请求地址**,复制对应的请求地址。
|
||||
|
||||
在飞书控制台,点击左侧的 `事件与回调` ,点击`配置订阅方式`旁边的编辑 icon,粘贴刚刚复制的请求地址到输入框中。
|
||||
|
||||
| | | |
|
||||
| --- | --- | --- |
|
||||
|  |  |  |
|
||||
|
||||
## 5. 配置机器人回调事件和权限
|
||||
|
||||
* 添加 `接收消息` 事件
|
||||
|
||||
在`事件与回调`页面,点击`添加事件`。
|
||||
|
||||
搜索`接收消息`,或者直接搜索 `im.message.receive_v1` ,找到`接收消息 v2.0`的时间,勾选上并点击`确认添加`。
|
||||
|
||||
添加事件后,增加两个权限:点击对应权限,会有弹窗提示添加权限,添加上图两个权限。
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|
||||
不推荐启用上图中的两个“历史版本”,而是使用新版本的权限。
|
||||
- 若开启 “读取用户发给机器人的单聊消息”, 则单聊发送给机器人的消息将被送到 FastGPT
|
||||
- 若开启 “接收群聊中@机器人消息事件”, 则群聊中@机器人的消息将被送到 FastGPT
|
||||
- 若开启(不推荐开启)“获取群组中所有消息”,则群聊中所有消息都将被送到 FastGPT
|
||||
|
||||
## 6. 配置回复消息权限
|
||||
|
||||
在飞书控制台,点击左侧的 `权限管理` ,搜索框中输入`发消息`,找到`以应用的身份发消息`的权限,点击开通权限。
|
||||
|
||||

|
||||
|
||||
## 7. 发布机器人
|
||||
|
||||
点击飞书控制台左侧的`版本管理与发布`,即可发布机器人。
|
||||
|
||||

|
||||
|
||||
然后就可以在工作台里找到你的机器人啦。接下来就是把机器人拉进群组,或者单独与它对话。
|
||||
|
||||

|
||||
|
||||
## FAQ
|
||||
|
||||
### 发送了消息,没响应
|
||||
|
||||
1. 检查飞书机器人回调地址、权限等是否正确。
|
||||
2. 查看 FastGPT 对话日志,是否有对应的提问记录
|
||||
3. 如果有记录,飞书没回应,则是没给机器人开权限。
|
||||
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。(飞书机器人无法输入全局变量、文件、图片内容)
|
||||
132
docSite/content/zh-cn/docs/course/fileInput.md
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: '文件输入功能介绍'
|
||||
description: 'FastGPT 文件输入功能介绍'
|
||||
icon: 'description'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 110
|
||||
---
|
||||
|
||||
从 4.8.9 版本起,FastGPT 支持在`简易模式`和`工作流`中,配置用户上传文件、图片功能。下面先简单介绍下如何使用文件输入功能,最后是介绍下文件解析的工作原理。
|
||||
|
||||
|
||||
## 简易模式中使用
|
||||
|
||||
简易模式打开文件上传后,会使用工具调用模式,也就是由模型自行决策,是否需要读取文件内容。
|
||||
|
||||
可以找到左侧文件上传的配置项,点击其右侧的`开启`/`关闭`按键,即可打开配置弹窗。
|
||||
|
||||

|
||||
|
||||
随后,你的调试对话框中,就会出现一个文件选择的 icon,可以点击文件选择 icon,选择你需要上传的文件。
|
||||
|
||||
由于采用的是工具调用模式,所以在提问时候,可能需要加上适当的引导,让模型知道,你需要读取`文档`。
|
||||
|
||||

|
||||
|
||||
## 工作流中使用
|
||||
|
||||
工作流中,可以在系统配置中,找到`文件输入`配置项,点击其右侧的`开启`/`关闭`按键,即可打开配置弹窗。
|
||||
|
||||

|
||||
|
||||
在工作流中,使用文件的方式很多,最简单的就是类似下图中,直接通过工具调用接入文档解析,实现和简易模式一样的效果。
|
||||
|
||||

|
||||
|
||||
也可以更简单点,强制每轮对话都携带上文档内容进行回答,这样就不需要调用两次 AI 才能读取文档内容了。
|
||||
|
||||

|
||||
|
||||
当然,你也可以在工作流中,对文档进行内容提取、内容分析等,然后将分析的结果传递给 HTTP 或者其他模块,从而实现文件处理的 SOP。不过目前版本,`插件`中并未支持文件处理,所以在构建 SOP 的话可能还是有一些麻烦。
|
||||
|
||||
|
||||
## 文档解析工作原理
|
||||
|
||||
不同于图片识别,LLM 模型目前没有支持直接解析文档的能力,所有的文档“理解”都是通过文档转文字后拼接 prompt 实现。这里通过几个 FAQ 来解释文档解析的工作原理,理解文档解析的原理,可以更好的在工作流中使用文档解析功能。
|
||||
|
||||
### 上传的文件如何存储在数据库中
|
||||
|
||||
FastGPT 的对话记录存储结构中,role=user 的消息,value 值会按以下结构存储:
|
||||
|
||||
```ts
|
||||
type UserChatItemValueItemType = {
|
||||
type: 'text' | 'file'
|
||||
text?: {
|
||||
content: string;
|
||||
};
|
||||
file?: {
|
||||
type: 'img' | 'doc'
|
||||
name?: string;
|
||||
url: string;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
也就是说,上传的图片和文档,都会以 URL 的形式存储在库中,并不会存储`解析后的文档内容`。
|
||||
|
||||
### 图片如何处理
|
||||
|
||||
文档解析节点不会处理图片,图片链接会被过滤,图片识别请直接使用支持图片识别的 LLM 模型。
|
||||
|
||||
### 文档解析节点如何工作
|
||||
|
||||
文档解析依赖文档解析节点,这个节点会接收一个`array<string>`类型的输入,对应的是文件输入的 URL;输出的是一个`string`,对应的是文档解析后的内容。
|
||||
|
||||

|
||||
|
||||
* 在文档解析节点中,只会解析`文档`类型的 URL,它是通过文件 URL 解析出来的`文名件后缀`去判断的。如果你同时选择了文档和图片,图片会被忽略。
|
||||
* 文档解析节点,除了解析本轮工作流接收的文件外,还会把历史记录中的文档 URL 进行解析。最终会解析至多 n 个文档,n 取决于你配置文件上传时,允许的最大文件数量。
|
||||
|
||||
{{% alert icon="🤖" context="success" %}}
|
||||
举例:
|
||||
|
||||
配置了最多允许 5 个文件上传
|
||||
|
||||
1. 第一轮对话,上传 3 个文档和 1 个图片:文档解析节点,返回 3 个文档内容。
|
||||
2. 第二轮对话,不上传任何文件:文档解析节点,返回 3 个文档内容。
|
||||
3. 第三轮对话,上传 2 个文档:文档解析节点,返回 5 个文档内容。
|
||||
4. 第四轮对话,上传 1 个文档:文档解析节点,返回 5 个文档内容,第一轮对话中的第三个文档会被过滤掉。
|
||||
|
||||
{{% /alert %}}
|
||||
|
||||
* 多个文档内容如何拼接的
|
||||
|
||||
按下列的模板,对多个文件进行拼接,即文件名+文件内容的形式组成一个字符串,不同文档之间通过分隔符:`\n******\n` 进行分割。
|
||||
|
||||
```
|
||||
File: ${filename}
|
||||
<Content>
|
||||
${content}
|
||||
</Content>
|
||||
```
|
||||
|
||||
### 工具调用如何使用文档解析
|
||||
|
||||
在工具调用中,文档解析节点的调用提示词为:`解析对话中所有上传的文档,并返回对应文档内容`。
|
||||
|
||||
作为工具被执行后,文档解析节点会返回解析后的文档内容作为工具响应。
|
||||
|
||||
### AI对话中如何使用文档解析
|
||||
|
||||
在 AI 对话节点中,新增了一个文档引用的输入,可以直接引用文档解析节点的输出,从而实现文档内容的引用。
|
||||
|
||||
它接收一个`string`类型的输入,除了可以引用文档解析结果外,还可以实现自定义内容引用,最终会进行提示词拼接,放置在 role=system 的消息中。提示词模板如下:
|
||||
|
||||
```
|
||||
将 <Quote></Quote> 中的内容作为你的知识:
|
||||
<Quote>
|
||||
{{quote}}
|
||||
</Quote>
|
||||
```
|
||||
|
||||
quote 为引用的内容。
|
||||
|
||||

|
||||
|
||||
## 文件输入后续更新
|
||||
|
||||
* 插件支持配置文件输入。
|
||||
* 子应用和插件调用,支持传递文件输入。
|
||||
* 文档解析,结构化解析结果。
|
||||
* 更多的文件类型输入以及解析器。
|
||||
106
docSite/content/zh-cn/docs/course/official_account.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: '接入微信公众号教程'
|
||||
description: 'FastGPT 接入微信公众号教程'
|
||||
icon: 'description'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 113
|
||||
---
|
||||
|
||||
从 4.8.10 版本起,FastGPT 商业版支持直接接入微信公众号,无需额外的 API。
|
||||
|
||||
**注意⚠️: 目前只支持通过验证的公众号(服务号和订阅号都可以)**
|
||||
|
||||
## 1. 在 FastGPT 新建发布渠道
|
||||
|
||||
在 FastGPT 中选择想要接入的应用,在 *发布渠道* 页面,新建一个接入微信公众号的发布渠道,填写好基础信息。
|
||||
|
||||

|
||||
|
||||
## 2. 登录微信公众平台,获取 AppID 、 Secret和Token
|
||||
|
||||
### 1. https://mp.weixin.qq.com 登录微信公众平台,选择您的公众号。
|
||||
|
||||
**只支持通过验证的公众号,未通过验证的公众号暂不支持。**
|
||||
|
||||
开发者可以从这个链接申请微信公众号的测试号进行测试,测试号可以正常使用,但不能配置 AES Key
|
||||
|
||||

|
||||
|
||||
### 2. 把3个参数填入 FastGPT 配置弹窗中。
|
||||

|
||||
|
||||
## 3. 在 IP 白名单中加入 FastGPT 的 IP
|
||||
|
||||

|
||||
|
||||
私有部署的用户可自行查阅自己的 IP 地址。
|
||||
|
||||
海外版用户(fastgpt.in)可以填写下面的 IP 白名单:
|
||||
|
||||
```
|
||||
34.87.20.17
|
||||
35.247.161.35
|
||||
34.87.51.146
|
||||
34.87.110.152
|
||||
35.247.163.68
|
||||
34.126.163.205
|
||||
34.87.20.189
|
||||
34.87.102.86
|
||||
35.240.227.100
|
||||
35.198.192.104
|
||||
34.143.149.171
|
||||
34.87.152.33
|
||||
34.124.237.188
|
||||
35.197.149.75
|
||||
34.87.44.74
|
||||
34.124.189.116
|
||||
34.87.79.202
|
||||
34.87.173.252
|
||||
34.143.240.160
|
||||
34.87.180.104
|
||||
34.142.157.52
|
||||
```
|
||||
|
||||
国内版用户(fastgpt.cn)可以填写下面的 IP 白名单:
|
||||
|
||||
```
|
||||
47.97.59.172
|
||||
121.43.108.48
|
||||
121.41.75.88
|
||||
121.41.178.7
|
||||
121.40.65.187
|
||||
121.196.235.183
|
||||
120.55.195.90
|
||||
120.55.193.112
|
||||
120.26.229.115
|
||||
112.124.41.79
|
||||
101.37.205.32
|
||||
47.98.190.173
|
||||
```
|
||||
|
||||
## 4. 获取AES Key,选择加密方式
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
1. 随机生成AESKey,填入 FastGPT 配置弹窗中。
|
||||
|
||||
2. 选择加密方式为安全模式。
|
||||
|
||||
## 5. 获取 URL
|
||||
|
||||
1. 在FastGPT确认创建,获取URL。
|
||||
|
||||

|
||||
|
||||
2. 填入微信公众平台的 URL 处,然后提交保存
|
||||

|
||||
|
||||
## 6. 启用服务器配置(如已自动启用,请忽略)
|
||||

|
||||
|
||||
## 7. 开始使用
|
||||
|
||||
现在用户向公众号发消息,消息则会被转发到 FastGPT,通过公众号返回对话结果。
|
||||
@@ -1,13 +1,15 @@
|
||||
---
|
||||
title: "对接第三方 GPT 应用"
|
||||
description: "通过与 OpenAI 兼容的 API 对接第三方应用"
|
||||
title: "通过 API 访问应用"
|
||||
description: "通过 API 访问 FastGPT 应用"
|
||||
icon: "model_training"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 505
|
||||
weight: 112
|
||||
---
|
||||
|
||||
## 获取 API 秘钥
|
||||
在 FastGPT 中,你可以为每一个应用创建多个 API 密钥,用于访问应用的 API 接口。每个密钥仅能访问一个应用。完整的接口可以[查看应用对话接口](/docs/development/openapi/chat)。
|
||||
|
||||
## 获取 API 密钥
|
||||
|
||||
依次选择应用 -> 「API访问」,然后点击「API 密钥」来创建密钥。
|
||||
|
||||
@@ -15,7 +17,7 @@ weight: 505
|
||||
密钥需要自己保管好,一旦关闭就无法再复制密钥,只能创建新密钥再复制。
|
||||
{{% /alert %}}
|
||||
|
||||

|
||||

|
||||
|
||||
{{% alert icon="🍅" context="success" %}}
|
||||
Tips: 安全起见,你可以设置一个额度或者过期时间,放置 key 被滥用。
|
||||
@@ -26,7 +28,7 @@ Tips: 安全起见,你可以设置一个额度或者过期时间,放置 key
|
||||
|
||||
```bash
|
||||
OPENAI_API_BASE_URL: https://api.fastgpt.in/api (改成自己部署的域名)
|
||||
OPENAI_API_KEY = 上一步获取到的秘钥
|
||||
OPENAI_API_KEY = 上一步获取到的密钥
|
||||
```
|
||||
|
||||
**[ChatGPT Next Web](https://github.com/Yidadaa/ChatGPT-Next-Web) 示例:**
|
||||
@@ -11,7 +11,7 @@ weight: 708
|
||||
|
||||
**开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。
|
||||
|
||||
这个配置文件中包含了系统参数和各个模型配置,`使用时务必去掉注释!!!!!!!!!!!!!!`
|
||||
这个配置文件中包含了系统参数和各个模型配置:
|
||||
|
||||
## 4.6.8+ 版本新配置文件
|
||||
|
||||
@@ -148,6 +148,9 @@ llm模型全部合并
|
||||
- /imgs/model/openai.svg - OpenAI GPT
|
||||
- /imgs/model/qwen.svg - 通义千问
|
||||
- /imgs/model/yi.svg - 零一万物
|
||||
- /imgs/model/gemini.svg - gemini
|
||||
- /imgs/model/deepseek.svg - deepseek
|
||||
- /imgs/model/minimax.svg - minimax
|
||||
-
|
||||
|
||||
## 特殊模型
|
||||
@@ -158,7 +161,7 @@ llm模型全部合并
|
||||
|
||||
1. [部署 ReRank 模型](/docs/development/custom-models/bge-rerank/)
|
||||
1. 找到 FastGPT 的配置文件中的 `reRankModels`, 4.6.6 以前是 `ReRankModels`。
|
||||
2. 修改对应的值:(记得去掉注释)
|
||||
2. 修改对应的值:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -14,9 +14,9 @@ weight: 920
|
||||
{{< table "table-hover table-striped-columns" >}}
|
||||
| 模型名 | 内存 | 显存 | 硬盘空间 | 启动命令 |
|
||||
|------|---------|---------|----------|--------------------------|
|
||||
| bge-rerank-base | >=4GB | >=4GB | >=8GB | python app.py |
|
||||
| bge-rerank-large | >=8GB | >=8GB | >=8GB | python app.py |
|
||||
| bge-rerank-v2-m3 | >=8GB | >=8GB | >=8GB | python app.py |
|
||||
| bge-reranker-base | >=4GB | >=4GB | >=8GB | python app.py |
|
||||
| bge-reranker-large | >=8GB | >=8GB | >=8GB | python app.py |
|
||||
| bge-reranker-v2-m3 | >=8GB | >=8GB | >=8GB | python app.py |
|
||||
{{< /table >}}
|
||||
|
||||
## 源码部署
|
||||
@@ -33,7 +33,7 @@ weight: 920
|
||||
|
||||
1. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-base](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-base)
|
||||
2. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-large](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-large)
|
||||
3. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-rerank-v2-m3](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-rerank-v2-m3)
|
||||
3. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-v2-m3](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-v2-m3)
|
||||
|
||||
### 3. 安装依赖
|
||||
|
||||
@@ -47,7 +47,7 @@ pip install -r requirements.txt
|
||||
|
||||
1. [https://huggingface.co/BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base)
|
||||
2. [https://huggingface.co/BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large)
|
||||
3. [https://huggingface.co/BAAI/bge-rerank-v2-m3](https://huggingface.co/BAAI/bge-rerank-v2-m3)
|
||||
3. [https://huggingface.co/BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3)
|
||||
|
||||
在对应代码目录下 clone 模型。目录结构:
|
||||
|
||||
@@ -119,3 +119,19 @@ services:
|
||||
## 接入 FastGPT
|
||||
|
||||
参考 [ReRank模型接入](/docs/development/configuration/#rerank-接入),host 变量为部署的域名。
|
||||
|
||||
## QA
|
||||
|
||||
### Docker 运行提示 `Bus error (core dumped)`
|
||||
|
||||
尝试增加 `docker-compose.yml` 配置项 `shm_size` ,以增加容器中的共享内存目录大小。
|
||||
|
||||
```
|
||||
...
|
||||
services:
|
||||
reranker:
|
||||
...
|
||||
container_name: reranker
|
||||
shm_size: '2gb'
|
||||
...
|
||||
```
|
||||
@@ -124,53 +124,36 @@ curl --location --request POST 'https://<oneapi_url>/v1/chat/completions' \
|
||||
|
||||
## 将本地模型接入 FastGPT
|
||||
|
||||
修改 FastGPT 的 `config.json` 配置文件,其中 chatModels(对话模型)用于聊天对话,cqModels(问题分类模型)用来对问题进行分类,extractModels(内容提取模型)则用来进行工具选择。我们分别在 chatModels、cqModels 和 extractModels 中加入 qwen-chat 模型:
|
||||
修改 FastGPT 的 `config.json` 配置文件的 llmModels 部分加入 qwen-chat 模型:
|
||||
|
||||
```json
|
||||
{
|
||||
"chatModels": [
|
||||
...
|
||||
{
|
||||
"model": "qwen-chat",
|
||||
"name": "Qwen",
|
||||
"maxContext": 2048,
|
||||
"maxResponse": 2048,
|
||||
"quoteMaxToken": 2000,
|
||||
"maxTemperature": 1,
|
||||
"vision": false,
|
||||
"defaultSystemChatPrompt": ""
|
||||
}
|
||||
...
|
||||
...
|
||||
"llmModels": [
|
||||
{
|
||||
"model": "qwen-chat", // 模型名(对应OneAPI中渠道的模型名)
|
||||
"name": "Qwen", // 模型别名
|
||||
"avatar": "/imgs/model/Qwen.svg", // 模型的logo
|
||||
"maxContext": 125000, // 最大上下文
|
||||
"maxResponse": 4000, // 最大回复
|
||||
"quoteMaxToken": 120000, // 最大引用内容
|
||||
"maxTemperature": 1.2, // 最大温度
|
||||
"charsPointsPrice": 0, // n积分/1k token(商业版)
|
||||
"censor": false, // 是否开启敏感校验(商业版)
|
||||
"vision": true, // 是否支持图片输入
|
||||
"datasetProcess": true, // 是否设置为知识库处理模型(QA),务必保证至少有一个为true,否则知识库会报错
|
||||
"usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true)
|
||||
"usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true)
|
||||
"usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true)
|
||||
"usedInQueryExtension": true, // 是否用于问题优化(务必保证至少有一个为true)
|
||||
"toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。目前只有gpt支持)
|
||||
"functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式)
|
||||
"customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型
|
||||
"customExtractPrompt": "", // 自定义内容提取提示词
|
||||
"defaultSystemChatPrompt": "", // 对话默认携带的系统提示词
|
||||
"defaultConfig": {} // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p)
|
||||
}
|
||||
],
|
||||
"cqModels": [
|
||||
...
|
||||
{
|
||||
"model": "qwen-chat",
|
||||
"name": "Qwen",
|
||||
"maxContext": 2048,
|
||||
"maxResponse": 2048,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"toolChoice": true,
|
||||
"functionPrompt": ""
|
||||
}
|
||||
...
|
||||
],
|
||||
"extractModels": [
|
||||
...
|
||||
{
|
||||
"model": "qwen-chat",
|
||||
"name": "Qwen",
|
||||
"maxContext": 2048,
|
||||
"maxResponse": 2048,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"toolChoice": true,
|
||||
"functionPrompt": ""
|
||||
}
|
||||
...
|
||||
]
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
然后重启 FastGPT 就可以在应用配置中选择 Qwen 模型进行对话:
|
||||