File size: 857 Bytes
f1aac43
26f9959
 
7a8ef73
 
f1aac43
 
7a8ef73
f1aac43
 
 
 
 
 
 
 
 
 
 
7a8ef73
f1aac43
 
 
 
 
 
 
7a8ef73
26f9959
7a8ef73
277aa19
f1aac43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)