Compare commits

..

65 Commits

Author SHA1 Message Date
Archer
593af8f7dc Update README.md (#2274) 2024-08-06 12:13:58 +08:00
Archer
96ebec9809 Fix navbar (#2273)
* fix: phone navbar cannot scroll; fix: file uplaod process error

* perf: select repeat file
2024-08-06 11:49:52 +08:00
shilin
f35ba8e5a7 feat(chatbot-extension): a Chrome extension that can be using for chat with AI on any website (#2235)
* feat(chatbot-extension): a Chrome extension that can be using for chat with AI on any website

* fix: 插件支持语音输入
feat:chatbot支持切换

* fix: 切换chatbot后,自动隐藏bot列表
2024-08-06 10:53:01 +08:00
Archer
e36d9d794f File input (#2270)
* doc

* feat: file upload  config

* perf: chat box file params

* feat: markdown show file

* feat: chat file store and clear

* perf: read file contentType

* feat: llm vision config

* feat: file url output

* perf: plugin error text

* perf: image load

* feat: ai chat document

* perf: file block ui

* feat: read file node

* feat: file read response field

* feat: simple mode support read files

* feat: tool call

* feat: read file histories

* perf: select file

* perf: select file config

* i18n

* i18n

* fix: ts; feat: tool response preview result
2024-08-06 10:00:22 +08:00
papapatrick
10dcdb5491 I18n Translations (#2267)
* rebase

* i18n-1

* add error info i18n

* fix

* fix

* refactor: 删除error.json

* delete useI18n
2024-08-05 18:42:21 +08:00
heheer
025d405fe2 feat: allow adding tags when creating collections via api (#2268)
* feat: allow adding tags when creating collections via api

* fix
2024-08-05 18:33:58 +08:00
Archer
fe71efbbd2 Collection tag (#2266)
* feat: collection metadata filter (#2211)

* feat: add dataset collection tags (#2231)

* dataset page

* workflow page

* move

* fix

* add plus filter

* fix

* fix

* fix

* perf: collection tag code

* fix: collection tags (#2249)

* fix

* fix

* fix tags of dataset page

* fix tags of workflow page

* doc

* add comments

* fix: collection tags (#2264)

* fix: metadata filter

* feat: search filter

---------

Co-authored-by: heheer <1239331448@qq.com>
Co-authored-by: heheer <heheer@sealos.io>
2024-08-05 12:08:46 +08:00
Archer
56f6e69bc7 System inform (#2263)
* feat: Bind Notification Pipe (#2229)

* chore: account page add bind notification modal

* feat: timerlock schema and type

* feat(fe): bind notification method modal

* chore: fe adjust

* feat: clean useless code

* fix: cron lock

* chore: adjust the code

* chore: rename api

* chore: remove unused code

* chore: fe adjust

* perf: bind inform ux

* fix: time ts

* chore: notification (#2251)

* perf: send message code

* perf: sub schema index

* fix: timezone plugin

* fix: format

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
2024-08-05 00:29:14 +08:00
heheer
998e7833e8 fix: workflow plugin module default input value (#2257) 2024-08-03 18:16:50 +08:00
heheer
110bf9391f fix: get plugin input variables from history (#2255) 2024-08-03 12:31:31 +08:00
heheer
48f2c95bb9 fix: add delete all input guide lexicon button (#2241)
* fix: add delete all input guide lexicon button

* fix

* fix permisstion
2024-08-03 12:29:15 +08:00
Archer
9f37e56173 Chat perf test (#2252)
* perf: optimize chat init api (#2233)

* perf: optimize the chat/init api

* perf: 添加团队和分享api的优化

* perf: api写法优化

* perf: api写法优化

* perf: 完善细节

* perf: 添加auth字段

* perf: 优雅的写法🥳

* fix: Fix the bug in debugging Tag (#2250)

* fix: 修复调试tag不显示bug

* perf

* perf: 优化代码

* fix: 返回新对象

* fix: show tag error

---------

Co-authored-by: papapatrick <109422393+Patrickill@users.noreply.github.com>
2024-08-03 10:44:31 +08:00
lolocoo
af1cff6230 fix(appList): 删除应用后回到聊天选择最后一次对话的应用时提示无该应用bug (#2236) 2024-08-02 10:14:39 +08:00
Archer
3760726354 Update 488.md (#2234) 2024-08-01 12:24:38 +08:00
Archer
6ddf0b23fc Update 488.md (#2232) 2024-08-01 10:06:44 +08:00
Archer
f680bdf54d yml version (#2230) 2024-07-31 17:04:48 +08:00
Archer
834d36981f fix: response modal (#2228) 2024-07-31 16:11:04 +08:00
Archer
2fdca621e6 perf: remove unuse code (#2227) 2024-07-31 15:43:58 +08:00
heheer
8c7f4a3a30 fix: add check for reset (#2226) 2024-07-31 15:42:59 +08:00
Leo Liu Junyi
41da52d6ed Fix Switch state inconsistency for Scheduled Trigger (#2221)
* 修复定时关闭时Switch显示不同步

* 优化写法
2024-07-31 12:07:31 +08:00
Archer
446d9cb1b9 fix: oneapi image (#2222) 2024-07-31 12:04:11 +08:00
Rick
48a5853550 fix: the helm release failed due to version handle (#2199)
Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
2024-07-31 10:19:42 +08:00
Archer
c129874d59 fix: dataset params default error (#2210) 2024-07-30 17:58:40 +08:00
papapatrick
cc6fa4207a style: 优化样式 (#2203) 2024-07-30 11:47:26 +08:00
papapatrick
e27abe1f6b perf: 运行详情弹窗优化 (#2192)
* perf: 运行详情弹窗优化

* style: 调整样式

* style: 弹窗样式优化&&应用切换圆角添加

* fix: 修复编译错误
2024-07-29 18:36:13 +08:00
Zhedong Cen
5cecef5836 Update README.md (#2197) 2024-07-29 17:28:50 +08:00
Archer
ee89d0d7a4 Update package.json 2024-07-29 16:00:20 +08:00
Archer
6eeb1b4da1 perf: dataset upload process render (#2191) 2024-07-29 15:58:59 +08:00
Carson Yang
b6c9bb4a65 docs: add subtitle translation example (#2195)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
2024-07-29 15:09:12 +08:00
Archer
20aad33850 fix: plugin revert (#2190) 2024-07-29 11:01:12 +08:00
Archer
02b51317b4 feat: 4.8.8 doc (#2188) 2024-07-29 10:56:29 +08:00
Archer
ba933c7450 perf: markdown code css (#2187) 2024-07-29 10:01:14 +08:00
Archer
856d7ce48f fix: app type (#2185) 2024-07-29 09:47:47 +08:00
Archer
23f22cda18 Add mongo forward read. Fix markdown code block. (#2174)
* perf: read from mongo forward node

* fix: code block ui

* perf: markdown code css
2024-07-29 09:47:30 +08:00
Archer
0a9a7691b4 Update 488.md 2024-07-26 13:50:42 +08:00
Archer
8d25a1d3ec Add img extension (#2172)
* perf: mongo log

* perf: img read

* doc
2024-07-26 12:46:07 +08:00
heheer
2d1e53c3b5 fix: plugin input default value & validate (#2171)
* fix: plugin input default value & validate

* delete console
2024-07-26 12:41:18 +08:00
Finley Ge
71d0093768 fix: app get readable team plugin error (#2169)
In the former code. User who access the plugin should have Write
Permission which should be Read.
2024-07-26 11:43:46 +08:00
Archer
cd554f573e 4.8.8 test fix (#2149)
* perf: code comment

* feat: system plugin input guide

* perf: variable avatar

* feat: feishu webhook

* perf: select tool config tip

* perf: rename variable

* fix: per inherit error

* perf: docker-compose oneapi version and i18n

* perf: ui tip bug

* fix: ts

* perf: pg log

* perf: editor color

* perf: update init
2024-07-26 10:23:44 +08:00
heheer
2d016b7462 fix: editor focus & picker highlight & ui (#2166)
* fix ui

* fix editor focus & picker highlight
2024-07-26 00:03:07 +08:00
Finley Ge
65515e7952 dataset inheritance permission (#2151)
* refactor: dataset create and update api

* chore: defaultpermission & resume fe

* refactor: database auth

* fix(ts): add inheritPermission into default data types

* chore: adjust the code

* fix: list api type filter

* fix: query condition
2024-07-25 19:03:24 +08:00
heheer
5906daff9f fix: plugin run & setting quote variables (#2150)
* fix

* fix

* change variables & variablelabels show condition

* fix type

* fix
2024-07-25 18:01:43 +08:00
Finley Ge
55cefccad1 fix: enable http request (#2159) 2024-07-25 14:39:22 +08:00
Finley Ge
87dac54f1e fix: outlink manage can delete/update others (#2158)
* fix: outlink manage be able to delete/update others

* fix: remove enum validation for teamMemberSchema.
because the old data has the role property, which may cause unknown bug

* perf: change findAndRemove to deleteOne
2024-07-25 13:52:16 +08:00
Archer
45b8d7e8de 4.8.8 test fix (#2143)
* perf: transcriptions api

* perf: variable picker tip

* perf: variable picker tip

* perf: chat select app

* feat: router to app detail

* perf: variable avoid space

* perf: variable picker

* perf: doc2x icon and params

* perf: sandbox support countToken

* feat: sandbox support delay and countToken
2024-07-24 16:02:53 +08:00
Finley Ge
a478621730 refactor openapikey and outlink apis (#2134)
* refactor: OpenAPIKey refactor

* refactor: outlink api refactor

fix: list return wrong data

* chore: remove deprecated type definition

* chore: remove throw Error. instead of Promise.reject

* fix: auth openapikey's owner

* fix: manager could read all keys
2024-07-24 11:11:36 +08:00
heheer
a233ab9584 fix build (#2146) 2024-07-24 11:10:48 +08:00
Menghuan1918
8d2a192515 添加插件:Doc2X 图片/文档识别 (#2097)
* Init the requrest part

* Finish the img deal part

* For test only one plugin

* Finish img2text part

* Finish pdf ocr part

* Change vscode setting back

* Change `for` into` for await` type
2024-07-24 09:59:20 +08:00
heheer
dcaf972767 fix: variable dynamic refresh & space match (#2142)
* fix: variable dynamic refresh & space match

* fix variable picker filter
2024-07-23 22:02:36 +08:00
Zong
f9d43ac009 feat(textSplitter): typo (#2138) 2024-07-23 21:54:55 +08:00
papapatrick
abcf48d5ec perf: switch perf (#2131)
* feat:  新增对话框底部复制按钮

* fix: 对话框底部复制按钮定位问题

* perf: 优化应用切换逻辑

* perf: 删除不必要代码

* fix: 修复编译失败bug&&修复冲突错误

* feat:  新增对话框底部复制按钮

* fix: 对话框底部复制按钮定位问题

* feat: 过长引用折叠功能

* merge: 合并主仓库代码

* refactor:  删除不必要代码

* perf: 优化应用切换逻辑

* perf: 删除不必要代码

* fix: 修复编译失败bug&&修复冲突错误

* merge

* merge: 处理冲突

* refactor: 重构代码删除不必要代码

* perf: 删除不必要代码
2024-07-23 18:53:48 +08:00
heheer
bf5145e632 perf: variable label picker scroll & focus disappear (#2135)
* fix: variable label picker scroll & focus disappear

* fix

* fix filter

* revert
2024-07-23 18:03:53 +08:00
Finley Ge
f37cdabb15 purge old permission (#2118)
* chore: purge old permission
- remove useless role of teamMember
- Cleanup auth apis' Props and Return type Definitions

* chore: a better way of RequireAtLeastOne

Signed-off-by: Finley Ge <m13203533462@163.com>

---------

Signed-off-by: Finley Ge <m13203533462@163.com>
2024-07-23 14:55:54 +08:00
Archer
e99c91aaa6 Perf system plugin and worker (#2126)
* perf: worker pool

* perf: worker register

* perf: worker controller

* perf: system plugin worker

* perf: system plugin worker

* perf: worker

* perf: worker

* worker timeout

* perf: copy icon
2024-07-23 11:23:42 +08:00
heheer
a4787bce5c feat: get node variables in prompt editor (#2087)
* feat: get node variables in prompt editor

* fix

* fix build

* merge

* fix build

* delete default parent

* fix

* fix
2024-07-23 11:20:23 +08:00
jingyang
f24e41f5ec update: i18n common.json keys (#2124) 2024-07-22 20:31:27 +08:00
papapatrick
85de3c1d64 Chat-perf (#2117)
* feat:  新增对话框底部复制按钮

* fix: 对话框底部复制按钮定位问题

* feat: 过长引用折叠功能

* merge: 合并主仓库代码

* refactor: 删除不必要代码

* doc: 文档补充的部分修改成英文
2024-07-22 18:25:25 +08:00
Finley Ge
c6f682310c fix resource permission schema (#2116)
* fix: resource permission schema

* fix: ResorceType
2024-07-22 17:27:48 +08:00
jingyang
991398b8d2 scripts: add delete-unused-keys (#2115)
* scripts: add delete-unused-keys

* update script

* fix keys

* fix ci

* update keys

* add i18n

* update
2024-07-22 15:03:35 +08:00
Archer
f452554663 fix: markdown echarts (#2101)
* fix: markdown echarts

* perf: packages
2024-07-22 10:10:32 +08:00
jingyang
57ff38e16f feat: Optimize i18n keys and remove unused keys, supporting static files in I18nT (#2092)
* feat: packages web i18n

* delete file

* feat:i18n add i18nT

* handle keys

* delete unusedKeys

* fix build

* update dev.md
2024-07-19 16:28:07 +08:00
Archer
f7b55b501f Update 488.md 2024-07-19 14:23:11 +08:00
Archer
cf7145ab54 System plugin (#2091)
* System template (#2082)

* feat: system plugin (#2024)

* add plugin cost & change plugin avatar (#2030)

* add plugin cost & change plugin avatar

* add author

* feat: duckduckgo plugin

* duckduck search

* perf: templates select system plugin

* perf: system plugin avatar

* feat: duckduck plugins

* doc

* perf: plugin classify

* perf: icon avatar component

* perf: system template avatar

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>

* feat: system plugin search

* perf: plugin packages important

* perf: source avatar

* nextconfig

* perf: i18n

* perf: default model

* perf: system plugin author

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-07-19 14:15:01 +08:00
Carson Yang
1eedb9caba Update workflow to change baseurl for cn site (#2081)
* Docs: fix gitinfo

Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>

* Update workflow to change baseurl for cn site

Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>

---------

Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
2024-07-18 12:15:03 +08:00
heheer
6390d64417 fix: delete plugin output node check filter (#2080) 2024-07-18 10:44:13 +08:00
619 changed files with 19661 additions and 6117 deletions

View File

@@ -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"

View File

@@ -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}

View File

@@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
build-fastgpt-images:
preview-fastgpt-images:
runs-on: ubuntu-20.04
steps:
- name: Checkout

View File

@@ -3,4 +3,6 @@ dist
**/.DS_Store
node_modules
docSite/
*.md
*.md
cl100l_base.ts

46
.vscode/i18n-ally-custom-framework.yml vendored Normal file
View 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})['\"`]"
- "[^\\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: "([^:]+):"
# 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: false

View File

@@ -20,5 +20,9 @@
"i18n-ally.displayLanguage": "zh", // 显示语言
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key"
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
"i18n-ally.translate.engines": ["deepl", "google"],
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

View File

@@ -106,7 +106,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
由于需要部署数据库,部署完后需要等待 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/)
@@ -122,7 +122,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
扫码加入飞书话题群 (新开,逐渐弃用微信群)
![](https://oss.laf.run/otnvvf-imgs/1719505774252.jpg)
![](https://oss.laf.run/otnvvf-imgs/飞书20240806-114214.png)
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">

BIN
bin/fastgpt-v1.0.0-helm.tgz Normal file

Binary file not shown.

72
dev.md
View File

@@ -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
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@@ -4,7 +4,7 @@ description: "FastGPT 对话问题引导"
icon: "code"
draft: false
toc: true
weight: 350
weight: 108
---
![](/imgs/questionGuide.png)

View File

@@ -0,0 +1,50 @@
---
title: "知识库集合标签"
description: "FastGPT 知识库集合标签使用说明"
icon: "developer_guide"
draft: false
toc: true
weight: 108
---
知识库集合标签是 FastGPT 商业版特有功能。它允许你对知识库中的数据集合添加标签进行分类,更高效地管理知识库数据。
而进一步可以在问答中,搜索知识库时添加集合过滤,实现更精确的搜索。
| | | |
| --------------------- | --------------------- | --------------------- |
| ![](/imgs/collection-tags-1.png) | ![](/imgs/collection-tags-2.png) | ![](/imgs/collection-tags-3.png) |
## 标签基础操作说明
在知识库详情页面,可以对标签进行管理,可执行的操作有
- 创建标签
- 修改标签名
- 删除标签
- 将一个标签赋给多个数据集合
- 给一个数据集合添加多个标签
也可以利用标签对数据集合进行筛选
## 知识库搜索-集合过滤说明
利用标签可以在知识库搜索时,通过填写「集合过滤」这一栏来实现更精确的搜索,具体的填写示例如下
```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` 会生效

View File

@@ -77,7 +77,7 @@ docker-compose up -d
商业版用户需要执行一个初始化,格式化团队信息。
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成自己域名)
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成商业版域名)
```bash
curl --location --request POST 'https://{{host}}/api/init/v468' \

View File

@@ -1,5 +1,5 @@
---
title: 'V4.8.7(进行中)'
title: 'V4.8.7'
description: 'FastGPT V4.8.7 更新说明'
icon: 'upgrade'
draft: false
@@ -13,8 +13,8 @@ weight: 817
### 2. 修改镜像
- fastgpt 镜像 tag 修改成 v4.8.7-alpha
- 商业版镜像 tag 修改成 v4.8.7-alpha
- fastgpt 镜像 tag 修改成 v4.8.7
- 商业版镜像 tag 修改成 v4.8.7
-------

View File

@@ -0,0 +1,51 @@
---
title: 'V4.8.8(需要初始化)'
description: 'FastGPT V4.8.8 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 816
---
## 升级指南
### 1. 做好数据库备份
### 2. 修改镜像
- fastgpt 镜像 tag 修改成 v4.8.8-fix2
- 商业版镜像 tag 修改成 v4.8.8
### 3. 执行初始化
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv488' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
会初始化知识库的继承权限
-------
## V4.8.8 更新说明
[点击查看完整更新](https://github.com/labring/FastGPT/releases/tag/v4.8.8)
1. 新增 - 重构系统插件的结构。允许向开源社区 PR 系统插件,具体可见: [如何向 FastGPT 社区提交系统插件](https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh)。
2. 新增 - DuckDuckGo 系统插件。
3. 新增 - 飞书 webhook 系统插件。
4. 新增 - 修改变量填写方式。提示词输入框以以及工作流中所有 Textarea 输入框,支持输入 / 唤起变量选择,可直接选择所有上游输出值,无需动态引入。
5. 商业版新增 - 知识库权限继承。
6. 优化 - 移动端快速切换应用交互。
7. 优化 - 节点图标。
8. 优化 - 对话框引用增加额外复制案件,便于复制。增加引用内容折叠。
9. 优化 - OpenAI sdk 升级,并自定义了 whisper 模型接口(未仔细查看 sdk 实现,但 sdk 中 whisper 接口,似乎无法适配一般 fastapi 接口)
10. 修复 - Permission 表声明问题。
11. 修复 - 并行执行节点,运行时间未正确记录。
12. 修复 - 运行详情未正确展示嵌套节点信息。
13. 修复 - 简易模式,首次进入,无法正确获取知识库配置。
14. 修复 - Log debug level 配置无效。
15. 修复 - 插件独立运行时,会将插件输入的值进行变量替换,可能导致后续节点变量异常。

View File

@@ -0,0 +1,48 @@
---
title: 'V4.8.9(进行中)'
description: 'FastGPT V4.8.9 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 816
---
## 升级指南
### 1. 做好数据库备份
### 2. 修改镜像
### 3. 执行初始化
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成**FastGPT 商业版域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/init/489' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
会初始化多租户的通知方式
-------
## V4.8.9 更新说明
1. 新增 - 文件上传配置,不再依赖视觉模型决定是否可上传图片,而是通过系统配置决定。
2. 新增 - AI 对话节点和工具调用支持选择“是否开启图片识别”,开启后会自动获取对话框上传的图片和“用户问题”中的图片链接。
3. 新增 - 文档解析节点。
4. 商业版新增 - 团队通知账号绑定,用于接收重要信息。
5. 商业版新增 - 知识库集合标签功能,可以对知识库进行标签管理。
6. 商业版新增 - 知识库搜索节点支持标签过滤和创建时间过滤。
7. 新增 - 删除所有对话引导内容。
8. 优化 - 对话框信息懒加载,减少网络传输。
9. 优化 - 清除选文件缓存,支持重复选择同一个文件。
10. 修复 - 知识库上传文件,网络不稳定或文件较多情况下,进度无法到 100%。
11. 修复 - 删除应用后回到聊天选择最后一次对话的应用为删除的应用时提示无该应用问题。
12. 修复 - 插件动态变量配置默认值时,无法正常显示默认值。
13. 修复 - 工具调用温度和最大回复值未生效。
14. 修复 - 函数调用模式assistant role 中GPT 模型必须传入 content 参数。(不影响大部分模型,目前基本都改用用 ToolChoice 模式FC 模式已弃用)。
15. 修复 - 知识库文件上传进度更新可能异常。
16. 修复 - 知识库 rebuilding 时候,页面总是刷新到第一页。

View File

@@ -4,7 +4,7 @@ description: '使用 HTTP 模块绘制图片'
icon: 'image'
draft: false
toc: true
weight: 404
weight: 408
---
| | |

View File

@@ -4,7 +4,7 @@ description: '利用工具调用模块发送一个飞书webhook通知'
icon: 'image'
draft: false
toc: true
weight: 404
weight: 409
---
该文章展示如何发送一个简单的飞书webhook通知以此类推发送其他类型的通知也可以这么操作。

View File

@@ -4,7 +4,7 @@ description: '利用指定回复,创建固定的开头和结尾'
icon: 'healing'
draft: false
toc: true
weight: 401
weight: 405
---
![](/imgs/demo-fix-evidence1.jpg)

View File

@@ -4,7 +4,7 @@ description: '将 FastGPT 接入谷歌搜索'
icon: 'search'
draft: false
toc: true
weight: 402
weight: 406
---
| | |

View File

@@ -4,7 +4,7 @@ description: '展示高级编排操作数据库的能力'
icon: 'database'
draft: false
toc: true
weight: 403
weight: 407
---
| | |

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@ enableEmoji = true
enableGitInfo = false # N.B. .GitInfo does not currently function with git submodule content directories
defaultContentLanguage = 'zh-cn'
defaultContentLanguageInSubdir = false
[languages]
[languages.zh-cn]
title = "FastGPT"

View File

@@ -15,7 +15,7 @@
{{ end }}
<!-- change -->
{{ $repoURL = $repoURL | append "docSite/content" .Site.LanguagePrefix $filePath }}
{{ $repoURL = $repoURL | append "docSite/content" .Site.Language.Lang $filePath }}
{{ $repoURL = delimit $repoURL "/" }}
{{ $editPageURL := replaceRE "(https?://)|(/)+" "$1$2" $repoURL }}

View File

@@ -121,8 +121,8 @@ services:
restart: always
fastgpt:
container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.8.6 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.6 # 阿里云
image: ghcr.io/labring/fastgpt:v4.8.8-fix2 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.8-fix2 # 阿里云
ports:
- 3000:3000
networks:
@@ -179,7 +179,7 @@ services:
- ./mysql:/var/lib/mysql
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
image: ghcr.io/songquanpeng/one-api:v0.6.7
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
ports:
- 3001:3000

View File

@@ -79,8 +79,8 @@ services:
restart: always
fastgpt:
container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.8.6 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.6 # 阿里云
image: ghcr.io/labring/fastgpt:v4.8.8-fix2 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.8-fix2 # 阿里云
ports:
- 3000:3000
networks:
@@ -136,7 +136,7 @@ services:
- ./mysql:/var/lib/mysql
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
image: ghcr.io/songquanpeng/one-api:v0.6.7
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
ports:
- 3001:3000

View File

@@ -60,8 +60,8 @@ services:
restart: always
fastgpt:
container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.8.6 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.6 # 阿里云
image: ghcr.io/labring/fastgpt:v4.8.8-fix2 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.8-fix2 # 阿里云
ports:
- 3000:3000
networks:
@@ -117,7 +117,7 @@ services:
- ./mysql:/var/lib/mysql
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
image: ghcr.io/songquanpeng/one-api:v0.6.7
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
ports:
- 3001:3000

View File

@@ -9,7 +9,8 @@
"gen:theme-typings": "chakra-cli tokens packages/web/styles/theme.ts --out node_modules/.pnpm/node_modules/@chakra-ui/styled-system/dist/theming.types.d.ts",
"postinstall": "sh ./scripts/postinstall.sh",
"initIcon": "node ./scripts/icon/init.js",
"previewIcon": "node ./scripts/icon/index.js"
"previewIcon": "node ./scripts/icon/index.js",
"checkI18n": "node ./scripts/i18n/delete-unused-keys.js"
},
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",

View File

@@ -1,5 +1,5 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 502000 */
export enum AppErrEnum {
unExist = 'appUnExist',
@@ -8,11 +8,11 @@ export enum AppErrEnum {
const appErrList = [
{
statusText: AppErrEnum.unExist,
message: '应用不存在'
message: i18nT('common:code_error.app_error.not_exist')
},
{
statusText: AppErrEnum.unAuthApp,
message: '无权操作该应用'
message: i18nT('common:code_error.app_error.un_auth_app')
}
];
export default appErrList.reduce((acc, cur, index) => {

View File

@@ -1,5 +1,5 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 504000 */
export enum ChatErrEnum {
unAuthChat = 'unAuthChat'
@@ -7,7 +7,7 @@ export enum ChatErrEnum {
const errList = [
{
statusText: ChatErrEnum.unAuthChat,
message: '无权操作该对话记录'
message: i18nT('common:code_error.chat_error.un_auth')
}
];
export default errList.reduce((acc, cur, index) => {

View File

@@ -8,8 +8,8 @@ export enum DatasetErrEnum {
unAuthDatasetCollection = 'unAuthDatasetCollection',
unAuthDatasetData = 'unAuthDatasetData',
unAuthDatasetFile = 'unAuthDatasetFile',
unLinkCollection = 'unLinkCollection'
unLinkCollection = 'unLinkCollection',
invalidVectorModelOrQAModel = 'invalidVectorModelOrQAModel'
}
const datasetErr = [
{
@@ -39,6 +39,10 @@ const datasetErr = [
{
statusText: DatasetErrEnum.unLinkCollection,
message: 'core.dataset.error.unLinkCollection'
},
{
statusText: DatasetErrEnum.invalidVectorModelOrQAModel,
message: 'core.dataset.error.invalidVectorModelOrQAModel'
}
];
export default datasetErr.reduce((acc, cur, index) => {

View File

@@ -1,20 +1,27 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 506000 */
export enum OpenApiErrEnum {
unExist = 'openapiUnExist',
unAuth = 'openapiUnAuth'
unAuth = 'openapiUnAuth',
exceedLimit = 'openapiExceedLimit'
}
const errList = [
{
statusText: OpenApiErrEnum.unExist,
message: 'Api Key 不存在'
message: i18nT('common:code_error.openapi_error.api_key_not_exist')
},
{
statusText: OpenApiErrEnum.unAuth,
message: '无权操作该 Api Key'
message: i18nT('common:code_error.openapi_error.un_auth')
},
{
statusText: OpenApiErrEnum.exceedLimit,
message: i18nT('common:code_error.openapi_error.exceed_limit')
}
];
export default errList.reduce((acc, cur, index) => {
return {
...acc,

View File

@@ -1,32 +1,33 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 505000 */
export enum OutLinkErrEnum {
unExist = 'outlinkUnExist',
unAuthLink = 'unAuthLink',
linkUnInvalid = 'linkUnInvalid',
unAuthUser = 'unAuthUser'
}
const errList = [
{
statusText: OutLinkErrEnum.unExist,
message: '分享链接不存在'
message: i18nT('common:code_error.outlink_error.link_not_exist')
},
{
statusText: OutLinkErrEnum.unAuthLink,
message: '分享链接无效'
message: i18nT('common:code_error.outlink_error.invalid_link')
},
{
code: 501,
statusText: OutLinkErrEnum.linkUnInvalid,
message: '分享链接无效'
message: i18nT('common:code_error.outlink_error.invalid_link') // 使用相同的错误消息
},
{
statusText: OutLinkErrEnum.unAuthUser,
message: '身份校验失败'
message: i18nT('common:code_error.outlink_error.un_auth_user')
}
];
export default errList.reduce((acc, cur, index) => {
return {
...acc,

View File

@@ -1,20 +1,22 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 508000 */
export enum PluginErrEnum {
unExist = 'pluginUnExist',
unAuth = 'pluginUnAuth'
}
const errList = [
{
statusText: PluginErrEnum.unExist,
message: '插件不存在'
message: i18nT('common:code_error.plugin_error.not_exist')
},
{
statusText: PluginErrEnum.unAuth,
message: '无权操作该插件'
message: i18nT('common:code_error.plugin_error.un_auth')
}
];
export default errList.reduce((acc, cur, index) => {
return {
...acc,

View File

@@ -1,15 +1,17 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* dataset: 509000 */
export enum SystemErrEnum {
communityVersionNumLimit = 'communityVersionNumLimit'
}
const systemErr = [
{
statusText: SystemErrEnum.communityVersionNumLimit,
message: '超出开源版数量限制,请升级商业版: https://fastgpt.in'
message: i18nT('common:code_error.system_error.community_version_num_limit')
}
];
export default systemErr.reduce((acc, cur, index) => {
return {
...acc,

View File

@@ -1,5 +1,5 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* team: 500000 */
export enum TeamErrEnum {
teamOverSize = 'teamOverSize',
@@ -12,17 +12,43 @@ export enum TeamErrEnum {
websiteSyncNotEnough = 'websiteSyncNotEnough',
reRankNotEnough = 'reRankNotEnough'
}
const teamErr = [
{ statusText: TeamErrEnum.teamOverSize, message: 'error.team.overSize' },
{ statusText: TeamErrEnum.unAuthTeam, message: '无权操作该团队' },
{ statusText: TeamErrEnum.aiPointsNotEnough, message: '' },
{ statusText: TeamErrEnum.datasetSizeNotEnough, message: '知识库容量不足,请先扩容~' },
{ statusText: TeamErrEnum.datasetAmountNotEnough, message: '知识库数量已达上限~' },
{ statusText: TeamErrEnum.appAmountNotEnough, message: '应用数量已达上限~' },
{ statusText: TeamErrEnum.pluginAmountNotEnough, message: '插件数量已达上限~' },
{ statusText: TeamErrEnum.websiteSyncNotEnough, message: '无权使用Web站点同步~' },
{ statusText: TeamErrEnum.reRankNotEnough, message: '无权使用检索重排~' }
{
statusText: TeamErrEnum.teamOverSize,
message: i18nT('common:code_error.team_error.over_size')
},
{ statusText: TeamErrEnum.unAuthTeam, message: i18nT('common:code_error.team_error.un_auth') },
{
statusText: TeamErrEnum.aiPointsNotEnough,
message: i18nT('common:code_error.team_error.ai_points_not_enough')
}, // 需要定义或留空
{
statusText: TeamErrEnum.datasetSizeNotEnough,
message: i18nT('common:code_error.team_error.dataset_size_not_enough')
},
{
statusText: TeamErrEnum.datasetAmountNotEnough,
message: i18nT('common:code_error.team_error.dataset_amount_not_enough')
},
{
statusText: TeamErrEnum.appAmountNotEnough,
message: i18nT('common:code_error.team_error.app_amount_not_enough')
},
{
statusText: TeamErrEnum.pluginAmountNotEnough,
message: i18nT('common:code_error.team_error.plugin_amount_not_enough')
},
{
statusText: TeamErrEnum.websiteSyncNotEnough,
message: i18nT('common:code_error.team_error.website_sync_not_enough')
},
{
statusText: TeamErrEnum.reRankNotEnough,
message: i18nT('common:code_error.team_error.re_rank_not_enough')
}
];
export default teamErr.reduce((acc, cur, index) => {
return {
...acc,

View File

@@ -1,5 +1,5 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* team: 503000 */
export enum UserErrEnum {
unAuthUser = 'unAuthUser',
@@ -8,10 +8,22 @@ export enum UserErrEnum {
balanceNotEnough = 'balanceNotEnough'
}
const errList = [
{ statusText: UserErrEnum.unAuthUser, message: '找不到该用户' },
{ statusText: UserErrEnum.binVisitor, message: '您的身份校验未通过' },
{ statusText: UserErrEnum.binVisitor, message: '您当前身份为游客,无权操作' },
{ statusText: UserErrEnum.balanceNotEnough, message: '账号余额不足~' }
{
statusText: UserErrEnum.unAuthUser,
message: i18nT('common:code_error.user_error.un_auth_user')
},
{
statusText: UserErrEnum.binVisitor,
message: i18nT('common:code_error.user_error.bin_visitor')
}, // 身份校验未通过
{
statusText: UserErrEnum.binVisitor,
message: i18nT('common:code_error.user_error.bin_visitor_guest')
}, // 游客身份
{
statusText: UserErrEnum.balanceNotEnough,
message: i18nT('common:code_error.user_error.balance_not_enough')
}
];
export default errList.reduce((acc, cur, index) => {
return {

View File

@@ -8,24 +8,25 @@ import teamErr from './code/team';
import userErr from './code/user';
import commonErr from './code/common';
import SystemErrEnum from './code/system';
import { i18nT } from '../../../web/i18n/utils';
export const ERROR_CODE: { [key: number]: string } = {
400: '请求失败',
401: '无权访问',
403: '紧张访问',
404: '请求不存在',
405: '请求方法错误',
406: '请求的格式错误',
410: '资源已删除',
422: '验证错误',
500: '服务器发生错误',
502: '网关错误',
503: '服务器暂时过载或维护',
504: '网关超时'
400: i18nT('common:code_error.error_code.400'),
401: i18nT('common:code_error.error_code.401'),
403: i18nT('common:code_error.error_code.403'),
404: i18nT('common:code_error.error_code.404'),
405: i18nT('common:code_error.error_code.405'),
406: i18nT('common:code_error.error_code.406'),
410: i18nT('common:code_error.error_code.410'),
422: i18nT('common:code_error.error_code.422'),
500: i18nT('common:code_error.error_code.500'),
502: i18nT('common:code_error.error_code.502'),
503: i18nT('common:code_error.error_code.503'),
504: i18nT('common:code_error.error_code.504')
};
export const TOKEN_ERROR_CODE: Record<number, string> = {
403: '登录状态无效,请重新登录'
403: i18nT('common:code_error.token_error_code.403')
};
export const proxyError: Record<string, boolean> = {
@@ -63,32 +64,31 @@ export const ERROR_RESPONSE: Record<
[ERROR_ENUM.unAuthorization]: {
code: 403,
statusText: ERROR_ENUM.unAuthorization,
message: '凭证错误',
message: i18nT('common:code_error.error_message.403'),
data: null
},
[ERROR_ENUM.insufficientQuota]: {
code: 510,
statusText: ERROR_ENUM.insufficientQuota,
message: '账号余额不足',
message: i18nT('common:code_error.error_message.510'),
data: null
},
[ERROR_ENUM.unAuthModel]: {
code: 511,
statusText: ERROR_ENUM.unAuthModel,
message: '无权操作该模型',
message: i18nT('common:code_error.error_message.511'),
data: null
},
[ERROR_ENUM.unAuthFile]: {
code: 513,
statusText: ERROR_ENUM.unAuthFile,
message: '无权阅读该文件',
message: i18nT('common:code_error.error_message.513'),
data: null
},
[ERROR_ENUM.unAuthApiKey]: {
code: 514,
statusText: ERROR_ENUM.unAuthApiKey,
message: 'Api Key 不合法',
message: i18nT('common:code_error.error_message.514'),
data: null
},
...appErr,

View File

@@ -1,11 +1,19 @@
import { i18nT } from '../../../web/i18n/utils';
/* mongo fs bucket */
export enum BucketNameEnum {
dataset = 'dataset'
dataset = 'dataset',
chat = 'chat'
}
export const bucketNameMap = {
[BucketNameEnum.dataset]: {
label: 'file.bucket.dataset'
label: i18nT('file:bucket_file')
},
[BucketNameEnum.chat]: {
label: i18nT('file:bucket_chat')
}
};
export const ReadFileBaseUrl = '/api/common/file/read';
export const documentFileType = '.txt, .docx, .csv, .xlsx, .pdf, .md, .html, .pptx';

View File

@@ -5,4 +5,5 @@ export type FileTokenQuery = {
teamId: string;
tmbId: string;
fileId: string;
expiredTime?: number;
};

View File

@@ -144,7 +144,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
];
}
const isCustomSteep = checkIsCustomStep(step);
const isCustomStep = checkIsCustomStep(step);
const isMarkdownSplit = checkIsMarkdownSplit(step);
const independentChunk = checkIndependentChunk(step);
@@ -154,7 +154,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
.replace(
reg,
(() => {
if (isCustomSteep) return splitMarker;
if (isCustomStep) return splitMarker;
if (independentChunk) return `${splitMarker}$1`;
return `$1${splitMarker}`;
})()

View File

@@ -1,5 +1,10 @@
import dayjs from 'dayjs';
import cronParser from 'cron-parser';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
dayjs.extend(timezone);
export const formatTime2YMDHMW = (time?: Date) => dayjs(time).format('YYYY-MM-DD HH:mm:ss dddd');
export const formatTime2YMDHM = (time?: Date) =>

View File

@@ -91,3 +91,10 @@ export const sliceJsonStr = (str: string) => {
return jsonStr;
};
export const sliceStrStartEnd = (str: string, start: number, end: number) => {
const overSize = str.length > start + end;
const startContent = str.slice(0, start);
const endContent = overSize ? str.slice(-end) : '';
return startContent + (overSize ? ` ...... ` : '') + endContent;
};

View File

@@ -32,9 +32,12 @@ export type FastGPTFeConfigsType = {
show_promotion?: boolean;
show_team_chat?: boolean;
concatMd?: string;
docUrl?: string;
chatbotUrl?: string;
openAPIDocUrl?: string;
systemPluginCourseUrl?: string;
systemTitle?: string;
systemDescription?: string;
googleClientVerKey?: string;

View File

@@ -0,0 +1,9 @@
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
{
[K in Keys]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
}[Keys];
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
{
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
}[Keys];

View File

@@ -2,8 +2,8 @@ import type { LLMModelItemType, VectorModelItemType } from './model.d';
export const defaultQAModels: LLMModelItemType[] = [
{
model: 'gpt-3.5-turbo',
name: 'gpt-3.5-turbo',
model: 'gpt-4o-mini',
name: 'gpt-4o-mini',
maxContext: 16000,
maxResponse: 16000,
quoteMaxToken: 13000,

View File

@@ -119,3 +119,10 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
问题:"""{{question}}"""`
}
];
// Document quote prompt
export const Prompt_DocumentQuote = `将 <Quote></Quote> 中的内容作为你的知识:
<Quote>
{{quote}}
</Quote>
`;

View File

@@ -2,23 +2,46 @@ import openai from 'openai';
import type {
ChatCompletionMessageToolCall,
ChatCompletionChunk,
ChatCompletionMessageParam,
ChatCompletionMessageParam as SdkChatCompletionMessageParam,
ChatCompletionToolMessageParam,
ChatCompletionAssistantMessageParam
ChatCompletionAssistantMessageParam,
ChatCompletionContentPart as SdkChatCompletionContentPart,
ChatCompletionUserMessageParam as SdkChatCompletionUserMessageParam
} from 'openai/resources';
import { ChatMessageTypeEnum } from './constants';
export * from 'openai/resources';
export type ChatCompletionMessageParam = ChatCompletionMessageParam & {
// Extension of ChatCompletionMessageParam, Add file url type
export type ChatCompletionContentPartFile = {
type: 'file_url';
name: string;
url: string;
};
// Rewrite ChatCompletionContentPart, Add file type
export type ChatCompletionContentPart =
| SdkChatCompletionContentPart
| ChatCompletionContentPartFile;
type CustomChatCompletionUserMessageParam = {
content: string | Array<ChatCompletionContentPart>;
role: 'user';
name?: string;
};
export type ChatCompletionMessageParam = (
| Exclude<SdkChatCompletionMessageParam, SdkChatCompletionUserMessageParam>
| CustomChatCompletionUserMessageParam
) & {
dataId?: string;
};
export type SdkChatCompletionMessageParam = SdkChatCompletionMessageParam;
/* ToolChoice and functionCall extension */
export type ChatCompletionToolMessageParam = ChatCompletionToolMessageParam & { name: string };
export type ChatCompletionAssistantToolParam = {
role: 'assistant';
tool_calls: ChatCompletionMessageToolCall[];
};
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
toolName?: string;
toolAvatar?: string;
@@ -28,13 +51,16 @@ export type ChatCompletionMessageFunctionCall = ChatCompletionAssistantMessagePa
toolName?: string;
toolAvatar?: string;
};
// Stream response
export type StreamChatType = Stream<ChatCompletionChunk>;
export default openai;
export * from 'openai';
// Other
export type PromptTemplateItem = {
title: string;
desc: string;
value: string;
};
export default openai;
export * from 'openai';

View File

@@ -1,4 +1,4 @@
import { AppTTSConfigType, AppWhisperConfigType } from './type';
import { AppTTSConfigType, AppFileSelectConfigType, AppWhisperConfigType } from './type';
export enum AppTypeEnum {
folder = 'folder',
@@ -23,3 +23,9 @@ export const defaultChatInputGuideConfig = {
textList: [],
customUrl: ''
};
export const defaultAppSelectFileConfig: AppFileSelectConfigType = {
canSelectFile: false,
canSelectImg: false,
maxFiles: 10
};

View File

@@ -5,6 +5,20 @@ import { FlowNodeTypeEnum } from '../../workflow/node/constant';
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
return nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)?.inputs || [];
};
export const getPluginRunContent = (e: { pluginInputs: FlowNodeInputItemType[] }) => {
return JSON.stringify(e);
export const getPluginRunContent = ({
pluginInputs,
variables
}: {
pluginInputs: FlowNodeInputItemType[];
variables: Record<string, any>;
}) => {
const pluginInputsWithValue = pluginInputs.map((input) => {
const { key } = input;
const value = variables?.hasOwnProperty(key) ? variables[key] : input.defaultValue;
return {
...input,
value
};
});
return JSON.stringify(pluginInputsWithValue);
};

View File

@@ -1,7 +1,7 @@
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
import { AppTypeEnum } from './constants';
import { PermissionTypeEnum } from '../../support/permission/constant';
import { VariableInputEnum } from '../workflow/constants';
import { NodeInputKeyEnum, VariableInputEnum } from '../workflow/constants';
import { SelectedDatasetType } from '../workflow/api';
import { DatasetSearchModeEnum } from '../dataset/constants';
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
@@ -91,6 +91,7 @@ export type AppChatConfigType = {
whisperConfig?: AppWhisperConfigType;
scheduledTriggerConfig?: AppScheduledTriggerConfigType;
chatInputGuide?: ChatInputGuideConfigType;
fileSelectConfig?: AppFileSelectConfigType;
};
export type SettingAIDataType = {
model: string;
@@ -98,6 +99,7 @@ export type SettingAIDataType = {
maxToken: number;
isResponseAnswerText?: boolean;
maxHistories?: number;
[NodeInputKeyEnum.aiChatVision]?: boolean; // Is open vision mode
};
// variable
@@ -134,3 +136,9 @@ export type AppScheduledTriggerConfigType = {
timezone: string;
defaultPrompt: string;
};
// File
export type AppFileSelectConfigType = {
canSelectFile: boolean;
canSelectImg: boolean;
maxFiles: number;
};

View File

@@ -6,27 +6,29 @@ import { getAppChatConfig } from '../workflow/utils';
import { StoreNodeItemType } from '../workflow/type/node';
import { DatasetSearchModeEnum } from '../dataset/constants';
export const getDefaultAppForm = (): AppSimpleEditFormType => ({
aiSettings: {
model: 'gpt-3.5-turbo',
systemPrompt: '',
temperature: 0,
isResponseAnswerText: true,
maxHistories: 6,
maxToken: 4000
},
dataset: {
datasets: [],
similarity: 0.4,
limit: 1500,
searchMode: DatasetSearchModeEnum.embedding,
usingReRank: false,
datasetSearchUsingExtensionQuery: false,
datasetSearchExtensionBg: ''
},
selectedTools: [],
chatConfig: {}
});
export const getDefaultAppForm = (): AppSimpleEditFormType => {
return {
aiSettings: {
model: 'gpt-4o-mini',
systemPrompt: '',
temperature: 0,
isResponseAnswerText: true,
maxHistories: 6,
maxToken: 4000
},
dataset: {
datasets: [],
similarity: 0.4,
limit: 1500,
searchMode: DatasetSearchModeEnum.embedding,
usingReRank: false,
datasetSearchUsingExtensionQuery: true,
datasetSearchExtensionBg: ''
},
selectedTools: [],
chatConfig: {}
};
};
/* format app nodes to edit form */
export const appWorkflow2Form = ({

View File

@@ -56,16 +56,21 @@ export const chats2GPTMessages = ({
text: item.text?.content || ''
};
}
if (
item.type === ChatItemValueTypeEnum.file &&
item.file?.type === ChatFileTypeEnum.image
) {
return {
type: 'image_url',
image_url: {
if (item.type === ChatItemValueTypeEnum.file) {
if (item.file?.type === ChatFileTypeEnum.image) {
return {
type: 'image_url',
image_url: {
url: item.file?.url || ''
}
};
} else if (item.file?.type === ChatFileTypeEnum.file) {
return {
type: 'file_url',
name: item.file?.name || '',
url: item.file?.url || ''
}
};
};
}
}
})
.filter(Boolean) as ChatCompletionContentPart[];
@@ -175,6 +180,16 @@ export const GPTMessages2Chats = (
url: item.image_url.url
}
});
} else if (item.type === 'file_url') {
value.push({
// @ts-ignore
type: ChatItemValueTypeEnum.file,
file: {
type: ChatFileTypeEnum.file,
name: item.name,
url: item.url
}
});
}
});
}

View File

@@ -106,17 +106,26 @@ export type AdminFbkType = {
};
/* --------- chat item ---------- */
export type ChatItemType = (UserChatItemType | SystemChatItemType | AIChatItemType) & {
dataId?: string;
export type ResponseTagItemType = {
totalRunningTime?: number;
totalQuoteList?: SearchDataResponseItemType[];
llmModuleAccount?: number;
historyPreviewLength?: number;
};
export type ChatItemType = (UserChatItemType | SystemChatItemType | AIChatItemType) & {
dataId?: string;
} & ResponseTagItemType;
// Frontend type
export type ChatSiteItemType = (UserChatItemType | SystemChatItemType | AIChatItemType) & {
dataId: string;
status: `${ChatStatusEnum}`;
moduleName?: string;
ttsBuffer?: Uint8Array;
responseData?: ChatHistoryItemResType[];
} & ChatBoxInputType;
} & ChatBoxInputType &
ResponseTagItemType;
/* --------- team chat --------- */
export type ChatAppListSchema = {

View File

@@ -2,6 +2,7 @@ import { DispatchNodeResponseType } from '../workflow/runtime/type';
import { FlowNodeTypeEnum } from '../workflow/node/constant';
import { ChatItemValueTypeEnum, ChatRoleEnum } from './constants';
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
import { sliceStrStartEnd } from '../../common/string/tools';
// Concat 2 -> 1, and sort by role
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
@@ -25,6 +26,7 @@ export const getChatTitleFromChatMessage = (message?: ChatItemType, defaultValue
return defaultValue;
};
// Keep the first n and last n characters
export const getHistoryPreview = (
completeMessages: ChatItemType[]
): {
@@ -32,30 +34,44 @@ export const getHistoryPreview = (
value: string;
}[] => {
return completeMessages.map((item, i) => {
if (item.obj === ChatRoleEnum.System || i >= completeMessages.length - 2) {
return {
obj: item.obj,
value: item.value?.[0]?.text?.content || ''
};
}
const n = item.obj === ChatRoleEnum.System || i >= completeMessages.length - 2 ? 80 : 40;
const content = item.value
.map((item) => {
if (item.text?.content) {
const content =
item.text.content.length > 20
? `${item.text.content.slice(0, 20)}...`
: item.text.content;
return content;
}
return '';
})
.filter(Boolean)
.join('\n');
// Get message text content
const rawText = (() => {
if (item.obj === ChatRoleEnum.System) {
return item.value?.map((item) => item.text?.content).join('') || '';
} else if (item.obj === ChatRoleEnum.Human) {
return (
item.value
?.map((item) => {
if (item?.text?.content) return item?.text?.content;
if (item.file?.type === 'image') return 'Input an image';
return '';
})
.filter(Boolean)
.join('\n') || ''
);
} else if (item.obj === ChatRoleEnum.AI) {
return (
item.value
?.map((item) => {
return (
item.text?.content || item?.tools?.map((item) => item.toolName).join(',') || ''
);
})
.join('') || ''
);
}
return '';
})();
const startContent = rawText.slice(0, n);
const endContent = rawText.length > 2 * n ? rawText.slice(-n) : '';
const content = startContent + (rawText.length > n ? ` ...... ` : '') + endContent;
return {
obj: item.obj,
value: content
value: sliceStrStartEnd(content, 80, 80)
};
});
};

View File

@@ -10,7 +10,6 @@ export type DatasetUpdateBody = {
name?: string;
avatar?: string;
intro?: string;
permission?: DatasetSchemaType['permission']; // TODO: Should be deleted.
agentModel?: LLMModelItemType;
status?: DatasetSchemaType['status'];
@@ -75,6 +74,23 @@ export type ExternalFileCreateDatasetCollectionParams = ApiCreateDatasetCollecti
filename?: string;
};
/* ================= tag ===================== */
export type CreateDatasetCollectionTagParams = {
datasetId: string;
tag: string;
};
export type AddTagsToCollectionsParams = {
originCollectionIds: string[];
collectionIds: string[];
datasetId: string;
tag: string;
};
export type UpdateDatasetCollectionTagParams = {
datasetId: string;
tagId: string;
tag: string;
};
/* ================= data ===================== */
export type PgSearchRawType = {
id: string;

View File

@@ -8,22 +8,22 @@ export enum DatasetTypeEnum {
export const DatasetTypeMap = {
[DatasetTypeEnum.folder]: {
icon: 'common/folderFill',
label: 'Folder Dataset',
label: 'folder_dataset',
collectionLabel: 'common.Folder'
},
[DatasetTypeEnum.dataset]: {
icon: 'core/dataset/commonDataset',
label: 'Common Dataset',
label: 'common_dataset',
collectionLabel: 'common.File'
},
[DatasetTypeEnum.websiteDataset]: {
icon: 'core/dataset/websiteDataset',
label: 'Website Dataset',
label: 'website_dataset',
collectionLabel: 'common.Website'
},
[DatasetTypeEnum.externalFile]: {
icon: 'core/dataset/externalDataset',
label: 'External File',
label: 'external_file',
collectionLabel: 'common.File'
}
};

View File

@@ -1,4 +1,4 @@
import { PermissionValueType } from 'support/permission/type';
import { PermissionSchemaType } from '../../support/permission/type';
import type { LLMModelItemType, VectorModelItemType } from '../../core/ai/model.d';
import { PermissionTypeEnum } from '../../support/permission/constant';
import { PushDatasetDataChunkProps } from './api';
@@ -12,31 +12,28 @@ import {
import { DatasetPermission } from '../../support/permission/dataset/controller';
import { Permission } from '../../support/permission/controller';
/* schema */
export type DatasetSchemaType = {
_id: string;
parentId: string;
parentId?: string;
userId: string;
teamId: string;
tmbId: string;
updateTime: Date;
avatar: string;
name: string;
vectorModel: string;
agentModel: string;
intro: string;
type: DatasetTypeEnum;
type: `${DatasetTypeEnum}`;
status: `${DatasetStatusEnum}`;
// permission: DatasetPermission;
// metadata
websiteConfig?: {
url: string;
selector: string;
};
externalReadUrl?: string;
defaultPermission: PermissionValueType;
};
} & PermissionSchemaType;
// } & PermissionSchemaType;
export type DatasetCollectionSchemaType = {
_id: string;
@@ -72,6 +69,13 @@ export type DatasetCollectionSchemaType = {
};
};
export type DatasetCollectionTagsSchemaType = {
_id: string;
teamId: string;
datasetId: string;
tag: string;
};
export type DatasetDataIndexItemType = {
defaultIndex: boolean;
dataId: string; // pg data id
@@ -133,15 +137,13 @@ export type DatasetSimpleItemType = {
};
export type DatasetListItemType = {
_id: string;
parentId: string;
avatar: string;
name: string;
intro: string;
type: DatasetTypeEnum;
type: `${DatasetTypeEnum}`;
permission: DatasetPermission;
vectorModel: VectorModelItemType;
defaultPermission: PermissionValueType;
};
} & PermissionSchemaType;
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
vectorModel: VectorModelItemType;
@@ -149,6 +151,17 @@ export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentMode
permission: DatasetPermission;
};
/* ================= tag ===================== */
export type DatasetTagType = {
_id: string;
tag: string;
};
export type TagUsageType = {
tagId: string;
collections: string[];
};
/* ================= collection ===================== */
export type DatasetCollectionItemType = CollectionWithDatasetType & {
sourceName: string;

View File

@@ -32,7 +32,7 @@ export type PluginItemSchema = {
export type PluginTemplateType = PluginRuntimeType & {
author?: string;
id: string;
source: `${PluginSourceEnum}`;
source: PluginSourceEnum;
templateType: FlowNodeTemplateType['templateType'];
intro: string;
version: string;

View File

@@ -4,6 +4,10 @@ export enum FlowNodeTemplateTypeEnum {
function = 'function',
tools = 'tools',
search = 'search',
multimodal = 'multimodal',
communication = 'communication',
other = 'other',
teamApp = 'teamApp'
}
@@ -71,6 +75,8 @@ export enum NodeInputKeyEnum {
aiChatQuoteTemplate = 'quoteTemplate',
aiChatQuotePrompt = 'quotePrompt',
aiChatDatasetQuote = 'quoteQA',
aiChatVision = 'aiChatVision',
stringQuoteText = 'stringQuoteText',
// dataset
datasetSelectList = 'datasets',
@@ -81,6 +87,7 @@ export enum NodeInputKeyEnum {
datasetSearchUsingExtensionQuery = 'datasetSearchUsingExtensionQuery',
datasetSearchExtensionModel = 'datasetSearchExtensionModel',
datasetSearchExtensionBg = 'datasetSearchExtensionBg',
collectionFilterMatch = 'collectionFilterMatch',
// concat dataset
datasetQuoteList = 'system_datasetQuoteList',
@@ -113,7 +120,10 @@ export enum NodeInputKeyEnum {
// code
code = 'code',
codeType = 'codeType' // js|py
codeType = 'codeType', // js|py
// read files
fileUrlList = 'fileUrlList'
}
export enum NodeOutputKeyEnum {
@@ -128,6 +138,9 @@ export enum NodeOutputKeyEnum {
addOutputParam = 'system_addOutputParam',
rawResponse = 'system_rawResponse',
// start
userFiles = 'userFiles',
// dataset
datasetQuoteQA = 'quoteQA',

View File

@@ -117,7 +117,8 @@ export enum FlowNodeTypeEnum {
variableUpdate = 'variableUpdate',
code = 'code',
textEditor = 'textEditor',
customFeedback = 'customFeedback'
customFeedback = 'customFeedback',
readFiles = 'readFiles'
}
// node IO value type

View File

@@ -16,10 +16,12 @@ import { UserModelSchema } from '../../../support/user/type';
import { AppDetailType, AppSchema } from '../../app/type';
import { RuntimeNodeItemType } from '../runtime/type';
import { RuntimeEdgeItemType } from './edge';
import { ReadFileNodeResponse } from '../template/system/readFiles/type';
/* workflow props */
export type ChatDispatchProps = {
res?: NextApiResponse;
requestOrigin?: string;
mode: 'test' | 'chat' | 'debug';
teamId: string;
tmbId: string;
@@ -30,6 +32,7 @@ export type ChatDispatchProps = {
histories: ChatItemType[];
variables: Record<string, any>; // global variable
query: UserChatItemValueItemType[]; // trigger query
chatConfig: AppSchema['chatConfig'];
stream: boolean;
detail: boolean; // response detail
maxRunTimes: number;
@@ -67,11 +70,12 @@ export type RuntimeNodeItemType = {
};
export type PluginRuntimeType = {
id: string;
teamId?: string;
name: string;
avatar: string;
showStatus?: boolean;
isTool?: boolean;
currentCost?: number;
nodes: StoreNodeItemType[];
edges: StoreEdgeItemType[];
};
@@ -145,6 +149,10 @@ export type DispatchNodeResponseType = {
// plugin
pluginOutput?: Record<string, any>;
// read files
readFilesResult?: string;
readFiles?: ReadFileNodeResponse;
};
export type DispatchNodeResultType<T> = {
@@ -165,4 +173,6 @@ export type AIChatNodeProps = {
[NodeInputKeyEnum.aiChatIsResponseText]: boolean;
[NodeInputKeyEnum.aiChatQuoteTemplate]?: string;
[NodeInputKeyEnum.aiChatQuotePrompt]?: string;
[NodeInputKeyEnum.aiChatVision]?: boolean;
[NodeInputKeyEnum.stringQuoteText]?: string;
};

View File

@@ -25,6 +25,7 @@ import { VariableUpdateNode } from './system/variableUpdate';
import { CodeNode } from './system/sandbox';
import { TextEditorNode } from './system/textEditor';
import { CustomFeedbackNode } from './system/customFeedback';
import { ReadFilesNodes } from './system/readFiles';
const systemNodes: FlowNodeTemplateType[] = [
AiChatModule,
@@ -36,6 +37,7 @@ const systemNodes: FlowNodeTemplateType[] = [
StopToolNode,
ClassifyQuestionModule,
ContextExtractModule,
ReadFilesNodes,
HttpNode468,
AiQueryExtension,
LafModule,

View File

@@ -3,6 +3,7 @@ import { FlowNodeInputTypeEnum } from '../node/constant';
import { WorkflowIOValueTypeEnum } from '../constants';
import { chatNodeSystemPromptTip } from './tip';
import { FlowNodeInputItemType } from '../type/io';
import { i18nT } from '../../../../web/i18n/utils';
export const Input_Template_History: FlowNodeInputItemType = {
key: NodeInputKeyEnum.history,
@@ -64,3 +65,11 @@ export const Input_Template_Dataset_Quote: FlowNodeInputItemType = {
description: '',
valueType: WorkflowIOValueTypeEnum.datasetQuote
};
export const Input_Template_Text_Quote: FlowNodeInputItemType = {
key: NodeInputKeyEnum.stringQuoteText,
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
label: i18nT('app:document_quote'),
debugLabel: i18nT('app:document_quote'),
description: i18nT('app:document_quote_tip'),
valueType: WorkflowIOValueTypeEnum.string
};

View File

@@ -15,10 +15,12 @@ import {
Input_Template_Dataset_Quote,
Input_Template_History,
Input_Template_System_Prompt,
Input_Template_UserChatInput
Input_Template_UserChatInput,
Input_Template_Text_Quote
} from '../input';
import { chatNodeSystemPromptTip } from '../tip';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const AiChatModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.chatNode,
@@ -26,9 +28,9 @@ export const AiChatModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.chatNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/AI.png',
name: 'AI 对话',
intro: 'AI 大模型对话',
avatar: 'core/workflow/template/aiChat',
name: i18nT('workflow:template.ai_chat'),
intro: i18nT('workflow:template.ai_chat_intro'),
showStatus: true,
isTool: true,
version: '481',
@@ -40,20 +42,14 @@ export const AiChatModule: FlowNodeTemplateType = {
renderTypeList: [FlowNodeInputTypeEnum.hidden], // Set in the pop-up window
label: '',
value: 0,
valueType: WorkflowIOValueTypeEnum.number,
min: 0,
max: 10,
step: 1
valueType: WorkflowIOValueTypeEnum.number
},
{
key: NodeInputKeyEnum.aiChatMaxToken,
renderTypeList: [FlowNodeInputTypeEnum.hidden], // Set in the pop-up window
label: '',
value: 2000,
valueType: WorkflowIOValueTypeEnum.number,
min: 100,
max: 4000,
step: 50
valueType: WorkflowIOValueTypeEnum.number
},
{
key: NodeInputKeyEnum.aiChatIsResponseText,
@@ -74,6 +70,13 @@ export const AiChatModule: FlowNodeTemplateType = {
label: '',
valueType: WorkflowIOValueTypeEnum.string
},
{
key: NodeInputKeyEnum.aiChatVision,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: true
},
// settings modal ---
{
...Input_Template_System_Prompt,
@@ -82,8 +85,9 @@ export const AiChatModule: FlowNodeTemplateType = {
placeholder: chatNodeSystemPromptTip
},
Input_Template_History,
{ ...Input_Template_UserChatInput, toolDescription: '用户问题' },
Input_Template_Dataset_Quote
Input_Template_Dataset_Quote,
Input_Template_Text_Quote,
{ ...Input_Template_UserChatInput, toolDescription: '用户问题' }
],
outputs: [
{

View File

@@ -13,7 +13,7 @@ export const AssignedAnswerModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.answerNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/reply.png',
avatar: 'core/workflow/template/reply',
name: '指定回复',
intro:
'该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。',

View File

@@ -25,7 +25,7 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.classifyQuestion,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, false, true, true),
avatar: '/imgs/workflow/cq.png',
avatar: 'core/workflow/template/questionClassify',
name: '问题分类',
intro: `根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品“使用”问题\n类型3: 关于商品“购买”问题\n类型4: 其他问题`,
showStatus: true,

View File

@@ -20,7 +20,7 @@ export const ContextExtractModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.contentExtract,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/extract.png',
avatar: 'core/workflow/template/extractJson',
name: '文本内容提取',
intro: '可从文本中提取指定的数据例如sql语句、搜索关键词、代码等',
showStatus: true,

View File

@@ -13,7 +13,7 @@ export const CustomFeedbackNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.customFeedback,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/customFeedback.svg',
avatar: 'core/workflow/template/customFeedback',
name: '自定义反馈',
intro: '该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。',
version: '486',

View File

@@ -37,7 +37,7 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
templateType: FlowNodeTemplateTypeEnum.other,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/concat.svg',
avatar: 'core/workflow/template/datasetConcat',
name: '知识库搜索引用合并',
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
showStatus: false,

View File

@@ -13,9 +13,9 @@ import {
import { Input_Template_UserChatInput } from '../input';
import { DatasetSearchModeEnum } from '../../../dataset/constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const Dataset_SEARCH_DESC =
'调用“语义检索”和“全文检索”能力,从“知识库”中查找可能与问题相关的参考内容';
export const Dataset_SEARCH_DESC = i18nT('workflow:template.dataset_search_intro');
export const DatasetSearchModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.datasetSearchNode,
@@ -23,8 +23,8 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.datasetSearchNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/db.png',
name: '知识库搜索',
avatar: 'core/workflow/template/datasetSearch',
name: i18nT('workflow:template.dataset_search'),
intro: Dataset_SEARCH_DESC,
showStatus: true,
isTool: true,
@@ -90,6 +90,25 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
{
...Input_Template_UserChatInput,
toolDescription: '需要检索的内容'
},
{
key: NodeInputKeyEnum.collectionFilterMatch,
renderTypeList: [FlowNodeInputTypeEnum.JSONEditor, FlowNodeInputTypeEnum.reference],
label: '集合元数据过滤',
valueType: WorkflowIOValueTypeEnum.object,
isPro: true,
description: `目前支持标签和创建时间过滤,需按照以下格式填写:
{
"tags": {
"$and": ["标签 1","标签 2"],
"$or": ["有 $and 标签时and 生效or 不生效"]
},
"createTime": {
"$gte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间",
"$lte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用"
}
}
`
}
],
outputs: [

View File

@@ -20,7 +20,7 @@ export const HttpNode468: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.httpRequest468,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/http.png',
avatar: 'core/workflow/template/httpRequest',
name: 'HTTP 请求',
intro: '可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)',
showStatus: true,

View File

@@ -18,7 +18,7 @@ export const IfElseNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.ifElseNode,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, false, true, true),
avatar: '/imgs/workflow/ifElse.svg',
avatar: 'core/workflow/template/ifelse',
name: '判断器',
intro: '根据一定的条件,执行不同的分支。',
showStatus: true,

View File

@@ -26,7 +26,7 @@ export const LafModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.lafModule,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/laf.png',
avatar: 'core/workflow/template/lafDispatch',
name: 'Laf 函数调用(测试)',
intro: '可以调用Laf账号下的云函数。',
showStatus: true,

View File

@@ -11,7 +11,7 @@ export const PluginInputModule: FlowNodeTemplateType = {
targetHandle: getHandleConfig(false, false, false, false),
unique: true,
forbidDelete: true,
avatar: '/imgs/workflow/input.png',
avatar: 'core/workflow/template/workflowStart',
name: '插件输入',
intro: '可以配置插件需要哪些输入,利用这些输入来运行插件',
showStatus: false,

View File

@@ -11,7 +11,7 @@ export const PluginOutputModule: FlowNodeTemplateType = {
targetHandle: getHandleConfig(false, false, false, true),
unique: true,
forbidDelete: true,
avatar: '/imgs/workflow/output.png',
avatar: 'core/workflow/template/pluginOutput',
name: '自定义插件输出',
intro: '自定义配置外部输出,使用插件时,仅暴露自定义配置的输出',
showStatus: false,

View File

@@ -24,7 +24,7 @@ export const AiQueryExtension: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.queryExtension,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/cfr.svg',
avatar: 'core/workflow/template/queryExtension',
name: '问题优化',
intro:
'使用问题优化功能,可以提高知识库连续对话时搜索的精度。使用该功能后,会先利用 AI 根据上下文构建一个或多个新的检索词,这些检索词更利于进行知识库搜索。该模块已内置在知识库搜索模块中,如果您仅进行一次知识库搜索,可直接使用知识库内置的补全功能。',

View File

@@ -0,0 +1,48 @@
import { i18nT } from '../../../../../../web/i18n/utils';
import {
FlowNodeTemplateTypeEnum,
NodeInputKeyEnum,
NodeOutputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../../constants';
import {
FlowNodeInputTypeEnum,
FlowNodeOutputTypeEnum,
FlowNodeTypeEnum
} from '../../../node/constant';
import { FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const ReadFilesNodes: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.readFiles,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.readFiles,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: 'core/app/simpleMode/file',
name: i18nT('app:workflow.read_files'),
intro: i18nT('app:workflow.read_files_tip'),
showStatus: true,
version: '489',
isTool: true,
inputs: [
{
key: NodeInputKeyEnum.fileUrlList,
renderTypeList: [FlowNodeInputTypeEnum.reference],
valueType: WorkflowIOValueTypeEnum.arrayString,
label: i18nT('app:workflow.file_url'),
required: true,
value: []
}
],
outputs: [
{
id: NodeOutputKeyEnum.text,
key: NodeOutputKeyEnum.text,
label: i18nT('app:workflow.read_files_result'),
description: i18nT('app:workflow.read_files_result_desc'),
valueType: WorkflowIOValueTypeEnum.string,
type: FlowNodeOutputTypeEnum.static
}
]
};

View File

@@ -0,0 +1,4 @@
export type ReadFileNodeResponse = {
url: string;
name: string;
}[];

View File

@@ -19,7 +19,7 @@ export const RunAppModule: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.runApp,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/app.png',
avatar: 'core/workflow/template/runApp',
name: '应用调用',
intro: '可以选择一个其他应用进行调用',
showStatus: true,

View File

@@ -21,7 +21,7 @@ export const CodeNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.code,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/code.svg',
avatar: 'core/workflow/template/codeRun',
name: '代码运行',
intro: '执行一段简单的脚本代码,通常用于进行复杂的数据处理。',
showStatus: true,

View File

@@ -9,7 +9,7 @@ export const StopToolNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.stopTool,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/toolStop.svg',
avatar: 'core/workflow/template/stopTool',
name: '工具调用终止',
intro:
'该模块需配置工具调用使用。当该模块被执行时本次工具调用将会强制结束并且不再调用AI针对工具调用结果回答问题。',

View File

@@ -2,6 +2,7 @@ import { FlowNodeTypeEnum } from '../../node/constant';
import { FlowNodeTemplateType } from '../../type/node.d';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const SystemConfigNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.systemConfig,
@@ -9,9 +10,9 @@ export const SystemConfigNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.systemConfig,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
avatar: '/imgs/workflow/userGuide.png',
name: '系统配置',
intro: '可以配置应用的系统参数。',
avatar: 'core/workflow/template/systemConfig',
name: i18nT('workflow:template.system_config'),
intro: '',
unique: true,
forbidDelete: true,
version: '481',

View File

@@ -19,7 +19,7 @@ export const TextEditorNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.textEditor,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/textEditor.svg',
avatar: 'core/workflow/template/textConcat',
name: '文本拼接',
intro: '可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。',
version: '486',

View File

@@ -19,6 +19,7 @@ import {
import { chatNodeSystemPromptTip } from '../tip';
import { LLMModelTypeEnum } from '../../../ai/constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const ToolModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.tools,
@@ -26,9 +27,9 @@ export const ToolModule: FlowNodeTemplateType = {
templateType: FlowNodeTemplateTypeEnum.ai,
sourceHandle: getHandleConfig(true, true, false, true),
targetHandle: getHandleConfig(true, true, false, true),
avatar: '/imgs/workflow/tool.svg',
name: '工具调用',
intro: '通过AI模型自动选择一个或多个功能块进行调用也可以对插件进行调用。',
avatar: 'core/workflow/template/toolCall',
name: i18nT('workflow:template.tool_call'),
intro: i18nT('workflow:template.tool_call_intro'),
showStatus: true,
version: '481',
inputs: [
@@ -41,21 +42,23 @@ export const ToolModule: FlowNodeTemplateType = {
renderTypeList: [FlowNodeInputTypeEnum.hidden], // Set in the pop-up window
label: '',
value: 0,
valueType: WorkflowIOValueTypeEnum.number,
min: 0,
max: 10,
step: 1
valueType: WorkflowIOValueTypeEnum.number
},
{
key: NodeInputKeyEnum.aiChatMaxToken,
renderTypeList: [FlowNodeInputTypeEnum.hidden], // Set in the pop-up window
label: '',
value: 2000,
valueType: WorkflowIOValueTypeEnum.number,
min: 100,
max: 4000,
step: 50
valueType: WorkflowIOValueTypeEnum.number
},
{
key: NodeInputKeyEnum.aiChatVision,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: true
},
{
...Input_Template_System_Prompt,
label: 'core.ai.Prompt',

View File

@@ -13,7 +13,7 @@ export const VariableUpdateNode: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.variableUpdate,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
avatar: '/imgs/workflow/variable.png',
avatar: 'core/workflow/template/variableUpdate',
name: '变量更新',
intro: '可以更新指定节点的输出值或更新全局变量',
showStatus: false,

View File

@@ -7,6 +7,17 @@ import {
} from '../../constants';
import { getHandleConfig } from '../utils';
import { Input_Template_UserChatInput } from '../input';
import { i18nT } from '../../../../../web/i18n/utils';
import { FlowNodeOutputItemType } from '../../type/io';
export const userFilesInput: FlowNodeOutputItemType = {
id: NodeOutputKeyEnum.userFiles,
key: NodeOutputKeyEnum.userFiles,
label: i18nT('app:workflow.user_file_input'),
description: i18nT('app:workflow.user_file_input_desc'),
type: FlowNodeOutputTypeEnum.static,
valueType: WorkflowIOValueTypeEnum.arrayString
};
export const WorkflowStart: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.workflowStart,
@@ -14,8 +25,8 @@ export const WorkflowStart: FlowNodeTemplateType = {
flowNodeType: FlowNodeTypeEnum.workflowStart,
sourceHandle: getHandleConfig(false, true, false, false),
targetHandle: getHandleConfig(false, false, false, false),
avatar: '/imgs/workflow/userChatInput.svg',
name: '流程开始',
avatar: 'core/workflow/template/workflowStart',
name: i18nT('workflow:template.workflow_start'),
intro: '',
forbidDelete: true,
unique: true,
@@ -25,7 +36,7 @@ export const WorkflowStart: FlowNodeTemplateType = {
{
id: NodeOutputKeyEnum.userChatInput,
key: NodeOutputKeyEnum.userChatInput,
label: 'core.module.input.label.user question',
label: i18nT('common:core.module.input.label.user question'),
type: FlowNodeOutputTypeEnum.static,
valueType: WorkflowIOValueTypeEnum.string
}

View File

@@ -35,6 +35,7 @@ export type WorkflowTemplateType = {
avatar: string;
intro?: string;
author?: string;
inputExplanationUrl?: string;
version: string;
showStatus?: boolean;
@@ -42,17 +43,29 @@ export type WorkflowTemplateType = {
workflow: WorkflowTemplateBasicType;
};
// template market
export type TemplateMarketItemType = WorkflowTemplateType & {
tags?: { id: string; label: string }[];
};
// system plugin
export type SystemPluginTemplateItemType = WorkflowTemplateType & {
templateType: FlowNodeTemplateTypeEnum;
isTool?: boolean;
// commercial plugin config
originCost: number; // n points/one time
currentCost: number;
isActive?: boolean;
inputConfig?: {
// Render config input form. Find the corresponding node and replace the variable directly
key: string;
label: string;
description: string;
value?: any;
}[];
workflow: WorkflowTemplateBasicType;
};

View File

@@ -52,6 +52,7 @@ export type FlowNodeInputItemType = InputComponentPropsType & {
// render components params
canEdit?: boolean; // dynamic inputs
isPro?: boolean; // Pro version field
};
export type FlowNodeOutputItemType = {

Some files were not shown because too many files have changed in this diff Show More