* model config

* feat: model config ui

* perf: rename variable

* feat: custom request url

* perf: model buffer

* perf: init model

* feat: json model config

* auto login

* fix: ts

* update packages

* package

* fix: dockerfile
This commit is contained in:
Archer
2025-01-22 22:59:28 +08:00
committed by GitHub
parent 16629e32a7
commit e009be51e7
93 changed files with 2361 additions and 564 deletions

View File

@@ -5,6 +5,10 @@ import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
import { AuthModeType, AuthResponseType } from '../type';
import { NullPermission } from '@fastgpt/global/support/permission/constant';
import { TeamPermission } from '@fastgpt/global/support/permission/user/controller';
import { authCert } from '../auth/common';
import { MongoUser } from '../../user/schema';
import { ERROR_ENUM } from '@fastgpt/global/common/error/errorCode';
import { ApiRequestProps } from '../../../type/next';
/* auth user role */
export async function authUserPer(props: AuthModeType): Promise<
@@ -34,3 +38,19 @@ export async function authUserPer(props: AuthModeType): Promise<
tmb
};
}
export const authSystemAdmin = async ({ req }: { req: ApiRequestProps }) => {
try {
const result = await authCert({ req, authToken: true });
const user = await MongoUser.findOne({
_id: result.userId
});
if (user && user.username !== 'root') {
return Promise.reject(ERROR_ENUM.unAuthorization);
}
return result;
} catch (error) {
throw error;
}
};

View File

@@ -1,5 +1,5 @@
import { LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
import { ModelTypeEnum, getModelMap } from '../../../core/ai/model';
import { findAIModel } from '../../../core/ai/model';
import { ModelTypeEnum } from '@fastgpt/global/core/ai/model';
export const formatModelChars2Points = ({
model,
@@ -14,7 +14,7 @@ export const formatModelChars2Points = ({
modelType: `${ModelTypeEnum}`;
multiple?: number;
}) => {
const modelData = getModelMap?.[modelType]?.(model) as LLMModelItemType;
const modelData = findAIModel(model);
if (!modelData) {
return {
totalPoints: 0,