-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* save toast * perf: surya ocr * perf: remove same model name * fix: indexes * perf: ip check * feat: Fixed the version number of the subapplication * feat: simple app get latest child version * perf: update child dispatch variables * feat: variables update doc
- Loading branch information
Showing
34 changed files
with
398 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { AppSchema } from '@fastgpt/global/core/app/type'; | ||
import { MongoAppVersion } from './schema'; | ||
import { Types } from '../../../common/mongo'; | ||
|
||
export const getAppLatestVersion = async (appId: string, app?: AppSchema) => { | ||
const version = await MongoAppVersion.findOne({ | ||
appId, | ||
isPublish: true | ||
}) | ||
.sort({ | ||
time: -1 | ||
}) | ||
.lean(); | ||
|
||
if (version) { | ||
return { | ||
versionId: version._id, | ||
nodes: version.nodes, | ||
edges: version.edges, | ||
chatConfig: version.chatConfig || app?.chatConfig || {} | ||
}; | ||
} | ||
return { | ||
versionId: app?.pluginData?.nodeVersion, | ||
nodes: app?.modules || [], | ||
edges: app?.edges || [], | ||
chatConfig: app?.chatConfig || {} | ||
}; | ||
}; | ||
|
||
export const getAppVersionById = async ({ | ||
appId, | ||
versionId, | ||
app | ||
}: { | ||
appId: string; | ||
versionId?: string; | ||
app?: AppSchema; | ||
}) => { | ||
// 检查 versionId 是否符合 ObjectId 格式 | ||
if (versionId && Types.ObjectId.isValid(versionId)) { | ||
const version = await MongoAppVersion.findOne({ | ||
_id: versionId, | ||
appId | ||
}).lean(); | ||
|
||
if (version) { | ||
return { | ||
versionId: version._id, | ||
nodes: version.nodes, | ||
edges: version.edges, | ||
chatConfig: version.chatConfig || app?.chatConfig || {} | ||
}; | ||
} | ||
} | ||
|
||
// If the version does not exist, the latest version is returned | ||
return getAppLatestVersion(appId, app); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.