Mera felsökning

This commit is contained in:
2024-07-16 23:36:59 +02:00
parent 3fef179723
commit 1b7142f157
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -8,20 +8,20 @@ import requests
# Initialize a Flask application
app = Flask(__name__)
@app.route('/api/chat', methods=['POST'])
@app.route('/chat', methods=['POST'])
def chat():
# Get the message from the JSON in the request body
data = request.get_json()
message = data.get('query')
if message:
response = requests.post('localhost::11434', json={"model": "llama3",'prompt': message})
response = requests.post('http://localhost:11434', json={"model": "llama3",'prompt': message})
return jsonify({'response': response.json().get('result')})
else:
return jsonify({'error': 'No query provided'}), 400
@app.route('/smartassist', methods=['POST'])
@app.route('/smartassist', methods=["POST"])
def smartassist():
# Extract the query from the incoming JSON data
data = request.json