fix: import dataset step error;perf: ai proxy avatar (#4074)

* perf: pg config params

* perf: ai proxy avatar

* fix: import dataset step error

* feat: data input ux

* perf: app dataset rewite
This commit is contained in:
Archer
2025-03-11 14:04:48 +08:00
committed by archer
parent 92b2ecc381
commit 3f794baf2e
37 changed files with 503 additions and 392 deletions

View File

@@ -199,8 +199,6 @@ const UsageTable = () => {
[
t,
dateRange,
usageTab,
unit,
userInfo?.team?.permission.hasManagePer,
tmbList,
selectTmbIds,

View File

@@ -18,7 +18,7 @@ import { isProduction } from '@fastgpt/global/common/system/constants';
import * as fs from 'fs';
import { llmCompletionsBodyFormat } from '@fastgpt/service/core/ai/utils';
export type testQuery = { model: string };
export type testQuery = { model: string; channelId?: string };
export type testBody = {};
@@ -30,7 +30,7 @@ async function handler(
): Promise<testResponse> {
await authSystemAdmin({ req });
const { model } = req.query;
const { model, channelId } = req.query;
const modelData = findModelFromAlldata(model);
if (!modelData) return Promise.reject('Model not found');
@@ -65,8 +65,7 @@ const testLLMModel = async (model: LLMModelItemType) => {
{
model: model.model,
messages: [{ role: 'user', content: 'hi' }],
stream: false,
max_tokens: 10
stream: false
},
model
);

View File

@@ -13,10 +13,18 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
Promise.reject(CommonErrEnum.missingParams);
}
// 凭证校验
const { app } = await authApp({ req, authToken: true, appId, per: ReadPermissionVal });
const teamId = app.teamId;
const { app, teamId, isRoot } = await authApp({
req,
authToken: true,
appId,
per: ReadPermissionVal
});
await rewriteAppWorkflowToDetail(app.modules, teamId);
await rewriteAppWorkflowToDetail({
nodes: app.modules,
teamId,
isRoot
});
if (!app.permission.hasWritePer) {
return {

View File

@@ -6,6 +6,7 @@ import { WritePermissionVal } from '@fastgpt/global/support/permission/constant'
import { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
import { formatTime2YMDHM } from '@fastgpt/global/common/string/time';
import { checkNode } from '@/service/core/app/utils';
import { rewriteAppWorkflowToDetail } from '@fastgpt/service/core/app/utils';
type Props = {
versionId: string;
@@ -18,13 +19,24 @@ async function handler(
): Promise<AppVersionSchemaType> {
const { versionId, appId } = req.query as Props;
const { app } = await authApp({ req, authToken: true, appId, per: WritePermissionVal });
const { app, teamId, isRoot } = await authApp({
req,
authToken: true,
appId,
per: WritePermissionVal
});
const result = await MongoAppVersion.findById(versionId).lean();
if (!result) {
return Promise.reject('version not found');
}
await rewriteAppWorkflowToDetail({
nodes: result.nodes,
teamId,
isRoot
});
return {
...result,
nodes: await Promise.all(

View File

@@ -24,16 +24,18 @@ async function handler(
req: ApiRequestProps<getLatestVersionBody, getLatestVersionQuery>,
res: ApiResponseType<any>
): Promise<getLatestVersionResponse> {
const { app } = await authApp({
const { app, isRoot, teamId } = await authApp({
req,
authToken: true,
appId: req.query.appId,
per: WritePermissionVal
});
const teamId = app.teamId;
await rewriteAppWorkflowToDetail(app.modules, teamId);
await rewriteAppWorkflowToDetail({
nodes: app.modules,
teamId,
isRoot
});
return getAppLatestVersion(req.query.appId, app);
}