Skip to content

Commit

Permalink
perf: btn color (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Oct 24, 2023
1 parent bf6dbfb commit 1942cb0
Show file tree
Hide file tree
Showing 41 changed files with 350 additions and 221 deletions.
File renamed without changes
Binary file modified docSite/assets/imgs/getfile_id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docSite/content/docs/development/openApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ data: [{"moduleName":"KB Search","price":1.2000000000000002,"model":"Embedding-2
此部分 API 需使用全局通用的 API Key。
{{% /alert %}}

| 如何获取知识库ID(kbId| 如何获取文件ID(file_id) |
| 如何获取知识库ID(datasetId| 如何获取文件ID(file_id) |
| --------------------- | --------------------- |
| ![](/imgs/getKbId.png) | ![](/imgs/getfile_id.png) |
| ![](/imgs/getDatasetId.png) | ![](/imgs/getfile_id.png) |


### 知识库添加数据
Expand All @@ -241,7 +241,7 @@ curl --location --request POST 'https://fastgpt.run/api/core/dataset/data/pushDa
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
    "kbId": "64663f451ba1676dbdef0499",
    "collectionId": "64663f451ba1676dbdef0499",
"mode": "index",
"prompt": "qa 拆分引导词,index 模式下可以忽略",
"billId": "可选。如果有这个值,本次的数据会被聚合到一个订单中,这个值可以重复使用。可以参考 [创建训练订单] 获取该值。",
Expand All @@ -268,7 +268,7 @@ curl --location --request POST 'https://fastgpt.run/api/core/dataset/data/pushDa

```json
{
"kbId": "知识库的ID,可以在知识库详情查看。",
"collectionId": "文件的ID,参考上面的第二张图",
"mode": "index | qa ", // index 模式: 直接将 q 转成向量存起来,a 直接入库。qa 模式: 只关注 data 里的 q,将 q 丢给大模型,让其根据 prompt 拆分成 qa 问答对。
"prompt": "拆分提示词,需严格按照模板,建议不要传入。",
"data": [
Expand Down Expand Up @@ -351,7 +351,7 @@ curl --location --request POST 'https://fastgpt.run/api/core/dataset/searchTest'
--header 'Authorization: Bearer apiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
"kbId": "xxxxx",
"datasetId": "知识库的ID",
"text": "导演是谁"
}'
```
Expand Down
4 changes: 4 additions & 0 deletions docSite/content/docs/installation/upgrading/45.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ALTER EXTENSION vector UPDATE;
alter system set maintenance_work_mem = '2400MB';
select pg_reload_conf();

-- 重构数据库索引和排序
REINDEX DATABASE postgres;
ALTER DATABASE postgres REFRESH COLLATION VERSION;

-- 开始构建索引,该索引构建时间非常久,直接点击右上角的叉,退出 Terminal 即可
CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip_ops) WITH (m = 16, ef_construction = 64);
-- 可以再次点击一键链接,进入 Terminal,输入下方命令,如果看到 "vector_index" hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64') 则代表构建完成(注意,后面没有 INVALID)
Expand Down
2 changes: 1 addition & 1 deletion docSite/content/docs/installation/upgrading/451.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ curl --location --request POST 'https://{{host}}/api/admin/initv451' \

1. 新增知识库文件夹管理
2. 修复了 openai4.x sdk 无法兼容 oneapi 的智谱和阿里的接口。

3. 修复部分模块无法触发完成事件
31 changes: 29 additions & 2 deletions projects/app/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"UnKnow": "UnKnow",
"Warning": "Warning",
"app": {
"AI Advanced Settings": "Advanced Settings",
"AI Settings": "AI Settings",
"Advance App TestTip": "The current application is advanced editing mode \n. If you need to switch to [simple mode], please click the save button on the left",
"App Detail": "App Detail",
"Basic Settings": "Basic Settings",
"Chat Debug": "Chat Debug",
"Chat Logs Tips": "Logs record the app's online, shared, and API(chatId is existing) conversations",
"Chat logs": "Chat Logs",
"Confirm Del App Tip": "Confirm to delete the app and all its chats",
Expand All @@ -38,6 +41,7 @@
"Logs Title": "Title",
"Mark Count": "Mark Count",
"My Apps": "My Apps",
"Open AI Advanced Settings": "Advanced Settings",
"Output Field Settings": "Output Field Settings",
"Paste Config": "Paste Config",
"Variable Key Repeat Tip": "Variable Key Repeat",
Expand Down Expand Up @@ -106,6 +110,7 @@
},
"common": {
"Add": "Add",
"Choose": "Choose",
"Close": "Clow",
"Collect": "Collect",
"Confirm Move": "Move here",
Expand All @@ -131,6 +136,7 @@
"Name is empty": "Name is empty",
"Next Step": "Next",
"Output": "Output",
"Params": "Params",
"Password inconsistency": "Password inconsistency",
"Rename": "Rename",
"Rename Failed": "Rename Failed",
Expand All @@ -151,10 +157,30 @@
"folder": {
"Drag Tip": "Click and move",
"Move Success": "Move Success",
"No Folder": "No Folder",
"No Folder": "There's no subdirectory. Just put it here",
"Root Path": "Root Folder"
}
},
"core": {
"ai": {
"Model": "Model",
"Prompt": "Prompt"
},
"app": {
"Next Step Guide": "Next step guide"
},
"chat": {
"Restart": "Restart"
},
"dataset": {
"Choose Dataset": "Chookse Dataset",
"Dataset": "Dataset",
"Read Dataset": "Read Dataset",
"Search Top K": "Top K",
"Set Empty Result Tip": ",Response empty text",
"Similarity": "Similarity"
}
},
"dataset": {
"Chunk Length": "Chunk Length",
"Confirm move the folder": "Confirm Move",
Expand Down Expand Up @@ -189,6 +215,7 @@
"Click to view folder": "To Folder",
"Collection Embedding": "{{total}}Embedding",
"Confirm to delete the folder": "Are you sure to delete this folder and all its contents?",
"Create And Import": "Create/Import",
"Create Training Data": "Training-{{filename}}",
"Create Virtual File Success": "Create Virtual File Success",
"Data Amount": "Data Amount",
Expand All @@ -208,7 +235,7 @@
"deleteFolderTips": "Are you sure to delete this folder and all the knowledge bases it contains? Data cannot be recovered after deletion, please confirm!"
},
"file": {
"Click to download CSV template": "Click to download CSV template",
"Click to download file template": "Download Template: {{name}}",
"Click to view file": "Click to view file",
"Create File": "Create File",
"Create file": "Create file",
Expand Down
33 changes: 30 additions & 3 deletions projects/app/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"UnKnow": "未知",
"Warning": "提示",
"app": {
"AI Settings": "AI 高级配置",
"AI Advanced Settings": "AI 高级配置",
"AI Settings": "AI 配置",
"Advance App TestTip": "当前应用为高级编排模式\n如需切换为【简易模式】请点击左侧保存按键",
"App Detail": "应用详情",
"Basic Settings": "基本信息",
"Chat Debug": "调试预览",
"Chat Logs Tips": "日志会记录该应用的在线、分享和 API(需填写 chatId) 对话记录",
"Chat logs": "对话日志",
"Confirm Del App Tip": "确认删除该应用及其所有聊天记录?",
Expand All @@ -38,6 +41,7 @@
"Logs Title": "标题",
"Mark Count": "标注答案数量",
"My Apps": "我的应用",
"Open AI Advanced Settings": "高级配置",
"Output Field Settings": "输出字段编辑",
"Paste Config": "粘贴配置",
"Variable Key Repeat Tip": "变量 key 重复",
Expand Down Expand Up @@ -106,6 +110,7 @@
},
"common": {
"Add": "添加",
"Choose": "选择",
"Close": "关闭",
"Collect": "收藏",
"Confirm Move": "移动到这",
Expand All @@ -131,6 +136,7 @@
"Name is empty": "名称不能为空",
"Next Step": "下一步",
"Output": "输出",
"Params": "参数",
"Password inconsistency": "两次密码不一致",
"Rename": "重命名",
"Rename Failed": "重命名失败",
Expand All @@ -151,10 +157,30 @@
"folder": {
"Drag Tip": "点我可拖动",
"Move Success": "移动成功",
"No Folder": "这个目录空空的~",
"No Folder": "没有子目录了,就放这里吧",
"Root Path": "根目录"
}
},
"core": {
"ai": {
"Model": "AI 模型",
"Prompt": "提示词"
},
"app": {
"Next Step Guide": "下一步指引"
},
"chat": {
"Restart": "重开对话"
},
"dataset": {
"Choose Dataset": "关联知识库",
"Dataset": "知识库",
"Read Dataset": "查看知识库详情",
"Search Top K": "单次搜索数量",
"Set Empty Result Tip": ",未搜索到内容时回复指定内容",
"Similarity": "相似度"
}
},
"dataset": {
"Chunk Length": "数据总量",
"Confirm move the folder": "确认移动到该目录",
Expand Down Expand Up @@ -189,6 +215,7 @@
"Click to view folder": "进入目录",
"Collection Embedding": "{{total}}组索引中",
"Confirm to delete the folder": "确认删除该文件夹及里面所有内容?",
"Create And Import": "新建/导入",
"Create Training Data": "文件训练-{{filename}}",
"Create Virtual File Success": "创建虚拟文件成功",
"Data Amount": "数据总量",
Expand All @@ -208,7 +235,7 @@
"deleteFolderTips": "确认删除该文件夹及其包含的所有知识库?删除后数据无法恢复,请确认!"
},
"file": {
"Click to download CSV template": "点击下载 CSV 模板",
"Click to download file template": "点击下载模板:{{name}}",
"Click to view file": "点击查看原始文件",
"Create File": "创建新文件",
"Create file": "创建文件",
Expand Down
1 change: 1 addition & 0 deletions projects/app/src/components/Icon/icons/core/app/aiFill.svg
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.
4 changes: 3 additions & 1 deletion projects/app/src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ const iconPaths = {
moveLight: () => import('./icons/light/move.svg'),
questionGuide: () => import('./icons/app/questionGuide.svg'),
loading: () => import('./icons/light/loading.svg'),
pause: () => import('./icons/common/pause.svg')
pause: () => import('./icons/common/pause.svg'),
'core/app/aiLight': () => import('./icons/core/app/aiLight.svg'),
'core/app/aiFill': () => import('./icons/core/app/aiFill.svg')
};

export type IconName = keyof typeof iconPaths;
Expand Down
4 changes: 2 additions & 2 deletions projects/app/src/components/Layout/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const Navbar = ({ unread }: { unread: number }) => {
},
{
label: t('navbar.Apps'),
icon: 'appLight',
activeIcon: 'appFill',
icon: 'core/app/aiLight',
activeIcon: 'core/app/aiFill',
link: `/app/list`,
activeLink: ['/app/list', '/app/detail']
},
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/components/Layout/navbarPhone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => {
},
{
label: t('navbar.Apps'),
icon: 'tabbarModel',
icon: 'core/app/aiLight',
link: `/app/list`,
activeLink: ['/app/list', '/app/detail'],
unread: 0
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/components/MyModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const MyModal = ({
title,
children,
isCentered,
w = '100%',
w = 'auto',
maxW = ['90vw', '600px'],
...props
}: Props) => {
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/components/core/dataset/SelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const DatasetSelectContainer = ({
</Box>
)}
</ModalHeader>
{children}
<Box flex={'1 0 0'}>{children}</Box>
</Flex>
</MyModal>
);
Expand Down
4 changes: 2 additions & 2 deletions projects/app/src/constants/flow/ModuleTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ export const appTemplates: (AppItemType & {
key: 'userChatInput'
},
{
moduleId: 'kbSearch',
moduleId: 'datasetSearch',
key: 'userChatInput'
}
]
Expand Down Expand Up @@ -898,7 +898,7 @@ export const appTemplates: (AppItemType & {
]
},
{
moduleId: 'kbSearch',
moduleId: 'datasetSearch',
name: '知识库搜索',
flowType: 'datasetSearchNode',
showStatus: true,
Expand Down
3 changes: 1 addition & 2 deletions projects/app/src/constants/flow/flowField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export enum ContextExtractEnum {

export enum HttpPropsEnum {
url = 'url',
failed = 'failed',
finish = 'finish'
failed = 'failed'
}
13 changes: 12 additions & 1 deletion projects/app/src/pages/api/app/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { authUser } from '@fastgpt/service/support/user/auth';
import { App } from '@/service/models/app';
import type { AppUpdateParams } from '@/types/app';
import { authApp } from '@/service/utils/auth';
import { SystemOutputEnum } from '@/constants/app';

/* 获取我的模型 */
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
Expand Down Expand Up @@ -40,7 +41,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
'share.isShare': share.isShare,
'share.isShareDetail': share.isShareDetail
}),
...(modules && { modules })
...(modules && {
modules: modules.map((modules) => ({
...modules,
outputs: modules.outputs.sort((a, b) => {
// finish output always at last
if (a.key === SystemOutputEnum.finish) return 1;
if (b.key === SystemOutputEnum.finish) return -1;
return 0;
})
}))
})
}
);

Expand Down
9 changes: 6 additions & 3 deletions projects/app/src/pages/api/v1/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { pushChatBill } from '@/service/common/bill/push';
import { BillSourceEnum } from '@/constants/user';
import { ChatHistoryItemResType } from '@/types/chat';
import type { UserModelSchema } from '@fastgpt/global/support/user/type';
import { SystemInputEnum } from '@/constants/app';
import { SystemInputEnum, SystemOutputEnum } from '@/constants/app';
import { getSystemTime } from '@fastgpt/global/common/time/timezone';
import { authOutLinkChat } from '@fastgpt/service/support/outLink/auth';
import { pushResult2Remote, updateOutLinkUsage } from '@fastgpt/service/support/outLink/tools';
Expand Down Expand Up @@ -431,7 +431,7 @@ export async function dispatchModules({
inputs: params
};

const dispatchRes = await (async () => {
const dispatchRes: Record<string, any> = await (async () => {
const callbackMap: Record<string, Function> = {
[FlowModuleTypeEnum.historyNode]: dispatchHistory,
[FlowModuleTypeEnum.questionInput]: dispatchChatInput,
Expand All @@ -449,7 +449,10 @@ export async function dispatchModules({
return {};
})();

return moduleOutput(module, dispatchRes);
return moduleOutput(module, {
[SystemOutputEnum.finish]: true,
...dispatchRes
});
}

// start process width initInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const AIChatSettingsModal = ({
isOpen
title={
<Flex alignItems={'flex-end'}>
{t('app.AI Settings')}
{t('app.AI Advanced Settings')}
{feConfigs?.show_doc && (
<Link
href={`${feConfigs.docUrl}/docs/use-cases/ai_settings/`}
Expand Down
Loading

0 comments on commit 1942cb0

Please sign in to comment.