diff --git a/client/data/config.json b/client/data/config.json index c315ddd12..52adaf83a 100644 --- a/client/data/config.json +++ b/client/data/config.json @@ -65,7 +65,7 @@ }, "ExtractModel": { "model": "gpt-3.5-turbo-16k", - "functionCall": false, + "functionCall": true, "name": "GPT35-16k", "maxToken": 16000, "price": 0, @@ -73,7 +73,7 @@ }, "CQModel": { "model": "gpt-3.5-turbo-16k", - "functionCall": false, + "functionCall": true, "name": "GPT35-16k", "maxToken": 16000, "price": 0, diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 6d24c388e..22049a4ab 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -132,7 +132,8 @@ "Confirm to delete the data": "Confirm to delete the data?", "Export": "Export", "Queue Desc": "This data refers to the current amount of training for the entire system. FastGPT uses queued training, and if you have too much data to train, you may need to wait for a while", - "System Data Queue": "Data Queue" + "System Data Queue": "Data Queue", + "Training Name": "Dataset Training" }, "file": { "Click to download CSV template": "Click to download CSV template", diff --git a/client/public/locales/zh/common.json b/client/public/locales/zh/common.json index 368aa5aa1..1c8ecb60f 100644 --- a/client/public/locales/zh/common.json +++ b/client/public/locales/zh/common.json @@ -132,7 +132,8 @@ "Confirm to delete the data": "确认删除该数据?", "Export": "导出", "Queue Desc": "该数据是指整个系统当前待训练的数量。{{title}} 采用排队训练的方式,如果待训练的数据过多,可能需要等待一段时间", - "System Data Queue": "排队长度" + "System Data Queue": "排队长度", + "Training Name": "数据训练" }, "file": { "Click to download CSV template": "点击下载 CSV 模板", diff --git a/client/src/api/common/bill/index.d.ts b/client/src/api/common/bill/index.d.ts new file mode 100644 index 000000000..6957ee03b --- /dev/null +++ b/client/src/api/common/bill/index.d.ts @@ -0,0 +1,3 @@ +export type CreateTrainingBillType = { + name: string; +}; diff --git a/client/src/api/common/bill/index.ts b/client/src/api/common/bill/index.ts new file mode 100644 index 000000000..dddd64622 --- /dev/null +++ b/client/src/api/common/bill/index.ts @@ -0,0 +1,5 @@ +import { GET, POST, PUT, DELETE } from '@/api/request'; +import { CreateTrainingBillType } from './index.d'; + +export const postCreateTrainingBill = (data: CreateTrainingBillType) => + POST(`/common/bill/createTrainingBill`, data); diff --git a/client/src/api/core/dataset/data.d.ts b/client/src/api/core/dataset/data.d.ts index f0ed21cd4..f869a148c 100644 --- a/client/src/api/core/dataset/data.d.ts +++ b/client/src/api/core/dataset/data.d.ts @@ -7,6 +7,7 @@ export type PushDataProps = { data: DatasetItemType[]; mode: `${TrainingModeEnum}`; prompt?: string; + billId?: string; }; export type PushDataResponse = { insertLen: number; diff --git a/client/src/api/core/dataset/file.d.ts b/client/src/api/core/dataset/file.d.ts index 4cd2283d8..656343025 100644 --- a/client/src/api/core/dataset/file.d.ts +++ b/client/src/api/core/dataset/file.d.ts @@ -6,3 +6,5 @@ export type GetFileListProps = RequestPaging & { }; export type UpdateFileProps = { id: string; name?: string; datasetUsed?: boolean }; + +export type MarkFileUsedProps = { fileIds: string[] }; diff --git a/client/src/api/core/dataset/file.ts b/client/src/api/core/dataset/file.ts index 6dacafb2c..5468cf46d 100644 --- a/client/src/api/core/dataset/file.ts +++ b/client/src/api/core/dataset/file.ts @@ -2,7 +2,7 @@ import { GET, POST, PUT, DELETE } from '@/api/request'; import type { DatasetFileItemType } from '@/types/core/dataset/file'; import type { GSFileInfoType } from '@/types/common/file'; -import type { GetFileListProps, UpdateFileProps } from './file.d'; +import type { GetFileListProps, UpdateFileProps, MarkFileUsedProps } from './file.d'; export const getDatasetFiles = (data: GetFileListProps) => POST(`/core/dataset/file/list`, data); @@ -14,3 +14,6 @@ export const delDatasetEmptyFiles = (kbId: string) => DELETE(`/core/dataset/file/delEmptyFiles`, { kbId }); export const updateDatasetFile = (data: UpdateFileProps) => PUT(`/core/dataset/file/update`, data); + +export const putMarkFilesUsed = (data: MarkFileUsedProps) => + PUT(`/core/dataset/file/markUsed`, data); diff --git a/client/src/constants/user.ts b/client/src/constants/user.ts index 2cb6ff4fe..bee590ab2 100644 --- a/client/src/constants/user.ts +++ b/client/src/constants/user.ts @@ -5,7 +5,8 @@ export enum OAuthEnum { export enum BillSourceEnum { fastgpt = 'fastgpt', api = 'api', - shareLink = 'shareLink' + shareLink = 'shareLink', + training = 'training' } export enum PageTypeEnum { login = 'login', @@ -16,7 +17,8 @@ export enum PageTypeEnum { export const BillSourceMap: Record<`${BillSourceEnum}`, string> = { [BillSourceEnum.fastgpt]: '在线使用', [BillSourceEnum.api]: 'Api', - [BillSourceEnum.shareLink]: '免登录链接' + [BillSourceEnum.shareLink]: '免登录链接', + [BillSourceEnum.training]: '数据训练' }; export enum PromotionEnum { diff --git a/client/src/pages/account/components/BillDetail.tsx b/client/src/pages/account/components/BillDetail.tsx index a792223c2..651049ad8 100644 --- a/client/src/pages/account/components/BillDetail.tsx +++ b/client/src/pages/account/components/BillDetail.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { ModalBody, Flex, @@ -20,6 +20,10 @@ import { useTranslation } from 'react-i18next'; const BillDetail = ({ bill, onClose }: { bill: UserBillType; onClose: () => void }) => { const { t } = useTranslation(); + const filterBillList = useMemo( + () => bill.list.filter((item) => item && item.moduleName), + [bill.list] + ); return ( @@ -34,7 +38,7 @@ const BillDetail = ({ bill, onClose }: { bill: UserBillType; onClose: () => void 应用名: - {bill.appName} + {t(bill.appName) || '-'} 来源: @@ -59,7 +63,7 @@ const BillDetail = ({ bill, onClose }: { bill: UserBillType; onClose: () => void - {bill.list.map((item, i) => ( + {filterBillList.map((item, i) => ( {item.moduleName} {item.model} diff --git a/client/src/pages/account/components/BillTable.tsx b/client/src/pages/account/components/BillTable.tsx index 9a5190a12..3ebe6ad44 100644 --- a/client/src/pages/account/components/BillTable.tsx +++ b/client/src/pages/account/components/BillTable.tsx @@ -68,7 +68,7 @@ const BillTable = () => { {dayjs(item.time).format('YYYY/MM/DD HH:mm:ss')} {BillSourceMap[item.source]} - {item.appName || '-'} + {t(item.appName) || '-'} {item.total}元