forked from labring/FastGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
400 changed files
with
9,476 additions
and
4,822 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public-hoist-pattern[]=*tiktoken* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
// 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 { ReactNode } from 'react';", | ||
"import { createContext } from 'use-context-selector';", | ||
"", | ||
"type ContextType = {$1};", | ||
"", | ||
"export const Context = createContext<ContextType>({});", | ||
"", | ||
"export const ContextProvider = ({ children }: { children: ReactNode }) => {", | ||
" const contextValue: ContextType = {};", | ||
" return <Context.Provider value={contextValue}>{children}</Context.Provider>;", | ||
"};", | ||
], | ||
"description": "FastGPT usecontext template" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ ENV PYTHON /usr/bin/python3 | |
RUN [ -z "$proxy" ] || pnpm config set registry https://registry.npmmirror.com | ||
|
||
# copy packages and one project | ||
COPY pnpm-lock.yaml pnpm-workspace.yaml ./ | ||
COPY pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ | ||
COPY ./packages ./packages | ||
COPY ./projects/$name/package.json ./projects/$name/package.json | ||
|
||
|
@@ -35,7 +35,7 @@ ARG name | |
ARG proxy | ||
|
||
# copy common node_modules and one project node_modules | ||
COPY package.json pnpm-workspace.yaml ./ | ||
COPY package.json pnpm-workspace.yaml .npmrc ./ | ||
COPY --from=mainDeps /app/node_modules ./node_modules | ||
COPY --from=mainDeps /app/packages ./packages | ||
COPY ./projects/$name ./projects/$name | ||
|
@@ -44,6 +44,8 @@ COPY --from=mainDeps /app/projects/$name/node_modules ./projects/$name/node_modu | |
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
|
||
RUN apk add --no-cache libc6-compat && npm install -g [email protected] | ||
|
||
ENV NODE_OPTIONS="--max-old-space-size=4096" | ||
RUN pnpm --filter=$name build | ||
|
||
# --------- runner ----------- | ||
|
@@ -70,6 +72,11 @@ COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/static /app/ | |
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/server/chunks /app/projects/$name/.next/server/chunks | ||
# copy worker | ||
COPY --from=builder --chown=nextjs:nodejs /app/projects/$name/.next/server/worker /app/projects/$name/.next/server/worker | ||
|
||
# copy tiktoken but not copy ./node_modules/tiktoken/encoders | ||
COPY --from=mainDeps /app/node_modules/tiktoken ./node_modules/tiktoken | ||
RUN rm -rf ./node_modules/tiktoken/encoders | ||
|
||
# copy package.json to version file | ||
COPY --from=builder /app/projects/$name/package.json ./package.json | ||
# copy config | ||
|
@@ -87,4 +94,4 @@ USER nextjs | |
|
||
ENV serverPath=./projects/$name/server.js | ||
|
||
ENTRYPOINT ["sh","-c","node ${serverPath}"] | ||
ENTRYPOINT ["sh","-c","node --max-old-space-size=4096 ${serverPath}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
title: "对话问题引导" | ||
description: "FastGPT 对话问题引导" | ||
icon: "code" | ||
draft: false | ||
toc: true | ||
weight: 350 | ||
--- | ||
|
||
![](/imgs/questionGuide.png) | ||
|
||
## 什么是自定义问题引导 | ||
|
||
你可以为你的应用提前预设一些问题,用户在输入时,会根据输入的内容,动态搜索这些问题作为提示,从而引导用户更快的进行提问。 | ||
|
||
你可以直接在 FastGPT 中配置词库,或者提供自定义词库接口。 | ||
|
||
## 自定义词库接口 | ||
|
||
需要保证这个接口可以被用户浏览器访问。 | ||
|
||
**请求:** | ||
|
||
```bash | ||
curl --location --request GET 'http://localhost:3000/api/core/chat/inputGuide/query?appId=663c75302caf8315b1c00194&searchKey=你' | ||
``` | ||
|
||
其中 `appId` 为应用ID,`searchKey` 为搜索关键字,最多是50个字符。 | ||
|
||
**响应** | ||
|
||
```json | ||
{ | ||
"code": 200, | ||
"statusText": "", | ||
"message": "", | ||
"data": [ | ||
"是你", | ||
"你是谁呀", | ||
"你好好呀", | ||
"你好呀", | ||
"你是谁!", | ||
"你好" | ||
] | ||
} | ||
``` | ||
|
||
data是一个数组,包含了搜索到的问题,最多只需要返回5个问题。 | ||
|
||
|
||
**参数说明:** | ||
|
||
- appId - 应用ID | ||
- searchKey - 搜索关键字 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: '外部文件知识库' | ||
description: 'FastGPT 外部文件知识库功能介绍和使用方式' | ||
icon: 'language' | ||
draft: false | ||
toc: true | ||
weight: 107 | ||
--- | ||
|
||
外部文件库是 FastGPT 商业版特有功能。它允许接入你现在的文件系统,无需将文件再导入一份到 FastGPT 中。 | ||
|
||
并且,阅读权限可以通过你的文件系统进行控制。 | ||
|
||
| | | | | ||
| --------------------- | --------------------- | --------------------- | | ||
| ![](/imgs/external_file0.png) | ![](/imgs/external_file1.png) | ![](/imgs/external_file2.png) | | ||
|
||
|
||
## 导入参数说明 | ||
|
||
- 外部预览地址:用于跳转你的文件阅读地址,会携带“文件阅读ID”进行访问。 | ||
- 文件访问URL:文件可访问的地址。 | ||
- 文件阅读ID:通常情况下,文件访问URL是临时的。如果希望永久可以访问,你需要使用该文件阅读ID,并配合上“外部预览地址”,跳转至新的阅读地址进行原文件访问。 | ||
- 文件名:默认会自动解析文件访问URL上的文件名。如果你手动填写,将会以手动填写的值为准。 | ||
|
||
[点击查看API导入文档](/docs/development/openapi/dataset/#创建一个外部文件库集合商业版) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.