From 8ddb920e9913f552e363a86cca217a03f1fa7bfd Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Wed, 24 Jul 2024 08:54:40 +0200 Subject: [PATCH] =?UTF-8?q?Fels=C3=B6kning.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smartassist/src/backend.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/smartassist/src/backend.py b/smartassist/src/backend.py index 40d598f..9b66812 100644 --- a/smartassist/src/backend.py +++ b/smartassist/src/backend.py @@ -1,7 +1,7 @@ # Import the necessary functions from ollama, Flask, requests, threading from ollama import Client -from flask import Flask, request, jsonify +from flask import Flask, request, jsonify, send_from_directory from flask_cors import CORS, cross_origin # CORS stands for Cross-Origin Resource Sharing. This is necessary to allow the frontend to make requests to our backend. import requests import json @@ -22,10 +22,16 @@ def serve_static(filename): return send_from_directory(app.config['STATIC_FOLDER'], filename) +# CORS(app, resources={ +# r"/api/chat": { +# "origins": "*", +# "headers": ["Origin", "Content-Type", "Authorization"], +# } +# }) + CORS(app, resources={ r"/api/chat": { - "origins": "*", - "headers": ["Origin", "Content-Type", "Authorization"], + "origins": "*" } })