diff --git a/.github/imgs/logo.svg b/.github/imgs/logo.svg index 2a4b1e7a9606..493dee344325 100644 --- a/.github/imgs/logo.svg +++ b/.github/imgs/logo.svg @@ -1,14 +1,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index e74fe91f78e1..6a4c0944ce37 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,6 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b - 🌍 海外版:[fastgpt.in](https://fastgpt.in/) -fastgpt.run 域名会弃用。 - | | | | ---------------------------------- | ---------------------------------- | | ![Demo](./.github/imgs/intro1.png) | ![Demo](./.github/imgs/intro2.png) | @@ -53,23 +51,21 @@ fastgpt.run 域名会弃用。 `1` 应用编排能力 - [x] 提供简易模式,无需操作编排 - - [x] 对话下一步指引 - [x] 工作流编排 - [x] 源文件引用追踪 - [x] 模块封装,实现多级复用 - - [x] 混合检索 & 重排 - [x] Tool 模块 - - [ ] 嵌入 [Laf](https://github.com/labring/laf),实现在线编写 HTTP 模块 + - [ ] 嵌入 [Laf](https://github.com/labring/laf),实现在线编写 HTTP 模块。初版已完成。 - [ ] 插件封装功能,支持低代码渲染 `2` 知识库能力 - [x] 多库复用,混用 - [x] chunk 记录修改和删除 - - [x] 支持知识库单独设置向量模型 - [x] 源文件存储 - [x] 支持手动输入,直接分段,QA 拆分导入 - - [x] 支持。txt, 。md, 。html, 。pdf, 。docx,pptx, 。csv, 。xlsx (有需要更多可 PR file loader) + - [x] 支持 txt,md,html,pdf,docx,pptx,csv,xlsx (有需要更多可 PR file loader) - [x] 支持 url 读取、CSV 批量导入 + - [x] 混合检索 & 重排 - [ ] 支持文件阅读器 - [ ] 更多的数据预处理方案 @@ -90,6 +86,8 @@ fastgpt.run 域名会弃用。 - [x] Iframe 一键嵌入 - [x] 聊天窗口嵌入支持自定义 Icon,默认打开,拖拽等功能 - [x] 统一查阅对话记录,并对数据进行标注 +`6` 其他 + - [x] 支持语音输入和输出 (可配置语音输入语音回答) # diff --git a/docSite/assets/imgs/laf4.png b/docSite/assets/imgs/laf4.png new file mode 100644 index 000000000000..1f729d4e1366 Binary files /dev/null and b/docSite/assets/imgs/laf4.png differ diff --git a/docSite/assets/imgs/laf4.webp b/docSite/assets/imgs/laf4.webp deleted file mode 100644 index 0aae869a18f6..000000000000 Binary files a/docSite/assets/imgs/laf4.webp and /dev/null differ diff --git a/docSite/content/docs/development/custom-models/bge-rerank.md b/docSite/content/docs/development/custom-models/bge-rerank.md index bc09bd3e7a84..ab30356a50fd 100644 --- a/docSite/content/docs/development/custom-models/bge-rerank.md +++ b/docSite/content/docs/development/custom-models/bge-rerank.md @@ -31,9 +31,9 @@ weight: 910 3 个模型代码分别为: -1. [https://github.com/labring/FastGPT/tree/main/python/reranker/bge-reranker-base](https://github.com/labring/FastGPT/tree/main/python/reranker/bge-reranker-base) -2. [https://github.com/labring/FastGPT/tree/main/python/reranker/bge-reranker-large](https://github.com/labring/FastGPT/tree/main/python/reranker/bge-reranker-large) -3. [https://github.com/labring/FastGPT/tree/main/python/reranker/bge-rerank-v2-m3](https://github.com/labring/FastGPT/tree/main/python/reranker/bge-rerank-v2-m3) +1. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-base](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-base) +2. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-large](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-reranker-large) +3. [https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-rerank-v2-m3](https://github.com/labring/FastGPT/tree/main/python/bge-rerank/bge-rerank-v2-m3) ### 3. 安装依赖 diff --git a/docSite/content/docs/workflow/modules/laf.md b/docSite/content/docs/workflow/modules/laf.md index e04d968f218e..084d6905a8de 100644 --- a/docSite/content/docs/workflow/modules/laf.md +++ b/docSite/content/docs/workflow/modules/laf.md @@ -1,59 +1,53 @@ --- title: "Laf 函数调用" description: "FastGPT Laf 函数调用模块介绍" -icon: "Laf" +icon: "code" draft: false toc: true weight: 355 --- -## 特点 - -- 可重复添加 -- 有外部输入 -- 手动配置 -- 触发执行 -- 核中核模块 ![](/imgs/laf1.webp) ## 介绍 -Laf 函数调用模块可以调用 Laf 账号下的云函数,其操作与 HTTP 模块相同,可以理解为封装了请求 Laf 云函数的 http 模块,值得注意的不同之处为: +`Laf 函数调用`模块可以调用 Laf 账号下的云函数,其工作原理与 HTTP 模块相同,有以下特殊特征: - 只能使用 POST 请求 -- 请求自带系统参数 systemParams +- 请求自带系统参数 systemParams,无需通过变量传递。 -## 具体使用 +## 绑定 Laf 账号 -要能调用 Laf 云函数,首先需要绑定 Laf 账号和应用,并且在应用中创建云函数。 +要调用 Laf 云函数,首先需要绑定 Laf 账号和应用,并且在应用中创建云函数。 Laf 提供了 PAT(访问凭证) 来实现 Laf 平台外的快捷登录,可以访问 [Laf 文档](https://doc.Laf.run/zh/cli/#%E7%99%BB%E5%BD%95)查看详细如何获取 PAT。 -在获取到 PAT 后,我们可以进入 fastgpt 的账号页或是直接在高级编排中使用 Laf 模块,填入 PAT 验证后,选择需要绑定的应用(应用需要是 Running 状态),即可调用 Laf 云函数。 +在获取到 PAT 后,我们可以进入 FastGPT 的`账号页`或是在高级编排中的 `Laf模块` 对 Laf 账号进行绑定。Laf 账号是团队共享的,仅团队管理员可配置。 + +填入 PAT 验证后,选择需要绑定的应用(应用需要是 Running 状态),即可调用该应用下的云函数。 > 如果需要解绑则取消绑定后,点击“更新”即可 ![](/imgs/laf2.webp) -为了更便捷地调用 Laf 云函数,可以参照下面的代码编写云函数,以便 openAPI 识别 +## 编写云函数 -```ts -import cloud from '@Lafjs/cloud' +Laf 云函数拥有根据 interface 自动生成 OpenAPI 的能力,可以参照下面的代码编写云函数,以便自动生成 OpenAPI 文档。 -interface IRequestBody { - username: string // 用户名 - passwd?: string // 密码 -} +`Laf模块`可以根据 OpenAPI 文档,自动识别出入参,无需手动添加数据类型。如果不会写 TS,可忽略,手动在 FastGPT 中添加参数即可。 + +```ts +import cloud from '@lafjs/cloud' -interface IResponse { - message: string // 返回信息 - data: any // 返回数据 +interface IRequestBody { // 自定义入参,FastGPT 传入的均为POST请求。 + data1: string // 必填参数 + data2?: string // 可选参数 } -type extendedBody = IRequestBody & { - systemParams?: { - appId: string, +interface RequestProps extends IRequestBody { // 完整入参,这个无需改动。 + systemParams: { // 这是FastGPT默认会传递过来的参数 + appId: string, variables: string, histories: string, cTime: string, @@ -62,27 +56,45 @@ type extendedBody = IRequestBody & { } } +interface IResponse { // 响应内容 + message: string // 必返回的参数 + msg?: string; // 可选的返回参数 +} + export default async function (ctx: FunctionContext): Promise { - const body: extendedBody = ctx.body; + const { + data1, + data2, + systemParams + }: RequestProps = ctx.body; - console.log(body.systemParams.chatId); + console.log({ + data1, + data2, + systemParams + }); return { message: 'ok', - data: '查找到用户名为' + body.username + '的用户' + msg: 'msg' }; } ``` +当然,你也可以在 Laf 平台上选择 fastgpt_template,快速生成该函数模板。 + 具体操作可以是,进入 Laf 的函数页面,新建函数(注意 fastgpt 只会调用 post 请求的函数),然后复制上面的代码或者点击更多模板搜索“fastgpt”,使用下面的模板 ![](/imgs/laf3.webp) -这样就能直接通过点击“同步参数”,一键填写输入输出 +## FastGPT 中使用 + +在选择函数后,可以通过点击“同步参数”,自动同步云函数的参数到 FastGPT 中。当然也可以手动添加,手动修改后的参数不会被“同步参数”修改。 + +![](/imgs/laf4.png) -![](/imgs/laf4.webp) +## 使用注意事项 -当然也可以手动添加,手动修改后的参数不会被“同步参数”修改 +### 调用报错 -## 作用 -Laf 账号是绑定在团队上的,团队的成员可以轻松调用已经编写好的云函数 +先在 laf 中调试函数,看是否正常调用。可以通过 console.log,打印入参,将入参放在 Laf 测试页面的 Body 中进行测试。 \ No newline at end of file diff --git a/projects/app/src/components/core/app/TTSSelect.tsx b/projects/app/src/components/core/app/TTSSelect.tsx index 777c18286d9b..affabafb18ff 100644 --- a/projects/app/src/components/core/app/TTSSelect.tsx +++ b/projects/app/src/components/core/app/TTSSelect.tsx @@ -72,6 +72,11 @@ const TTSSelect = ({ [audioSpeechModelList, onChange, value] ); + const onCloseTTSModal = useCallback(() => { + cancelAudio(); + onClose(); + }, [cancelAudio, onClose]); + return ( @@ -100,7 +105,7 @@ const TTSSelect = ({ } isOpen={isOpen} - onClose={onClose} + onClose={onCloseTTSModal} w={'500px'} > diff --git a/projects/app/src/components/core/module/Flow/components/nodes/NodeLaf.tsx b/projects/app/src/components/core/module/Flow/components/nodes/NodeLaf.tsx index d03d64968e99..411bea84314b 100644 --- a/projects/app/src/components/core/module/Flow/components/nodes/NodeLaf.tsx +++ b/projects/app/src/components/core/module/Flow/components/nodes/NodeLaf.tsx @@ -232,7 +232,7 @@ const NodeLaf = (props: NodeProps) => { ); if (!lafFunction) return; - const url = `${feConfigs.lafEnv}/app/${lafData?.lafApp?.appid}/function${lafFunction?.path}`; + const url = `${feConfigs.lafEnv}/app/${lafData?.lafApp?.appid}/function${lafFunction?.path}?templateid=fastgptflow`; window.open(url, '_blank'); }} > diff --git a/projects/app/src/components/support/laf/LafAccountModal.tsx b/projects/app/src/components/support/laf/LafAccountModal.tsx index 29473f374f45..c6b6227eb2a9 100644 --- a/projects/app/src/components/support/laf/LafAccountModal.tsx +++ b/projects/app/src/components/support/laf/LafAccountModal.tsx @@ -13,6 +13,7 @@ import { useUserStore } from '@/web/support/user/useUserStore'; import type { LafAccountType } from '@fastgpt/global/support/user/team/type.d'; import { postLafPat2Token, getLafApplications } from '@/web/support/laf/api'; import { getErrText } from '@fastgpt/global/common/error/utils'; +import { getDocPath } from '@/web/common/system/doc'; const LafAccountModal = ({ defaultData = { @@ -100,7 +101,7 @@ const LafAccountModal = ({ {t('support.user.Laf account intro')} - + {t('support.user.Laf account course')} @@ -171,12 +172,14 @@ const LafAccountModal = ({ )} - - + {appid && ( + + )} ); diff --git a/projects/app/src/pages/app/detail/components/OutLink/SelectUsingWayModal.tsx b/projects/app/src/pages/app/detail/components/OutLink/SelectUsingWayModal.tsx index a4f2447776e6..81ceebbe35da 100644 --- a/projects/app/src/pages/app/detail/components/OutLink/SelectUsingWayModal.tsx +++ b/projects/app/src/pages/app/detail/components/OutLink/SelectUsingWayModal.tsx @@ -102,7 +102,7 @@ const SelectUsingWayModal = ({ share, onClose }: { share: OutLinkSchema; onClose data-open-icon="${getValues('scriptOpenIcon')}" data-close-icon="${getValues('scriptCloseIcon')}" defer -/> +> ` diff --git a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx index 3991064461ba..516d26fbea23 100644 --- a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx +++ b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx @@ -80,7 +80,7 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => { alignItems={'center'} justifyContent={'center'} > - {'icon'} + {'icon'} {feConfigs?.systemTitle}