tips を更新

syui 2024-09-19 08:37:46 +00:00
parent ee34874789
commit dd21bf81df

48
tips.md

@ -82,3 +82,51 @@ NPCなどの会話や操作は音声とAIを使用します。
- [RuntimeAudioImporter](https://github.com/gtreshchev/RuntimeAudioImporter) - [RuntimeAudioImporter](https://github.com/gtreshchev/RuntimeAudioImporter)
- [ChatGPT](https://platform.openai.com/docs/api-reference/introduction) - [ChatGPT](https://platform.openai.com/docs/api-reference/introduction)
- [elevenlabs](https://elevenlabs.io/docs/api-reference/text-to-speech) - [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で表示するとよいでしょう。