Skip to content

Instantly share code, notes, and snippets.

View ilovelili's full-sized avatar
🏠
Working from home

min ju ilovelili

🏠
Working from home
View GitHub Profile
{"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
// 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
// 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
...
}
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")
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()
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({