diff --git a/tips.md b/tips.md index 76e0f12..ee9c8a0 100644 --- a/tips.md +++ b/tips.md @@ -81,4 +81,52 @@ NPCなどの会話や操作は音声とAIを使用します。 - [RuntimeSpeechRecognizer](https://github.com/gtreshchev/RuntimeSpeechRecognizer) - [RuntimeAudioImporter](https://github.com/gtreshchev/RuntimeAudioImporter) - [ChatGPT](https://platform.openai.com/docs/api-reference/introduction) -- [elevenlabs](https://elevenlabs.io/docs/api-reference/text-to-speech) \ No newline at end of file +- [elevenlabs](https://elevenlabs.io/docs/api-reference/text-to-speech) + +```sh +$ curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer YOUR_API_KEY" \ + -d '{ + "model": "gpt-4o-mini", + "messages": [{"role": "user", "content": "Your question here"}], + "temperature": 0.7 + }' +``` + +```sh +$ curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID" \ + -H "xi-api-key: YOUR_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "text": "Hello world!", + "model_id": "eleven_monolingual_v1", + "voice_settings": { + "stability": 0.5, + "similarity_boost": 0.5 + } + }' \ + --output output.mp3 +``` + +## login + +loginは[bluesky-social/atproto](https://github.com/bluesky-social/atproto/blob/main/lexicons/com/atproto/server/createSession.json)を使用します。 + +```sh +# session +host=bsky.social +handle=syui.bsky.social +pass=xxx +url=https://$host/xrpc/com.atproto.server.createSession +curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"$pass\"}" $url + +# refresh +j=`!!` +token=`echo $j|jq -r .accessJwt` +refresh=`echo $j|jq -r .refreshJwt` +url=https://$host/xrpc/com.atproto.server.refreshSession +curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url +``` + +titleで入力させ、configに入れてWPで表示するとよいでしょう。 \ No newline at end of file