Refactor AI proxy error handling and remove deprecated upload and event routes

- Updated `getAiProxy` function to return a JSON response for missing objects when the user is the owner.
- Removed the `upload.ts`, `event.ts`, and related middleware files to streamline the codebase.
- Cleaned up `handle-request.ts` and `index.ts` by removing unused imports and routes.
- Deleted chunk upload handling and related utility functions to simplify resource management.
- Enhanced app manager list functionality to support app creation if not found.
This commit is contained in:
2026-02-02 18:06:31 +08:00
parent 82e3392b36
commit 158dd9e85c
14 changed files with 92 additions and 908 deletions

View File

@@ -98,10 +98,19 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
return true;
}
const stat = await oss.statObject(objectName);
if (!stat) {
createNotFoundPage('Invalid proxy url');
if (!stat && isOwner) {
// createNotFoundPage('文件不存在');
res.writeHead(200, { 'content-type': 'application/json' });
res.end(
JSON.stringify({
code: 404,
message: 'object not found',
}),
);
logger.debug('no stat', objectName, owner, req.url);
return true;
} else if (!stat && !isOwner) {
return createNotFoundPage('Invalid ai proxy url');
}
const permissionInstance = new UserPermission({ permission: stat.metaData as Permission, owner: owner });
const checkPermission = permissionInstance.checkPermissionSuccess({
@@ -112,6 +121,7 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
logger.info('no permission', checkPermission, loginUser, owner);
return createNotFoundPage('no permission');
}
if (showStat) {
res.writeHead(200, { 'content-type': 'application/json' });
res.end(