作者 lyh

gx

@@ -70,6 +70,11 @@ class ChatLogic extends BaseLogic @@ -70,6 +70,11 @@ class ChatLogic extends BaseLogic
70 } 70 }
71 $data = ['message' => $message]; 71 $data = ['message' => $message];
72 $stream = $gptService->get_ai_chat($data); // 获取流 72 $stream = $gptService->get_ai_chat($data); // 获取流
  73 + // 允许跨域访问
  74 + header('Access-Control-Allow-Origin: *');
  75 + header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
  76 + header('Access-Control-Allow-Headers: Content-Type, Authorization');
  77 +
73 header('Content-Type: text/event-stream'); 78 header('Content-Type: text/event-stream');
74 header('Cache-Control: no-cache'); 79 header('Cache-Control: no-cache');
75 header('Connection: keep-alive'); 80 header('Connection: keep-alive');