V4.6.9-first commit (#899)

* perf: insert mongo dataset data session

* perf: dataset data index

* remove delay

* rename bill schema

* rename bill record

* perf: bill table

* perf: prompt

* perf: sub plan

* change the usage count

* feat: usage bill

* publish usages

* doc

* 新增团队聊天功能 (#20)

* perf: doc

* feat 添加标签部分

feat 信息团队标签配置

feat 新增团队同步管理

feat team分享页面

feat 完成team分享页面

feat 实现模糊搜索

style 格式化

fix 修复迷糊匹配

style 样式修改

fix 团队标签功能修复

* fix 修复鉴权功能

* merge 合并代码

* fix 修复引用错误

* fix 修复pr问题

* fix 修复ts格式问题

---------

Co-authored-by: archer <545436317@qq.com>
Co-authored-by: liuxingwan <liuxingwan.lxw@alibaba-inc.com>

* update extra plan

* fix: ts

* format

* perf: bill field

* feat: standard plan

* fix: ts

* feat 个人账号页面修改 (#22)

* feat 添加标签部分

feat 信息团队标签配置

feat 新增团队同步管理

feat team分享页面

feat 完成team分享页面

feat 实现模糊搜索

style 格式化

fix 修复迷糊匹配

style 样式修改

fix 团队标签功能修复

* fix 修复鉴权功能

* merge 合并代码

* fix 修复引用错误

* fix 修复pr问题

* fix 修复ts格式问题

* feat 修改个人账号页

---------

Co-authored-by: liuxingwan <liuxingwan.lxw@alibaba-inc.com>

* sub plan page (#23)

* fix chunk index; error page text

* feat: dataset process Integral prediction

* feat: stand plan field

* feat: sub plan limit

* perf: index

* query extension

* perf: share link push app name

* perf: plan point unit

* perf: get sub plan

* perf: account page

* feat 新增套餐详情弹窗代码 (#24)

* merge 合并代码

* fix 新增套餐详情弹框

* fix 修复pr问题

* feat: change http node input to prompt editor (#21)

* feat: change http node input to prompt editor

* fix

* split PromptEditor to HttpInput

* Team plans (#25)

* perf: pay check

* perf: team plan test

* plan limit check

* replace sensitive text

* perf: fix some null

* collection null check

* perf: plans modal

* perf: http module

* pacakge (#26)

* individuation page and pay modal amount (#27)

* feat: individuation page

* team chat config

* pay modal

* plan count and replace invalid chars (#29)

* fix: user oneapi

* fix: training queue

* fix: qa queue

* perf: remove space chars

* replace invalid chars

* change httpinput dropdown menu (#28)

* perf: http

* reseet free plan

* perf: plan code to packages

* remove llm config to package

* perf: code

* perf: faq

* fix: get team plan

---------

Co-authored-by: yst <77910600+yu-and-liu@users.noreply.github.com>
Co-authored-by: liuxingwan <liuxingwan.lxw@alibaba-inc.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-02-28 13:19:15 +08:00
committed by GitHub
parent 32686f9e3e
commit 064c64e74c
282 changed files with 7223 additions and 4731 deletions

View File

@@ -15,6 +15,7 @@ export const getMyApps = () => GET<AppListItemType[]>('/core/app/list');
*/
export const postCreateApp = (data: CreateAppParams) => POST<string>('/core/app/create', data);
export const getMyAppsByTags = (data: {}) => POST(`/proApi/core/chat/team/getApps`, data);
/**
* 根据 ID 删除模型
*/
@@ -30,7 +31,12 @@ export const getModelById = (id: string) => GET<AppDetailType>(`/core/app/detail
*/
export const putAppById = (id: string, data: AppUpdateParams) =>
PUT(`/core/app/update?appId=${id}`, data);
export const replaceAppById = (id: string, data: AppUpdateParams) =>
PUT(`/core/app/updateTeamTasg?appId=${id}`, data);
// updateTeamTasg
export const putAppTagsById = (id: string, data: AppUpdateParams) =>
PUT(`/core/app/updateTeamTasg?appId=${id}`, data);
/* 共享市场 */
/**
* 获取共享市场模型

View File

@@ -1,7 +1,7 @@
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import { getMyApps, getModelById, putAppById } from '@/web/core/app/api';
import { getMyApps, getModelById, putAppById, replaceAppById } from '@/web/core/app/api';
import { defaultApp } from '@/constants/app';
import type { AppUpdateParams } from '@fastgpt/global/core/app/api.d';
import { AppDetailType, AppListItemType } from '@fastgpt/global/core/app/type.d';
@@ -12,6 +12,7 @@ type State = {
appDetail: AppDetailType;
loadAppDetail: (id: string, init?: boolean) => Promise<AppDetailType>;
updateAppDetail(appId: string, data: AppUpdateParams): Promise<void>;
replaceAppDetail(appId: string, data: AppUpdateParams): Promise<void>;
clearAppModules(): void;
};
@@ -47,6 +48,15 @@ export const useAppStore = create<State>()(
};
});
},
async replaceAppDetail(appId: string, data: AppUpdateParams) {
await replaceAppById(appId, { ...get().appDetail, ...data });
set((state) => {
state.appDetail = {
...state.appDetail,
...data
};
});
},
clearAppModules() {
set((state) => {
state.appDetail = {

View File

@@ -121,13 +121,13 @@ export const appTemplates: (AppItemType & {
},
{
key: 'model',
type: 'selectChatModel',
type: 'selectLLMModel',
label: 'core.module.input.label.aiModel',
required: true,
valueType: 'string',
showTargetInApp: false,
showTargetInPlugin: false,
value: 'gpt-3.5-turbo-16k',
value: 'gpt-3.5-turbo',
connected: false
},
{
@@ -569,7 +569,7 @@ export const appTemplates: (AppItemType & {
},
{
key: 'model',
type: 'selectChatModel',
type: 'selectLLMModel',
label: 'core.module.input.label.aiModel',
required: true,
valueType: 'string',
@@ -882,13 +882,13 @@ export const appTemplates: (AppItemType & {
},
{
key: 'model',
type: 'selectChatModel',
type: 'selectLLMModel',
label: 'core.module.input.label.aiModel',
required: true,
valueType: 'string',
showTargetInApp: false,
showTargetInPlugin: false,
value: 'gpt-3.5-turbo-16k',
value: 'gpt-3.5-turbo',
connected: false
},
{
@@ -1115,7 +1115,7 @@ export const appTemplates: (AppItemType & {
},
{
key: 'model',
type: 'selectCQModel',
type: 'selectLLMModel',
valueType: 'string',
label: 'core.module.input.label.Classify model',
required: true,
@@ -1345,7 +1345,7 @@ export const appTemplates: (AppItemType & {
},
{
key: 'model',
type: 'selectChatModel',
type: 'selectLLMModel',
label: 'core.module.input.label.aiModel',
required: true,
valueType: 'string',

View File

@@ -1,5 +1,6 @@
import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
import type { ChatHistoryItemType } from '@fastgpt/global/core/chat/type.d';
import type { ChatHistoryItemType, chatAppListSchema } from '@fastgpt/global/core/chat/type.d';
import type {
CloseCustomFeedbackParams,
InitChatProps,
@@ -16,13 +17,31 @@ import type {
} from '@/global/core/chat/api.d';
import { UpdateChatFeedbackProps } from '@fastgpt/global/core/chat/api';
/**
* 根据队伍ID和获取
*/
export const getChatListById = (data: { shareTeamId: string; authToken: string }) =>
POST<chatAppListSchema>(`/proApi/core/chat/init`, data);
/**
* 获取团队分享的对话列表 initTeamChat
* @param data
* @returns
*/
export const getinitTeamChat = (data: { teamId: string; authToken: string; appId: string }) =>
GET(`/proApi/core/chat/initTeamChat`, data);
/**
* 获取初始化聊天内容
*/
export const getInitChatInfo = (data: InitChatProps) =>
GET<InitChatResponse>(`/core/chat/init`, data);
export const getInitChatInfoTeam = (data: InitChatProps) =>
GET<InitChatResponse>(`/core/chat/init`, data);
export const getInitOutLinkChatInfo = (data: InitOutLinkChatProps) =>
GET<InitChatResponse>(`/core/chat/outLink/init`, data);
export const getTeamChatInfo = (data: { appId: string; chatId: string; outLinkUid?: string }) =>
GET<InitChatResponse>(`/core/chat/team/init`, data);
/**
* get current window history(appid or shareId)

View File

@@ -0,0 +1,42 @@
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import type { ChatHistoryItemType } from '@fastgpt/global/core/chat/type.d';
import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet(
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWSYZ1234567890_',
24
);
type State = {
localUId: string;
teamShareChatHistory: (ChatHistoryItemType & { delete?: boolean })[];
clearLocalHistory: (shareId?: string) => void;
};
export const useTeamShareChatStore = create<State>()(
devtools(
persist(
immer((set, get) => ({
localUId: `shareChat-${Date.now()}-${nanoid()}`,
teamShareChatHistory: [], // old version field
clearLocalHistory() {
// abandon
set((state) => {
state.teamShareChatHistory = state.teamShareChatHistory.map((item) => ({
...item,
delete: true
}));
});
}
})),
{
name: 'shareChatStore',
partialize: (state) => ({
localUId: state.localUId,
shareChatHistory: state.teamShareChatHistory
})
}
)
)
);

View File

@@ -12,7 +12,7 @@ import {
import { defaultDatasetDetail } from '@/constants/dataset';
import type { DatasetUpdateBody } from '@fastgpt/global/core/dataset/api.d';
import { DatasetStatusEnum } from '@fastgpt/global/core/dataset/constants';
import { postCreateTrainingBill } from '@/web/support/wallet/bill/api';
import { postCreateTrainingUsage } from '@/web/support/wallet/usage/api';
import { checkTeamWebSyncLimit } from '@/web/support/user/team/api';
type State = {
@@ -89,19 +89,17 @@ export const useDatasetStore = create<State>()(
async startWebsiteSync() {
await checkTeamWebSyncLimit();
const [_, billId] = await Promise.all([
const billId = await postCreateTrainingUsage({
name: 'core.dataset.training.Website Sync',
datasetId: get().datasetDetail._id
});
return postWebsiteSync({ datasetId: get().datasetDetail._id, billId }).then(() => {
get().updateDataset({
id: get().datasetDetail._id,
status: DatasetStatusEnum.syncing
}),
postCreateTrainingBill({
name: 'core.dataset.training.Website Sync',
datasetId: get().datasetDetail._id
})
]);
try {
postWebsiteSync({ datasetId: get().datasetDetail._id, billId });
} catch (error) {}
});
});
}
})),
{

View File

@@ -68,12 +68,6 @@ export async function chunksUpload({
});
}
// add chunk index
chunks = chunks.map((chunk) => ({
...chunk,
chunkIndex: chunk.chunkIndex
}));
let successInsert = 0;
let retryTimes = 10;
for (let i = 0; i < chunks.length; i += rate) {

View File

@@ -13,7 +13,7 @@ import { RunAppModule } from '@fastgpt/global/core/module/template/system/runApp
import { PluginInputModule } from '@fastgpt/global/core/module/template/system/pluginInput';
import { PluginOutputModule } from '@fastgpt/global/core/module/template/system/pluginOutput';
import { RunPluginModule } from '@fastgpt/global/core/module/template/system/runPlugin';
import { AiCFR } from '@fastgpt/global/core/module/template/system/coreferenceResolution';
import { AiQueryExtension } from '@fastgpt/global/core/module/template/system/queryExtension';
import type {
FlowModuleTemplateType,
@@ -31,7 +31,8 @@ export const appSystemModuleTemplates: FlowModuleTemplateType[] = [
RunAppModule,
ClassifyQuestionModule,
ContextExtractModule,
HttpModule468
HttpModule468,
AiQueryExtension
];
export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
PluginInputModule,
@@ -43,7 +44,8 @@ export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
RunAppModule,
ClassifyQuestionModule,
ContextExtractModule,
HttpModule468
HttpModule468,
AiQueryExtension
];
export const moduleTemplatesFlat: FlowModuleTemplateType[] = [
@@ -61,7 +63,7 @@ export const moduleTemplatesFlat: FlowModuleTemplateType[] = [
PluginInputModule,
PluginOutputModule,
RunPluginModule,
AiCFR
AiQueryExtension
];
export const moduleTemplatesList: moduleTemplateListType = [