copil / app.py
adowu's picture
Update app.py
f1aac43 verified
raw
history blame contribute delete
857 Bytes
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
# Ustawienia API
BASE_URL = "https://copilot.microsoft.com/"
def send_message_to_copilot(message):
url = f"{BASE_URL}api/send-message" # Zmodyfikuj w zależności od rzeczywistego endpointu
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN" # Wprowadź swój token
}
data = {
"message": message
}
response = requests.post(url, headers=headers, json=data)
return response.json()
@app.route('/api/send', methods=['POST'])
def send():
content = request.json
user_message = content.get('message', '')
# Wyślij wiadomość do Copilot
response = send_message_to_copilot(user_message)
return jsonify(response)
if __name__ == '__main__':
app.run(debug=True)