Compare commits
105 Commits
v4.7.1-fix
...
v4.8.4-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c11131d653 | ||
|
|
f7f4a8de4d | ||
|
|
6385794603 | ||
|
|
b8b26ad700 | ||
|
|
05611df056 | ||
|
|
d0085a23e6 | ||
|
|
bc6864c3dc | ||
|
|
b20d075d35 | ||
|
|
19c8a06d51 | ||
|
|
fcb915c988 | ||
|
|
9bffb9ffc0 | ||
|
|
c1d7c08c7a | ||
|
|
a5d590e0bd | ||
|
|
db544afa7c | ||
|
|
a259d034b8 | ||
|
|
9fc6a8c74a | ||
|
|
5c8f2f95f7 | ||
|
|
f1e16b209a | ||
|
|
ced23e1695 | ||
|
|
1db816150b | ||
|
|
1e48922bc9 | ||
|
|
8ba8488086 | ||
|
|
9639139b52 | ||
|
|
d9f5f4ede0 | ||
|
|
6609cb98dc | ||
|
|
74830f0ac8 | ||
|
|
9c7c74050b | ||
|
|
92a3d6d268 | ||
|
|
c4ce1236ea | ||
|
|
4eb2c9bd07 | ||
|
|
b1aafde7c9 | ||
|
|
87e4afe89b | ||
|
|
a14a8ae627 | ||
|
|
fb368a581c | ||
|
|
8e8ceb7439 | ||
|
|
e35ce2caa0 | ||
|
|
fd31a0b763 | ||
|
|
ba517b6a73 | ||
|
|
2f93dedfb6 | ||
|
|
67c52992d7 | ||
|
|
2d1ec9b3ad | ||
|
|
6067f5aff3 | ||
|
|
c6d9b15897 | ||
|
|
d5073f98ab | ||
|
|
8386f707cd | ||
|
|
cd876251b7 | ||
|
|
fb04889a31 | ||
|
|
b779e2806d | ||
|
|
240f60c0ca | ||
|
|
8d2230f24f | ||
|
|
610ebded3b | ||
|
|
80a84a5733 | ||
|
|
59fd94384d | ||
|
|
ee8cb0915e | ||
|
|
8cf643d972 | ||
|
|
26f4c92124 | ||
|
|
f351d4ea68 | ||
|
|
d70efe1d6f | ||
|
|
435b2fba25 | ||
|
|
d61de17df2 | ||
|
|
08a310c41f | ||
|
|
50716ff782 | ||
|
|
5e250b2f65 | ||
|
|
434af56abd | ||
|
|
6463427d93 | ||
|
|
af4c732d93 | ||
|
|
d4169bf066 | ||
|
|
afe5039cd3 | ||
|
|
2155489be3 | ||
|
|
eb36b71ac3 | ||
|
|
2230bc40c5 | ||
|
|
917e4e9262 | ||
|
|
3c6e5a6e00 | ||
|
|
7b75a99ba2 | ||
|
|
2e468fc8ca | ||
|
|
caa0755d9a | ||
|
|
fef1a1702b | ||
|
|
2a99e46353 | ||
|
|
8f9203c053 | ||
|
|
2053bbdb1b | ||
|
|
9e192c6d11 | ||
|
|
eef609a063 | ||
|
|
5bb9c550f6 | ||
|
|
db1c27cdc7 | ||
|
|
8863337606 | ||
|
|
59bd2a47b6 | ||
|
|
d057ba29f0 | ||
|
|
b500631a4d | ||
|
|
bf6084da69 | ||
|
|
b5f0ac3e1d | ||
|
|
1529c1e991 | ||
|
|
db6fc53840 | ||
|
|
a0c1320d47 | ||
|
|
5ca4049757 | ||
|
|
59ece446a2 | ||
|
|
d407e87dd9 | ||
|
|
c8412e7dc9 | ||
|
|
f6247fe11d | ||
|
|
613699fe59 | ||
|
|
c56c28be23 | ||
|
|
89ab17ea2e | ||
|
|
c608f86146 | ||
|
|
0a8b104bd7 | ||
|
|
439c819ff1 | ||
|
|
b08d81f887 |
2
.github/ISSUE_TEMPLATE/bugs.md
vendored
@@ -21,7 +21,7 @@ assignees: ''
|
||||
- [ ] 公有云版本
|
||||
- [ ] 私有部署版本, 具体版本号:
|
||||
|
||||
**问题描述**
|
||||
**问题描述, 日志截图**
|
||||
|
||||
**复现步骤**
|
||||
|
||||
|
||||
108
.github/workflows/build-sandbox-image.yml
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
name: Build fastgpt-sandbox images and copy image to docker hub
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'projects/sandbox/**'
|
||||
tags:
|
||||
- 'v*'
|
||||
jobs:
|
||||
build-fastgpt-sandbox-images:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt update && sudo apt install -y nodejs npm
|
||||
- name: Set up QEMU (optional)
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
driver-opts: network=host
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
- 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
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Build and publish image for main branch or tag push event
|
||||
env:
|
||||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
-f projects/sandbox/Dockerfile \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/fastgpt-sandbox" \
|
||||
--label "org.opencontainers.image.description=fastgpt-sandbox image" \
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${DOCKER_REPO_TAGGED} \
|
||||
.
|
||||
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}}
|
||||
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
|
||||
|
||||
13
.github/workflows/fastgpt-image.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
- 'projects/app/**'
|
||||
- 'packages/**'
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
- 'v*'
|
||||
jobs:
|
||||
build-fastgpt-images:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--build-arg name=app \
|
||||
-f projects/app/Dockerfile \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
|
||||
--label "org.opencontainers.image.description=fastgpt image" \
|
||||
@@ -57,7 +57,6 @@ jobs:
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${DOCKER_REPO_TAGGED} \
|
||||
-f Dockerfile \
|
||||
.
|
||||
push-to-docker-hub:
|
||||
needs: build-fastgpt-images
|
||||
@@ -81,9 +80,9 @@ jobs:
|
||||
- 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 }}:${{env.IMAGE_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 }}:${{env.IMAGE_TAG}}
|
||||
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
push-to-ali-hub:
|
||||
needs: build-fastgpt-images
|
||||
if: github.repository == 'labring/FastGPT'
|
||||
@@ -107,6 +106,6 @@ jobs:
|
||||
- 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 }}:${{env.IMAGE_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 }}:${{env.IMAGE_TAG}}
|
||||
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
|
||||
|
||||
9
.github/workflows/preview-image.yml
vendored
@@ -4,8 +4,6 @@ on:
|
||||
paths:
|
||||
- 'projects/app/**'
|
||||
- 'packages/**'
|
||||
branches:
|
||||
- 'main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -44,15 +42,14 @@ jobs:
|
||||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--build-arg name=app \
|
||||
--label "org.opencontainers.image.source= https://github.com/ ${{ github.repository_owner }}/FastGPT" \
|
||||
--label "org.opencontainers.image.description=fastgpt-pr image" \
|
||||
-f projects/app/Dockerfile \
|
||||
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
|
||||
--label "org.opencontainers.image.description=fastgpt-pr imae" \
|
||||
--label "org.opencontainers.image.licenses=Apache" \
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${DOCKER_REPO_TAGGED} \
|
||||
-f Dockerfile \
|
||||
.
|
||||
|
||||
helm-check:
|
||||
|
||||
2
.npmrc
Normal file
@@ -0,0 +1,2 @@
|
||||
public-hoist-pattern[]=*tiktoken*
|
||||
public-hoist-pattern[]=*@zilliz/milvus2-sdk-node*
|
||||
46
.vscode/i18n-ally-custom-framework.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# .vscode/i18n-ally-custom-framework.yml
|
||||
|
||||
# An array of strings which contain Language Ids defined by VS Code
|
||||
# You can check available language ids here: https://code.visualstudio.com/docs/languages/identifiers
|
||||
languageIds:
|
||||
- javascript
|
||||
- typescript
|
||||
- javascriptreact
|
||||
- typescriptreact
|
||||
|
||||
# An array of RegExes to find the key usage. **The key should be captured in the first match group**.
|
||||
# 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
|
||||
usageMatchRegex:
|
||||
# The following example shows how to detect `t("your.i18n.keys")`
|
||||
# the `{key}` will be placed by a proper keypath matching regex,
|
||||
# you can ignore it and use your own matching rules as well
|
||||
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]commonT\\(['\"`]({key})['\"`]"
|
||||
# 支持 appT("your.i18n.keys")
|
||||
- "[^\\w\\d]appT\\(['\"`]({key})['\"`]"
|
||||
# 支持 datasetT("your.i18n.keys")
|
||||
- "[^\\w\\d]datasetT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]fileT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]publishT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]userT\\(['\"`]({key})['\"`]"
|
||||
- "[^\\w\\d]chatT\\(['\"`]({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*['\"`](.*?)['\"`]"
|
||||
|
||||
# An array of strings containing refactor templates.
|
||||
# The "$1" will be replaced by the keypath specified.
|
||||
# Optional: uncomment the following two lines to use
|
||||
|
||||
# refactorTemplates:
|
||||
# - i18n.get("$1")
|
||||
|
||||
|
||||
# If set to true, only enables this custom framework (will disable all built-in frameworks)
|
||||
monopoly: true
|
||||
54
.vscode/nextapi.code-snippets
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
// Place your FastGPT 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
|
||||
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
|
||||
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
|
||||
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
||||
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
|
||||
// Placeholders with the same ids are connected.
|
||||
// Example:
|
||||
"Next api template": {
|
||||
"scope": "javascript,typescript",
|
||||
"prefix": "nextapi",
|
||||
"body": [
|
||||
"import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';",
|
||||
"import { NextAPI } from '@/service/middleware/entry';",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Query = {};",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Body = {};",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Response = {};",
|
||||
"",
|
||||
"async function handler(",
|
||||
" req: ApiRequestProps<${TM_FILENAME_BASE}Body, ${TM_FILENAME_BASE}Query>,",
|
||||
" res: ApiResponseType<any>",
|
||||
"): Promise<${TM_FILENAME_BASE}Response> {",
|
||||
" $1",
|
||||
" return {}",
|
||||
"}",
|
||||
"",
|
||||
"export default NextAPI(handler);"
|
||||
],
|
||||
"description": "FastGPT Next API template"
|
||||
},
|
||||
"use context template": {
|
||||
"scope": "typescriptreact",
|
||||
"prefix": "context",
|
||||
"body": [
|
||||
"import React, { ReactNode } from 'react';",
|
||||
"import { createContext } from 'use-context-selector';",
|
||||
"",
|
||||
"type ContextType = {$1};",
|
||||
"",
|
||||
"export const Context = createContext<ContextType>({});",
|
||||
"",
|
||||
"const ContextProvider = ({ children }: { children: ReactNode }) => {",
|
||||
" const contextValue: ContextType = {};",
|
||||
" return <Context.Provider value={contextValue}>{children}</Context.Provider>;",
|
||||
"};",
|
||||
"",
|
||||
"export default ContextProvider"
|
||||
],
|
||||
"description": "FastGPT usecontext template"
|
||||
}
|
||||
}
|
||||
7
.vscode/settings.json
vendored
@@ -4,12 +4,13 @@
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"prettier.prettierPath": "",
|
||||
"i18n-ally.localesPaths": [
|
||||
"projects/app/public/locales",
|
||||
"projects/app/i18n",
|
||||
],
|
||||
"i18n-ally.enabledParsers": ["json"],
|
||||
"i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"i18n-ally.sortKeys": true,
|
||||
"i18n-ally.keepFulfilled": true,
|
||||
"i18n-ally.keepFulfilled": false,
|
||||
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
|
||||
"i18n-ally.displayLanguage": "zh", // 显示语言
|
||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key"
|
||||
}
|
||||
25
Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
# 定义默认变量
|
||||
proxy=null
|
||||
image=null
|
||||
|
||||
# 定义目标
|
||||
.PHONY: build
|
||||
|
||||
# 检查 target 是否定义
|
||||
ifndef name
|
||||
$(error name is not defined)
|
||||
endif
|
||||
|
||||
filePath=./projects/$(name)/Dockerfile
|
||||
|
||||
dev:
|
||||
pnpm --prefix ./projects/$(name) dev
|
||||
|
||||
build:
|
||||
ifeq ($(proxy), taobao)
|
||||
docker build -f $(filePath) -t $(image) . --build-arg proxy=taobao
|
||||
else ifeq ($(proxy), clash)
|
||||
docker build -f $(filePath) -t $(image) . --network host --build-arg HTTP_PROXY=http://127.0.0.1:7890 --build-arg HTTPS_PROXY=http://127.0.0.1:7890
|
||||
else
|
||||
docker build -f $(filePath) -t $(image) .
|
||||
endif
|
||||
18
README.md
@@ -52,11 +52,10 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
`1` 应用编排能力
|
||||
- [x] 提供简易模式,无需操作编排
|
||||
- [x] 工作流编排
|
||||
- [x] 源文件引用追踪
|
||||
- [x] 模块封装,实现多级复用
|
||||
- [x] Tool 模块
|
||||
- [ ] 嵌入 [Laf](https://github.com/labring/laf),实现在线编写 HTTP 模块。初版已完成。
|
||||
- [ ] 插件封装功能,支持低代码渲染
|
||||
- [x] 工具调用
|
||||
- [x] 插件 - 工作流封装能力
|
||||
- [x] Code sandbox
|
||||
- [ ] 循环调用
|
||||
|
||||
`2` 知识库能力
|
||||
- [x] 多库复用,混用
|
||||
@@ -66,15 +65,14 @@ 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] 知识库单点搜索测试
|
||||
- [x] 对话时反馈引用并可修改与删除
|
||||
- [x] 完整上下文呈现
|
||||
- [x] 完整模块中间值呈现
|
||||
- [ ] 高级编排 DeBug 模式
|
||||
- [x] 高级编排 DeBug 模式
|
||||
|
||||
`4` OpenAPI 接口
|
||||
- [x] completions 接口 (chat 模式对齐 GPT 接口)
|
||||
@@ -89,6 +87,8 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
`6` 其他
|
||||
- [x] 支持语音输入和输出 (可配置语音输入语音回答)
|
||||
- [x] 模糊输入提示
|
||||
- [ ] 模板市场
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -122,7 +122,7 @@ 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">
|
||||
|
||||
25
README_en.md
@@ -10,28 +10,31 @@
|
||||
<a href="./README_ja.md">日语</a>
|
||||
</p>
|
||||
|
||||
FastGPT is a knowledge-based Q&A system built on the LLM, offers out-of-the-box data processing and model invocation capabilities, allows for workflow orchestration through Flow visualization!
|
||||
FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
|
||||
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://fastgpt.in/">
|
||||
<img height="21" src="https://img.shields.io/badge/在线使用-d4eaf7?style=flat-square&logo=spoj&logoColor=7d09f1" alt="cloud">
|
||||
<img height="21" src="https://img.shields.io/badge/Try it Online-d4eaf7?style=flat-square&logo=spoj&logoColor=7d09f1" alt="cloud">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/intro">
|
||||
<img height="21" src="https://img.shields.io/badge/相关文档-7d09f1?style=flat-square" alt="document">
|
||||
<img height="21" src="https://img.shields.io/badge/Documents-7d09f1?style=flat-square" alt="document">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/development">
|
||||
<img height="21" src="https://img.shields.io/badge/本地开发-%23d4eaf7?style=flat-square&logo=xcode&logoColor=7d09f1" alt="development">
|
||||
</a>
|
||||
<a href="/#-%E7%9B%B8%E5%85%B3%E9%A1%B9%E7%9B%AE">
|
||||
<img height="21" src="https://img.shields.io/badge/相关项目-7d09f1?style=flat-square" alt="project">
|
||||
<img height="21" src="https://img.shields.io/badge/Local Development-%23d4eaf7?style=flat-square&logo=xcode&logoColor=7d09f1" alt="development">
|
||||
</a>
|
||||
<a href="https://github.com/labring/FastGPT/blob/main/LICENSE">
|
||||
<img height="21" src="https://img.shields.io/badge/License-Apache--2.0-ffffff?style=flat-square&labelColor=d4eaf7&color=7d09f1" alt="license">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://discord.gg/mp68xkZn2Q)
|
||||
|
||||
</div>
|
||||
|
||||
https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409bd33f6d4
|
||||
|
||||
## 🛸 Use Cloud Services
|
||||
@@ -117,11 +120,11 @@ Project tech stack: NextJs + TS + ChakraUI + Mongo + Postgres (Vector plugin)
|
||||
- [Version Updates & Upgrades](https://doc.fastgpt.in/docs/installation/upgrading)
|
||||
|
||||
|
||||
## 🏘️ Community
|
||||
## 🏘️ Community & support
|
||||
|
||||
| Community Group |
|
||||
| ------------------------------------------------- |
|
||||
|  |
|
||||
+ 🌐 Visit the [FastGPT website](https://fastgpt.in/) for full documentation and useful links.
|
||||
+ 💬 Join our [Discord server](https://discord.gg/mp68xkZn2Q) is to chat with FastGPT developers and other FastGPT users. This is a good place to learn about FastGPT, ask questions, and share your experiences.
|
||||
+ 🐞 Create [GitHub Issues](https://github.com/labring/FastGPT/issues/new/choose) for bug reports and feature requests.
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-Back_to_Top-7d09f1.svg" alt="#" align="right">
|
||||
|
||||
45
dev.md
@@ -1,17 +1,40 @@
|
||||
# 打包命令
|
||||
## Premise
|
||||
|
||||
Since FastGPT is managed in the same way as monorepo, it is recommended to install 'make' first during development.
|
||||
|
||||
monorepo Project Name:
|
||||
|
||||
- app: main project
|
||||
-......
|
||||
|
||||
## Dev
|
||||
|
||||
```sh
|
||||
# Build image, not proxy
|
||||
docker build -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.4.7 --build-arg name=app .
|
||||
# Give automatic script code execution permission (on non-Linux systems, you can manually execute the postinstall.sh file content)
|
||||
chmod -R +x ./scripts/
|
||||
# Executing under the code root directory installs all dependencies within the root package, projects, and packages
|
||||
pnpm i
|
||||
|
||||
# build image with proxy
|
||||
docker build -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.4.7 --build-arg name=app --build-arg proxy=taobao .
|
||||
# Not make cmd
|
||||
cd projects/app
|
||||
pnpm dev
|
||||
|
||||
# Make cmd
|
||||
make dev name=app
|
||||
```
|
||||
|
||||
# Pg 常用索引
|
||||
|
||||
```sql
|
||||
CREATE INDEX IF NOT EXISTS modelData_dataset_id_index ON modeldata (dataset_id);
|
||||
CREATE INDEX IF NOT EXISTS modelData_collection_id_index ON modeldata (collection_id);
|
||||
CREATE INDEX IF NOT EXISTS modelData_teamId_index ON modeldata (team_id);
|
||||
```
|
||||
## Build
|
||||
|
||||
```sh
|
||||
# Docker cmd: Build image, not proxy
|
||||
docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 . --build-arg name=app
|
||||
# Make cmd: Build image, not proxy
|
||||
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1
|
||||
|
||||
# Docker cmd: Build image with proxy
|
||||
docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 . --build-arg name=app --build-arg proxy=taobao
|
||||
# Make cmd: Build image with proxy
|
||||
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 proxy=taobao
|
||||
```
|
||||
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
:root {
|
||||
--code-bg: rgba(0, 0, 0, 0.03);
|
||||
--code-color: rgba(14, 116, 144, 0.95);
|
||||
--inline-code-border: 0.5px solid var(--gray-400);
|
||||
|
||||
}
|
||||
|
||||
[data-dark-mode] {
|
||||
--code-bg: hsla(0, 2%, 14%, 1);
|
||||
--code-color: #f3f4f6ed;
|
||||
--inline-code-border: 0.5px solid var(--gray-600);
|
||||
}
|
||||
|
||||
#content {
|
||||
font-family: JetBrains Mono, LXGW WenKai Screen, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", "Ubuntu";
|
||||
}
|
||||
@@ -62,11 +75,33 @@ div.code-toolbar {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.docs-content .main-content pre code {
|
||||
padding: 0 2.5rem 1.25rem .9rem;
|
||||
}
|
||||
|
||||
.docs-content .main-content code {
|
||||
font-size: .875em;
|
||||
padding: 1px 2px;
|
||||
background: var(--code-bg);
|
||||
border: var(--inline-code-border);
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
border-radius: .25rem;
|
||||
color: var(--code-color);
|
||||
}
|
||||
|
||||
li p {
|
||||
margin-top: 1rem !important;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.docs-content .main-content ul > li {
|
||||
margin-top: .3rem !important;
|
||||
margin-bottom: .3rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
height: 118px !important;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Lotus Docs theme
|
||||
*
|
||||
* Adapted from a theme based on:
|
||||
* https://github.com/chriskempson/tomorrow-theme
|
||||
*
|
||||
* @author Colin Wilson <github.com/colinwilson>
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
:root {
|
||||
--prism-code-bg: #faf9f8;
|
||||
--prism-code-scrollbar-thumb-color: var(--gray-400);
|
||||
--prism-color: #333;
|
||||
--prism-bg: #f0f0f0;
|
||||
--prism-highlight-bg: var(--blue-200);
|
||||
--prism-copy-bg: var(--gray-500);
|
||||
--prism-copy-hover-bg: var(--gray-700);
|
||||
--prism-copy-success-bg: var(--emerald-500);
|
||||
--prism-token-punctuation: #666;
|
||||
--prism-token-deleted: #2b6cb0;
|
||||
--prism-token-function-name: #3182bd;
|
||||
--prism-token-function: #c53030;
|
||||
--prism-token-number: var(--cardinal-600);
|
||||
--prism-token-symbol: #333;
|
||||
--prism-token-builtin: #1a202c;
|
||||
--prism-token-regex: #2f855a;
|
||||
--prism-token-variable: var(--yellow-700);
|
||||
--prism-token-url: #4fd1c5;
|
||||
--prism-token-inserted: #38a169;
|
||||
}
|
||||
|
||||
[data-dark-mode] {
|
||||
--prism-code-bg: var(--gray-900);
|
||||
--prism-code-scrollbar-thumb-color: var(--gray-600);
|
||||
--prism-color: #f5fbff;
|
||||
--prism-bg: #32325d;
|
||||
--prism-highlight-bg: var(--blue-400);
|
||||
--prism-copy-bg: var(--gray-400);
|
||||
--prism-copy-hover-bg: var(--white);
|
||||
--prism-copy-success-bg: var(--emerald-200);
|
||||
--prism-token-punctuation: #ccc;
|
||||
--prism-token-deleted: #7fd3ed;
|
||||
--prism-token-function-name: #6196cc;
|
||||
--prism-token-function: #fda3f3;
|
||||
--prism-token-number: var(--cardinal-200);
|
||||
--prism-token-symbol: #ffffff;
|
||||
--prism-token-builtin: #a4cdfe;
|
||||
--prism-token-regex: #7ec699;
|
||||
--prism-token-variable: var(--yellow-100);
|
||||
--prism-token-url: #67cdcc;
|
||||
--prism-token-inserted: green;
|
||||
}
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: var(--prism-color) !important;
|
||||
background: var(--prism-code-bg) !important;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
// padding: 1em;
|
||||
// margin: .5em 0;
|
||||
overflow: auto;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: var(--prism-bg);
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.line-highlight:before,
|
||||
.line-highlight[data-end]:after {
|
||||
background-color: var(--prism-highlight-bg);
|
||||
}
|
||||
|
||||
[data-copy-state="copy"] span:empty::before {
|
||||
background-color: var(--prism-copy-bg);
|
||||
}
|
||||
|
||||
[data-copy-state="copy"] span:empty:hover::before {
|
||||
background-color: var(--prism-copy-hover-bg);
|
||||
}
|
||||
|
||||
[data-copy-state="copy-success"] span:empty::before {
|
||||
background-color: var(--prism-copy-success-bg);
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.block-comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: var(--prism-token-punctuation);
|
||||
}
|
||||
|
||||
.token.tag,
|
||||
.token.attr-name,
|
||||
.token.namespace,
|
||||
.token.deleted {
|
||||
color: var(--prism-token-deleted);
|
||||
}
|
||||
|
||||
.token.function-name {
|
||||
color: var(--prism-token-function-name);
|
||||
}
|
||||
|
||||
.token.boolean,
|
||||
.token.function {
|
||||
color: var(--prism-token-function);
|
||||
}
|
||||
|
||||
.token.number {
|
||||
color: var(--prism-token-number);
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.class-name,
|
||||
.token.constant,
|
||||
.token.symbol {
|
||||
color: var(--prism-token-symbol);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
.token.important,
|
||||
.token.atrule,
|
||||
.token.keyword,
|
||||
.token.builtin {
|
||||
color: var(--prism-token-builtin);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.token.string,
|
||||
.token.char,
|
||||
.token.attr-value,
|
||||
.token.regex {
|
||||
color: var(--prism-token-regex);
|
||||
}
|
||||
|
||||
.token.variable {
|
||||
color: var(--prism-token-variable);
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.entity,
|
||||
.token.url {
|
||||
color: var(--prism-token-url);
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.token.inserted {
|
||||
color: var(--prism-token-inserted);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 225 KiB |
|
Before Width: | Height: | Size: 100 KiB |
BIN
docSite/assets/imgs/demo-appointment2.webp
Normal file
|
After Width: | Height: | Size: 285 KiB |
|
Before Width: | Height: | Size: 160 KiB |
BIN
docSite/assets/imgs/demo-appointment3.webp
Normal file
|
After Width: | Height: | Size: 293 KiB |
|
Before Width: | Height: | Size: 156 KiB |
BIN
docSite/assets/imgs/demo-appointment4.webp
Normal file
|
After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 154 KiB |
BIN
docSite/assets/imgs/demo-appointment5.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 126 KiB |
BIN
docSite/assets/imgs/demo-dalle1.webp
Normal file
|
After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 132 KiB |
BIN
docSite/assets/imgs/demo-fix-evidence1.jpg
Normal file
|
After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 118 KiB |
BIN
docSite/assets/imgs/demo-fix-evidence2.jpg
Normal file
|
After Width: | Height: | Size: 188 KiB |
|
Before Width: | Height: | Size: 163 KiB |
BIN
docSite/assets/imgs/external_file0.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
BIN
docSite/assets/imgs/external_file1.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
docSite/assets/imgs/external_file2.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 51 KiB |
BIN
docSite/assets/imgs/fastgpt-list-models.png
Normal file
|
After Width: | Height: | Size: 181 KiB |
|
Before Width: | Height: | Size: 216 KiB |
BIN
docSite/assets/imgs/feishuwebhook1.webp
Normal file
|
After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 174 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 173 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 198 KiB |
BIN
docSite/assets/imgs/google_search_2.webp
Normal file
|
After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 200 KiB |
BIN
docSite/assets/imgs/google_search_3.webp
Normal file
|
After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 263 KiB |
BIN
docSite/assets/imgs/google_search_4.webp
Normal file
|
After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
BIN
docSite/assets/imgs/one-api-add-xinference-models.jpg
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
docSite/assets/imgs/questionGuide.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 20 KiB |
BIN
docSite/assets/imgs/xinference-launch-model.png
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
docSite/assets/imgs/zilliz_key.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
@@ -1,10 +0,0 @@
|
||||
---
|
||||
title: '线上版定价'
|
||||
description: 'FastGPT 线上版定价'
|
||||
icon: 'currency_yen'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 1200
|
||||
---
|
||||
|
||||
线上版价格请查看:https://cloud.fastgpt.in/price
|
||||
@@ -1,517 +0,0 @@
|
||||
---
|
||||
title: 'Dalle3 绘图'
|
||||
description: '使用 HTTP 模块绘制图片'
|
||||
icon: 'image'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 404
|
||||
---
|
||||
|
||||
| | |
|
||||
| --------------------- | --------------------- |
|
||||
|  |  |
|
||||
|
||||
## OpenAI Dalle3 接口
|
||||
|
||||
先来看下官方接口的参数和响应值:
|
||||
|
||||
Body
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "dall-e-3",
|
||||
"prompt": "A cute baby sea otter",
|
||||
"n": 1,
|
||||
"size": "1024x1024"
|
||||
}
|
||||
```
|
||||
|
||||
Response
|
||||
|
||||
```json
|
||||
{
|
||||
"created": 1589478378,
|
||||
"data": [
|
||||
{
|
||||
"url": "https://..."
|
||||
},
|
||||
{
|
||||
"url": "https://..."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 编排思路
|
||||
|
||||
1. 通过 AI 来优化图片绘制的提示词(这部省略了,自己找提示词即可)
|
||||
2. 通过`HTTP 模块`调用 Dalle3 接口,获取图片的 URL。
|
||||
3. 通过`文本加工`来构建`Markdown`的图片格式。
|
||||
4. 通过`指定回复`来直接输出图片链接。
|
||||
|
||||
### 1. 构建 HTTP 模块
|
||||
|
||||
请求参数直接复制 Dalle3 接口的即可,并求改 prompt 为变量。需要增加一个`Headers.Authorization`。
|
||||
|
||||
Body:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "dall-e-3",
|
||||
"prompt": "{{prompt}}",
|
||||
"n": 1,
|
||||
"size": "1024x1024"
|
||||
}
|
||||
```
|
||||
|
||||
Headers:
|
||||
|
||||
`Authorization: Bearer sk-xxx`
|
||||
|
||||
Response:
|
||||
|
||||
响应值需要根据Dalle3接口的返回值进行获取,我们只绘制了1张图片,所以只需要取第一张图片的URL即可。给 HTTP 模块增加一个`key`为`data[0].url`的输出值。
|
||||
|
||||
### 2. 文本加工 - 构建图片链接
|
||||
|
||||
在`Markdown`语法中``表示插入图片,图片链接由`HTTP模块`输出。
|
||||
|
||||
因此可以增加一个输入来接收`HTTP模块`的图片链接输出,并在`文本内容`中通过变量来引用图片链接,从而得到一个完整的`Markdown`图片格式。
|
||||
|
||||
### 3. 指定回复
|
||||
|
||||
指定回复可以直接输出传入的内容到客户端,因此可以直接输出加工好的`Markdown`图片格式即可。
|
||||
|
||||
## 编排代码
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"moduleId": "userGuide",
|
||||
"name": "core.module.template.App system setting",
|
||||
"flowType": "userGuide",
|
||||
"position": {
|
||||
"x": 454.98510354678695,
|
||||
"y": 721.4016845336229
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "welcomeText",
|
||||
"type": "hidden",
|
||||
"valueType": "string",
|
||||
"label": "core.app.Welcome Text",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"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,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "tts",
|
||||
"type": "hidden",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"moduleId": "userChatInput",
|
||||
"name": "core.module.template.Chat entrance",
|
||||
"flowType": "questionInput",
|
||||
"position": {
|
||||
"x": 597.8136543694757,
|
||||
"y": 1709.9244174501202
|
||||
},
|
||||
"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": [
|
||||
{
|
||||
"moduleId": "mqgfub",
|
||||
"key": "prompt"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "mqgfub",
|
||||
"name": "Dalle3绘图",
|
||||
"flowType": "httpRequest468",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1071.8956245626034,
|
||||
"y": 1236.690825267034
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "core.module.input.label.switch",
|
||||
"description": "core.module.input.description.Trigger",
|
||||
"valueType": "any",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"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": "https://api.openai.com/v1/images/generations",
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "system_httpHeader",
|
||||
"type": "custom",
|
||||
"valueType": "any",
|
||||
"value": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "string",
|
||||
"value": "sk-xxx"
|
||||
}
|
||||
],
|
||||
"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 \"model\": \"dall-e-3\",\r\n \"prompt\": \"{{prompt}}\",\r\n \"n\": 1,\r\n \"size\": \"1024x1024\"\r\n }",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "DYNAMIC_INPUT_KEY",
|
||||
"type": "target",
|
||||
"valueType": "any",
|
||||
"label": "core.module.inputType.dynamicTargetInput",
|
||||
"description": "core.module.input.description.dynamic input",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": true,
|
||||
"hideInApp": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "prompt",
|
||||
"valueType": "string",
|
||||
"label": "prompt",
|
||||
"type": "target",
|
||||
"required": true,
|
||||
"description": "",
|
||||
"edit": true,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"required": true,
|
||||
"dataType": true
|
||||
},
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "system_addInputParam",
|
||||
"type": "addInputParam",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"required": true,
|
||||
"dataType": true
|
||||
},
|
||||
"defaultEditField": {
|
||||
"label": "",
|
||||
"key": "",
|
||||
"description": "",
|
||||
"inputType": "target",
|
||||
"valueType": "string",
|
||||
"required": true
|
||||
},
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "core.module.output.label.running done",
|
||||
"description": "core.module.output.description.running done",
|
||||
"valueType": "boolean",
|
||||
"type": "source",
|
||||
"targets": []
|
||||
},
|
||||
{
|
||||
"key": "system_addOutputParam",
|
||||
"type": "addOutputParam",
|
||||
"valueType": "any",
|
||||
"label": "",
|
||||
"targets": [],
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"dataType": true
|
||||
},
|
||||
"defaultEditField": {
|
||||
"label": "",
|
||||
"key": "",
|
||||
"description": "",
|
||||
"outputType": "source",
|
||||
"valueType": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "source",
|
||||
"valueType": "string",
|
||||
"key": "data[0].url",
|
||||
"label": "url",
|
||||
"description": "",
|
||||
"edit": true,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"dataType": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "nl6mr9",
|
||||
"key": "url"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "xy76o2",
|
||||
"name": "core.module.template.Assigned reply",
|
||||
"flowType": "answerNode",
|
||||
"position": {
|
||||
"x": 2204.027057268489,
|
||||
"y": 1256.786345213533
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "core.module.input.label.switch",
|
||||
"description": "core.module.input.description.Trigger",
|
||||
"valueType": "any",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"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,
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "core.module.output.label.running done",
|
||||
"description": "core.module.output.description.running done",
|
||||
"valueType": "boolean",
|
||||
"type": "source",
|
||||
"targets": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "nl6mr9",
|
||||
"name": "core.module.template.textEditor",
|
||||
"flowType": "pluginModule",
|
||||
"showStatus": false,
|
||||
"position": {
|
||||
"x": 1690.1826860670342,
|
||||
"y": 1262.3858719789062
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "pluginId",
|
||||
"type": "hidden",
|
||||
"label": "",
|
||||
"value": "community-textEditor",
|
||||
"valueType": "string",
|
||||
"connected": false,
|
||||
"showTargetInApp": false,
|
||||
"showTargetInPlugin": false
|
||||
},
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "core.module.input.label.switch",
|
||||
"description": "core.module.input.description.Trigger",
|
||||
"valueType": "any",
|
||||
"showTargetInApp": true,
|
||||
"showTargetInPlugin": true,
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "textarea",
|
||||
"valueType": "string",
|
||||
"label": "文本内容",
|
||||
"type": "textarea",
|
||||
"required": true,
|
||||
"description": "可以通过 {{key}} 的方式引用传入的变量。变量仅支持字符串或数字。",
|
||||
"edit": false,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"required": true,
|
||||
"dataType": true,
|
||||
"inputType": true
|
||||
},
|
||||
"connected": false,
|
||||
"placeholder": "可以通过 {{key}} 的方式引用传入的变量。变量仅支持字符串或数字。",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"key": "url",
|
||||
"valueType": "string",
|
||||
"label": "url",
|
||||
"type": "target",
|
||||
"required": true,
|
||||
"description": "",
|
||||
"edit": true,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"required": true,
|
||||
"dataType": true,
|
||||
"inputType": false
|
||||
},
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "DYNAMIC_INPUT_KEY",
|
||||
"valueType": "any",
|
||||
"label": "需要加工的输入",
|
||||
"type": "addInputParam",
|
||||
"required": false,
|
||||
"description": "可动态的添加字符串类型变量,在文本编辑中通过 {{key}} 使用变量。非字符串类型,会自动转成字符串类型。",
|
||||
"edit": false,
|
||||
"editField": {
|
||||
"key": true,
|
||||
"name": true,
|
||||
"description": true,
|
||||
"required": true,
|
||||
"dataType": true,
|
||||
"inputType": false
|
||||
},
|
||||
"defaultEditField": {
|
||||
"label": "",
|
||||
"key": "",
|
||||
"description": "",
|
||||
"inputType": "target",
|
||||
"valueType": "string",
|
||||
"required": true
|
||||
},
|
||||
"connected": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "text",
|
||||
"valueType": "string",
|
||||
"label": "core.module.output.label.text",
|
||||
"type": "source",
|
||||
"edit": false,
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "xy76o2",
|
||||
"key": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
@@ -1,339 +0,0 @@
|
||||
---
|
||||
title: '固定开头和结尾内容'
|
||||
description: '利用指定回复,创建固定的开头和结尾'
|
||||
icon: 'healing'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 401
|
||||
---
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
如上图,可以通过指定回复编排一个固定的开头和结尾内容。
|
||||
|
||||
## 模块编排
|
||||
|
||||
复制下面配置,点击「高级编排」右上角的导入按键,导入该配置。
|
||||
|
||||
{{% details title="编排配置" closed="true" %}}
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"moduleId": "userChatInput",
|
||||
"name": "用户问题(对话入口)",
|
||||
"flowType": "questionInput",
|
||||
"position": {
|
||||
"x": 59.03170043915989,
|
||||
"y": 1604.8595605938747
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"type": "systemInput",
|
||||
"label": "用户问题",
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"label": "用户问题",
|
||||
"type": "source",
|
||||
"valueType": "string",
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "chatModule",
|
||||
"key": "userChatInput"
|
||||
},
|
||||
{
|
||||
"moduleId": "ymqh0t",
|
||||
"key": "switch"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "history",
|
||||
"name": "聊天记录",
|
||||
"flowType": "historyNode",
|
||||
"position": {
|
||||
"x": 38.19233923987295,
|
||||
"y": 1184.4581738905642
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "maxContext",
|
||||
"type": "numberInput",
|
||||
"label": "最长记录数",
|
||||
"value": 6,
|
||||
"min": 0,
|
||||
"max": 50,
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "history",
|
||||
"type": "hidden",
|
||||
"label": "聊天记录",
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "history",
|
||||
"label": "聊天记录",
|
||||
"valueType": "chatHistory",
|
||||
"type": "source",
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "chatModule",
|
||||
"key": "history"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "chatModule",
|
||||
"name": "AI 对话",
|
||||
"flowType": "chatNode",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 943.1225685246793,
|
||||
"y": 891.3094521573212
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "model",
|
||||
"type": "custom",
|
||||
"label": "对话模型",
|
||||
"value": "gpt-3.5-turbo",
|
||||
"list": [
|
||||
{
|
||||
"label": "FastGPT-4k",
|
||||
"value": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"label": "FastGPT-16k",
|
||||
"value": "gpt-3.5-turbo-16k"
|
||||
},
|
||||
{
|
||||
"label": "文心一言",
|
||||
"value": "ERNIE-Bot"
|
||||
},
|
||||
{
|
||||
"label": "FastGPT-Plus",
|
||||
"value": "gpt-4"
|
||||
},
|
||||
{
|
||||
"label": "glm2(演示娱乐)",
|
||||
"value": "glm2-6b"
|
||||
}
|
||||
],
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "temperature",
|
||||
"type": "slider",
|
||||
"label": "温度",
|
||||
"value": 0,
|
||||
"min": 0,
|
||||
"max": 10,
|
||||
"step": 1,
|
||||
"markList": [
|
||||
{
|
||||
"label": "严谨",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"label": "发散",
|
||||
"value": 10
|
||||
}
|
||||
],
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "maxToken",
|
||||
"type": "custom",
|
||||
"label": "回复上限",
|
||||
"value": 2000,
|
||||
"min": 100,
|
||||
"max": 4000,
|
||||
"step": 50,
|
||||
"markList": [
|
||||
{
|
||||
"label": "100",
|
||||
"value": 100
|
||||
},
|
||||
{
|
||||
"label": "4000",
|
||||
"value": 4000
|
||||
}
|
||||
],
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "systemPrompt",
|
||||
"type": "textarea",
|
||||
"label": "系统提示词",
|
||||
"max": 300,
|
||||
"valueType": "string",
|
||||
"description": "模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}",
|
||||
"placeholder": "模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}",
|
||||
"value": "",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "limitPrompt",
|
||||
"type": "textarea",
|
||||
"valueType": "string",
|
||||
"label": "限定词",
|
||||
"max": 500,
|
||||
"description": "限定模型对话范围,会被放置在本次提问前,拥有强引导和限定性。不建议内容太长,会影响上下文,可使用变量,例如 {{language}}。可在文档中找到对应的限定例子",
|
||||
"placeholder": "限定模型对话范围,会被放置在本次提问前,拥有强引导和限定性。不建议内容太长,会影响上下文,可使用变量,例如 {{language}}。可在文档中找到对应的限定例子",
|
||||
"value": "",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "触发器",
|
||||
"valueType": "any",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "quoteQA",
|
||||
"type": "target",
|
||||
"label": "引用内容",
|
||||
"description": "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
|
||||
"valueType": "datasetQuote",
|
||||
"connected": false
|
||||
},
|
||||
{
|
||||
"key": "history",
|
||||
"type": "target",
|
||||
"label": "聊天记录",
|
||||
"valueType": "chatHistory",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "userChatInput",
|
||||
"type": "target",
|
||||
"label": "用户问题",
|
||||
"required": true,
|
||||
"valueType": "string",
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "answerText",
|
||||
"label": "AI回复",
|
||||
"description": "将在 stream 回复完毕后触发",
|
||||
"valueType": "string",
|
||||
"type": "source",
|
||||
"targets": []
|
||||
},
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "回复结束",
|
||||
"description": "AI 回复完成后触发",
|
||||
"valueType": "boolean",
|
||||
"type": "source",
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "ojeopv",
|
||||
"key": "switch"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "ymqh0t",
|
||||
"name": "指定回复",
|
||||
"flowType": "answerNode",
|
||||
"position": {
|
||||
"x": 435.27459673941917,
|
||||
"y": 1081.9477378716076
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "触发器",
|
||||
"valueType": "any",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "text",
|
||||
"type": "textarea",
|
||||
"valueType": "string",
|
||||
"value": "这是AI作答:\n\n---\n\n",
|
||||
"label": "回复的内容",
|
||||
"description": "可以使用 \\n 来实现换行。也可以通过外部模块输入实现回复,外部模块输入时会覆盖当前填写的内容",
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "回复结束",
|
||||
"description": "回复完成后触发",
|
||||
"valueType": "boolean",
|
||||
"type": "source",
|
||||
"targets": [
|
||||
{
|
||||
"moduleId": "chatModule",
|
||||
"key": "switch"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"moduleId": "ojeopv",
|
||||
"name": "指定回复",
|
||||
"flowType": "answerNode",
|
||||
"position": {
|
||||
"x": 1573.4540253108476,
|
||||
"y": 1551.9808807287498
|
||||
},
|
||||
"inputs": [
|
||||
{
|
||||
"key": "switch",
|
||||
"type": "target",
|
||||
"label": "触发器",
|
||||
"valueType": "any",
|
||||
"connected": true
|
||||
},
|
||||
{
|
||||
"key": "text",
|
||||
"type": "textarea",
|
||||
"valueType": "string",
|
||||
"value": "\\n\n---\n\n这是固定的结尾",
|
||||
"label": "回复的内容",
|
||||
"description": "可以使用 \\n 来实现换行。也可以通过外部模块输入实现回复,外部模块输入时会覆盖当前填写的内容",
|
||||
"connected": true
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"key": "finish",
|
||||
"label": "回复结束",
|
||||
"description": "回复完成后触发",
|
||||
"valueType": "boolean",
|
||||
"type": "source",
|
||||
"targets": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
{{% /details %}}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
---
|
||||
title: "高级编排介绍"
|
||||
description: "快速了解 FastGPT 高级编排"
|
||||
icon: "circle"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 301
|
||||
---
|
||||
|
||||
FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用了 Flow 节点编排(工作流)的方式来实现复杂工作流,提高可玩性和扩展性。但同时也提高了上手的门槛,有一定开发背景的用户使用起来会比较容易。
|
||||
|
||||
[查看视频教程](https://www.bilibili.com/video/BV1aB4y1Z7Hy/?spm_id_from=333.999.list.card_archive.click&vd_source=903c2b09b7412037c2eddc6a8fb9828b)
|
||||
|
||||

|
||||
|
||||
## 什么是节点?
|
||||
|
||||
在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。
|
||||
|
||||
如下图,这是一个最简单的 AI 对话。它由用户输入的问题、聊天记录以及 AI 对话节点组成。
|
||||
|
||||

|
||||
|
||||
执行流程如下:
|
||||
|
||||
1. 用户输入问题后,会向服务器发送一个请求,并携带问题。从而得到【用户问题】节点的输出。
|
||||
2. 根据设置的【最长记录数】来获取数据库中的记录数,从而得到【聊天记录】节点的输出。
|
||||
经过上面两个流程,就得到了左侧两个蓝色点的结果。结果会被注入到右侧的【AI】对话节点。
|
||||
3. 【AI 对话】节点根据传入的聊天记录和用户问题,调用对话接口,从而实现回答。(这里的对话结果输出隐藏了起来,默认只要触发了对话节点,就会往客户端输出内容)
|
||||
|
||||
### 节点分类
|
||||
|
||||
从功能上,节点可以分为 2 类:
|
||||
|
||||
1. **系统节点**:用户引导(配置一些对话框信息)、用户问题(流程入口)。
|
||||
2. **功能节点**:知识库搜索、AI 对话等剩余节点。(这些节点都有输入和输出,可以自由组合)。
|
||||
|
||||
### 节点的组成
|
||||
|
||||
每个节点会包含 3 个核心部分:固定参数、外部输入(左边有个圆圈)和输出(右边有个圆圈)。
|
||||
|
||||

|
||||
|
||||
- 对话模型、温度、回复上限、系统提示词和限定词为固定参数,同时系统提示词和限定词也可以作为外部输入,意味着如果你有输入流向了系统提示词,那么原本填写的内容就会被**覆盖**。
|
||||
- 触发器、引用内容、聊天记录和用户问题则为外部输入,需要从其他节点的输出流入。
|
||||
- 回复结束则为该节点的输出。
|
||||
|
||||
## 重点 - 工作流是如何运行的
|
||||
|
||||
与单出入口的工作流不同,FastGPT的工作流可以指定**不同的入口**,并且没有**固定的出口**,而是以节点运行结束作为出口,如果在一个轮调用中,所有节点都不再允许,则工作流结束。
|
||||
|
||||
不过为了方便阅读,大部分时候,我们仍是设置一个模块作为入口,在工作流中,它被叫做`对话入口`。下面我们来看下,工作流是如何运行的,以及每个节点何时被触发执行。
|
||||
|
||||
记住3个**节点可执行**的原则:
|
||||
|
||||
1. 仅关心**已连接的**外部输入,即左边的圆圈被连接了参数。
|
||||
2. 当**已连接的**内容都被赋值的时候触发。(这个地方经常会遇到,连接了很多根输入线,但是只要有一个输入没有值,这个节点也不会执行)
|
||||
3. 可以多个输出连接到一个输入,后续的值会覆盖前面的值。
|
||||
|
||||

|
||||
|
||||
### 示例 1:
|
||||
|
||||
聊天记录节点会自动执行,因此聊天记录输入会自动赋值。当用户发送问题时,【用户问题】节点会输出值,此时【AI 对话】节点的用户问题输入也会被赋值。两个连接的输入都被赋值后,会执行 【AI 对话】节点。
|
||||
|
||||

|
||||
|
||||
### 例子 2:
|
||||
|
||||
下图是一个知识库搜索例子。
|
||||
|
||||
1. 历史记录会流入【AI 对话】节点。
|
||||
2. 用户的问题会流入【知识库搜索】和【AI 对话】节点,由于【AI 对话】节点的触发器和引用内容还是空,此时不会执行。
|
||||
3. 【知识库搜索】节点仅一个外部输入,并且被赋值,开始执行。
|
||||
4. 【知识库搜索】结果为空时,“搜索结果不为空”的值为空,不会输出,因此【AI 对话】节点会因为触发器没有赋值而无法执行。而“搜索结果为空”会有输出,流向指定回复的触发器,因此【指定回复】节点进行输出。
|
||||
5. 【知识库搜索】结果不为空时,“搜索结果不为空”和“引用内容”都有输出,会流向【AI 对话】,此时【AI 对话】的 4 个外部输入都被赋值,开始执行。
|
||||
|
||||

|
||||
|
||||
## 如何连接节点
|
||||
|
||||
1. 为了方便识别不同输入输出的类型,FastGPT 给每个节点的输入输出连接点赋予不同的颜色,你可以把相同颜色的连接点连接起来。其中,灰色代表任意类型,可以随意连接。
|
||||
2. 位于左侧的连接点为输入,右侧的为输出,连接只能将一个输入和输出连接起来,不能连接“输入和输入”或者“输出和输出”。
|
||||
3. 可以点击连接线中间的 x 来删除连接线。
|
||||
4. 可以左键点击选中连接线
|
||||
|
||||
## 如何阅读?
|
||||
|
||||
1. 建议从左往右阅读。
|
||||
2. 从 **用户问题** 节点开始。用户问题节点,代表的是用户发送了一段文本,触发任务开始。
|
||||
3. 关注【AI 对话】和【指定回复】节点,这两个节点是输出答案的地方。
|
||||
|
||||
## FAQ
|
||||
|
||||
### 想合并多个输出结果怎么实现?
|
||||
|
||||
1. 文本加工,可以对字符串进行合并。
|
||||
2. 知识库搜索合并,可以合并多个知识库搜索结果
|
||||
3. 其他结果,无法直接合并,可以考虑传入到`HTTP`节点中进行合并,使用`[Laf](https://laf.run/)`可以快速实现一个无服务器HTTP接口。
|
||||
|
||||
### 节点为什么有2个用户问题
|
||||
|
||||
左侧的`用户问题`是指该节点所需的输入。右侧的`用户问题`是为了方便后续的连线,输出的值和传入的用户问题一样。
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
---
|
||||
title: "指定回复"
|
||||
description: "FastGPT 指定回复模块介绍"
|
||||
icon: "reply"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 359
|
||||
---
|
||||
|
||||
## 特点
|
||||
|
||||
- 可重复添加(防止复杂编排时线太乱,重复添加可以更美观)
|
||||
- 可手动输入
|
||||
- 可外部输入
|
||||
- 会输出结果给客户端
|
||||
|
||||
制定回复模块通常用户特殊状态回复,当然你也可以像图 2 一样,实现一些比较骚的操作~ 触发逻辑非常简单:
|
||||
|
||||
1. 一种是写好回复内容,通过触发器触发。
|
||||
2. 一种是不写回复内容,直接由外部输入触发,并回复输入的内容。
|
||||
|
||||
{{< figure
|
||||
src="/imgs/specialreply.png"
|
||||
alt=""
|
||||
caption="图 1"
|
||||
>}}
|
||||
|
||||
{{< figure
|
||||
src="/imgs/specialreply2.png"
|
||||
alt=""
|
||||
caption="图 2"
|
||||
>}}
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
title: "判断器"
|
||||
description: "FastGPT 判断器模块介绍"
|
||||
icon: "input"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 362
|
||||
---
|
||||
|
||||
## 特点
|
||||
|
||||
- 可重复添加
|
||||
- 有外部输入
|
||||
- 触发执行
|
||||
|
||||

|
||||
|
||||
## 功能
|
||||
|
||||
对任意输入内容进行 True False 输出,默认情况下,当传入的内容为 false, undefined, null,0,none 时,会输出 false。
|
||||
|
||||
也可以增加自定义规则来补充输出 false 的内容,每行代表一个匹配规则,支持正则表达式。
|
||||
|
||||
**例子1**
|
||||
|
||||
不填写任何自定义 False 规则。
|
||||
|
||||
| 输入 | 输出 |
|
||||
| --- | --- |
|
||||
| 123 | true |
|
||||
| 这是一段文本 | true |
|
||||
| false | false |
|
||||
| 0 | false |
|
||||
| null | false |
|
||||
|
||||
**例子2**
|
||||
|
||||
自定义 False 规则:
|
||||
|
||||
```
|
||||
123
|
||||
你好
|
||||
aa
|
||||
/dd/
|
||||
```
|
||||
|
||||
| 输入 | 输出 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 123 | false | 命中自定义 false 规则 |
|
||||
| 这是一段文本 | true | 未命中 |
|
||||
| false | false | 命中自定义 内置 规则 |
|
||||
| 0 | false | 命中自定义 内置 规则 |
|
||||
| null | false | 命中自定义 内置 规则 |
|
||||
| aa | false | 命中自定义 false 规则 |
|
||||
| aaa | true | 未命中 |
|
||||
| bb | false | 命中自定义 false 规则 |
|
||||
| bbb | false | 命中自定义 false 规则(正则匹配通过) |
|
||||
|
||||
## 作用
|
||||
|
||||
适用场景有:让大模型做判断后输出固定内容,根据大模型回复内容判断是否触发后续模块。
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
title: "触发器"
|
||||
description: "FastGPT 触发器模块介绍"
|
||||
icon: "work_history"
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 360
|
||||
---
|
||||
|
||||
细心的同学可以发现,在每个功能模块里都会有一个叫【触发器】的外部输入,并且是 any 类型。
|
||||
|
||||
它的**核心作用**就是控制模块的执行时机,以下图两个知识库搜索中的【AI 对话】模块为例子:
|
||||
|
||||
| 图 1 | 图 2 |
|
||||
| ---------------------------- | ---------------------------- |
|
||||
|  |  |
|
||||
|
||||
【知识库搜索】模块中,由于**引用内容**始终会有输出,会导致【AI 对话】模块的**引用内容**输入无论有没有搜到内容都会被赋值。如果此时不连接触发器(图 2),在搜索结束后必定会执行【AI 对话】模块。
|
||||
|
||||
有时候,你可能希望空搜索时候进行额外处理,例如:回复固定内容、调用其他提示词的 GPT、发送一个 HTTP 请求…… 此时就需要用到触发器,需要将 **搜索结果不为空** 和 **触发器** 连接起来。
|
||||
|
||||
当搜索结果为空时,【知识库搜索】模块不会输出 **搜索结果不为空** 的结果,因此 【AI 对话】 模块的触发器始终为空,便不会执行。
|
||||
|
||||
总之,记住模块执行的逻辑就可以灵活的使用触发器:**外部输入字段(有连接的才有效)全部被赋值时才会被执行**。
|
||||