update pay function

This commit is contained in:
2025-11-22 09:16:12 +08:00
parent 7498e87d31
commit 092c86f3d2
5 changed files with 171 additions and 2 deletions

View File

@@ -138,11 +138,12 @@ export default function MCPChat() {
}
if (!isAuthenticated) {
const mainAppUrl = process.env.NEXT_PUBLIC_MAIN_APP_URL || 'https://valuefrontier.cn';
return (
<div className="flex flex-col items-center justify-center h-screen">
<h2 className="text-2xl mb-4"></h2>
<a
href={`${process.env.NEXT_PUBLIC_MAIN_APP_URL}/auth/sign-in?redirect=/chat`}
href={`${mainAppUrl}/auth/sign-in?redirect=/ai-chat`}
className="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700"
>

View File

@@ -22,8 +22,12 @@ export interface AuthInfo {
*/
export async function checkAuth(): Promise<AuthInfo> {
try {
// 使用硬编码的 URL 作为后备
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://49.232.185.254:5001';
console.log('API URL:', apiUrl); // 调试日志
// 调用主应用的 session 检查接口
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/auth/session`, {
const response = await fetch(`${apiUrl}/api/auth/session`, {
credentials: 'include', // 重要:携带 Cookie
headers: {
'Content-Type': 'application/json',