From dd21bf81dfb5a680af81b600b3ba4f9010b6ac63 Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 19 Sep 2024 08:37:46 +0000 Subject: [PATCH] =?UTF-8?q?tips=20=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tips.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) 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