This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"messages": [{"role": "system", "content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."}, {"role": "user", "content": "Is Xbox better than PlayStation?"}, {"role": "assistant", "content": "I apologize, but I cannot provide personal opinions. My primary job is to assist you with any issues related to your Xbox device. Do you have any Xbox-related issues that need addressing?"}]} | |
{"messages": [{"role": "system", "content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."}, {"role": "user", "content": "Can I play PC games on my Xbox?"}, {"role": "assistant", "content": "While X |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handle $connect event | |
func connectHandler(c echo.Context) error { | |
// Extract connection ID from headers | |
connectionID := c.Request().Header.Get("Sec-WebSocket-Protocol") | |
// Perform actions when a client connects | |
fmt.Printf("Client connected: %s\n", connectionID) // ==========> we didn't get the connectionID, it's empty | |
// Respond with a 200 status code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handle auth route | |
func authHandler(c echo.Context) error { | |
// how we can get params sent in the message like this one? => `{"action": "auth", "params", "<<api key>>"}` | |
// check api key in param and do auth | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import azure.cognitiveservices.speech as speechsdk | |
import requests | |
import json | |
from dotenv import load_dotenv | |
load_dotenv() | |
# Azure OpenAI service credentials | |
speech_endpoint = os.getenv("SPEECH_ENDPOINT") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, render_template | |
from flask_cors import CORS | |
from dotenv import load_dotenv | |
import os | |
import azure.cognitiveservices.speech as speechsdk | |
import wave | |
# Load environment variables from .env file | |
load_dotenv() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getAIResponse(userSpeech: string): Promise<string> { | |
const response = await fetch( | |
`${openAIEndpoint}/openai/deployments/Woodstock-AI/completions?api-version=2024-06-01`, | |
{ | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
Authorization: `Bearer ${openAIAPIKey}`, | |
}, | |
body: JSON.stringify({ |
OlderNewer