feat: add ai proxy

This commit is contained in:
2025-05-23 11:09:54 +08:00
parent 28a5d82e52
commit 4d9df0fee3
6 changed files with 40 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
import { User } from '@/module/models.ts';
import http from 'http';
import cookie from 'cookie';
import { logger } from '@/module/logger.ts';
export const error = (msg: string, code = 500) => {
return JSON.stringify({ code, message: msg });
};
@@ -55,6 +56,7 @@ export const getLoginUser = async (req: http.IncomingMessage) => {
return null;
}
let tokenUser;
logger.debug('getLoginUser', token);
try {
tokenUser = await User.verifyToken(token);
return { tokenUser, token };