2ND
This commit is contained in:
@@ -49,11 +49,13 @@ def create_app(config_name=None):
|
||||
|
||||
# 載入配置
|
||||
config_name = config_name or os.getenv('FLASK_ENV', 'default')
|
||||
app.config.from_object(config[config_name])
|
||||
|
||||
# 載入 Dify API 配置
|
||||
# 先載入 Dify API 配置
|
||||
config[config_name].load_dify_config()
|
||||
|
||||
# 然後載入配置到 Flask app
|
||||
app.config.from_object(config[config_name])
|
||||
|
||||
# 初始化必要目錄
|
||||
config[config_name].init_directories()
|
||||
|
||||
@@ -92,7 +94,7 @@ def create_app(config_name=None):
|
||||
@app.after_request
|
||||
def after_request(response):
|
||||
origin = request.headers.get('Origin')
|
||||
allowed_origins = ['http://localhost:3000', 'http://127.0.0.1:3000']
|
||||
allowed_origins = ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://localhost:3001', 'http://127.0.0.1:3001']
|
||||
|
||||
if origin and origin in allowed_origins:
|
||||
response.headers['Access-Control-Allow-Origin'] = origin
|
||||
@@ -109,7 +111,7 @@ def create_app(config_name=None):
|
||||
if request.method == 'OPTIONS':
|
||||
response = make_response()
|
||||
origin = request.headers.get('Origin')
|
||||
allowed_origins = ['http://localhost:3000', 'http://127.0.0.1:3000']
|
||||
allowed_origins = ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://localhost:3001', 'http://127.0.0.1:3001']
|
||||
|
||||
if origin and origin in allowed_origins:
|
||||
response.headers['Access-Control-Allow-Origin'] = origin
|
||||
|
Reference in New Issue
Block a user