1.1K Views
February 21, 25
スライド概要
Raycast Meetup Japan #1
Frontend engineer @lapras_inc / TypeScript / Vue.js / Firebase / 元消防士
Raycast AI APIを使って ちょっと便利なAIコマンドを作ってみた 2024/2/21 Raycast Meetup @KawamataRyo
@KawamataRyo LAPRAS株式会社 リリースしたRaycast拡張 TinyPNG esa Moch
Raycast Store Pro Teams Developers Changelog Blog Log in Download There's an extension for that. Use your favorite tools without even opening them. Productivity Engineering Design Writing Arc Navigate your open tabs or search through your browser history. Spaces Work Personal AI TinyPNG Compress the selected images in Finder with TinyPNG. 150 KB Compress Images tinypng 1Password Easily grab any password or credential from your 1Password vaults. Browse thousands more ->
今日話すこと
RaycastのAI APIを使って ちょっと便利な拡張機能を作ってみた話
Raycast AI APIとは?
Raycast AI APIとは? 拡張機能のコードベース上で、Raycast AIで使えるモデルを統一されたインターフェ イスで利用できるAPI。 import { AI } from "@raycast/api"; const answer = await AI.ask("今日の天気は?"); console.log(answer); // "2025年2月19日の東京の天気は、晴れです"
何を作った?
何を作った? 多言語でのテキストチャットのやり取りを 楽にする拡張機能 rep Results Reply MyAICommands repo: lapras github.com repo: scouty github.com Reset Raycast Window Position Raycast Ask AI Tab Command Quicklink Quicklink Command
え、それRaycast AIコマンドとか Translateでも可能では・・
なぜ作った?
今までの翻訳の流れ 1. テキスト選択して和訳 2. 返答を日本語で記入して翻訳 3. 結果を再和訳して、ニュアン ス確認 4. コピーして貼り付け
今までの翻訳の流れ 1. テキスト選択して和訳 2. 返答を日本語で記入して翻訳 3. 結果を再和訳して、ニュアン ス確認 4. コピーして貼り付け 昨日 6:13 AM Would it be possible to add in how many profiles have been scanned? I feel like I spend a lot of time scanning because I'm not sure if it's gone through 700 profiles, but only found 20 users. Having a counter showing how many profiles it's looked through would be great! Otherwise loving what you've created :) 6:13 English Would it be possible to add in how many profiles have been scanned? I feel like I spend a lot of time scanning because I'm not sure if it's gone through 700 profiles, but only found 20 users. Having a counter showing how many profiles it's looked through would be great! Otherwise loving what you've created :) 56 Words 312 Characters Translate Japanese スキャンしたプロフィールの数を追 加することは可能でしょうか? 700 のプロフィールを調べたのに 20 人 のユーザーしか見つからなかったた め、スキャンにかなり時間がかかっ ていると感じます。調べたプロ フィールの数を示すカウンターがあ れば最高です! そうでなければ、作 成したものが大好きです :) Copy Translation Actions
今までの翻訳の流れ 1. テキスト選択して和訳 2. 返答を日本語で記入して翻訳 3. 結果を再和訳して、ニュアン ス確認 4. コピーして貼り付け 昨日 6:13 AM Would it be possible to add in how many profiles have been scanned? I feel like I spend a lot of time scanning because I'm not sure if it's gone through 700 profiles, but only found 20 users. Having a counter showing how many profiles it's looked through would be great! Otherwise loving what you've created :) Japanese (Detected) ご要望ありがとうございま す! まもなくリリースされる v2.9.0では、スキャンされた プロファイルの数が表示され ることをお知らせできること を嬉しく思います。また、ス キャン速度を10倍に向上させ る計画もあります! リリース された際にはぜひお試しくだ さい。 61 Words 123 Characters Translate English Thank you for your feedback! We are happy to announce that in the upcoming v2.9.0 release, we will show you the number of profiles scanned. We also have plans to improve the scanning speed by 10x! Please try it out when it is released. Copy Translation Actions
今までの翻訳の流れ 1. テキスト選択して和訳 2. 返答を日本語で記入して翻訳 3. 結果を再和訳して、ニュアン ス確認 4. コピーして貼り付け 昨日 6:13 AM Would it be possible to add in how many profiles have been scanned? I feel like I spend a lot of time scanning because I'm not sure if it's gone through 700 profiles, but only found 20 users. Having a counter showing how many profiles it's looked through would be great! Otherwise loving what you've created :) English Thank you for your feedback! We are happy to announce that in the upcoming v2.9.0 release, we will show you the number of profiles scanned. We also have plans to improve the scanning speed by 10x! Please try it out when it is released. 44 Words 235 Characters Translate Japanese フィードバックをありがとう ございます。次のバージョン 2.9.0 リリースでは、スキャン されたプロファイルの数が表 示されるようになります。ま た、スキャン速度を10倍に向 上させる計画もあります。リ リースされたらぜひお試しく ださい。 Copy Translation Actions
今までの翻訳の流れ 1. テキスト選択して和訳 2. 返答を日本語で記入して翻訳 3. 結果を再和訳して、ニュアン ス確認 4. コピーして貼り付け This Old Tomb @thisoldtomb.bsky.social 昨日 6:13 AM Would it be possible to add in how many profiles have been scanned? I feel like I spend a lot of time scanning because I'm not sure if it's gone through 700 profiles, but only found 20 users. Having a counter showing how many profiles it's looked through would be great! Otherwise loving what you've created :) 6:13 Thank you for your feedback! We are happy to announce that in the upcoming v2.9.0 release, we will show you the number of profiles scanned. We also have plans to improve the scanning speed by 10x! Please try it out when it is released.
課題感 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒
課題感 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒
課題感 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒
課題感 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒
どう解決した?
CARAA Center @caraacenter.bsky.social Thu, January 30 1:59 AM Bjr !! je n'arrive pas à me conneter a sky followers bridge, j'ai crée un mot de passe provisoir dans Bsky et mon pseudo est caraacentre.bsky.social mais je n epeux pas me connecter .. pouvez vous m'aider ? merci. 2:00 メッセージを書く
① 和訳 検索 通知 チャット フィード リスト プロフィール 設定 新しい投稿 Bjr !! je n'arrive pas à me conneter a sky followers bridge, j'ai crée un mot de passe provisoir dans Bsky et mon pseudo est その他のフィード トレンド USPS Control CPAC Connell Wemby プライバシー・規約・ヘルプ 翻訳結果 こんにちは! Sky Followers Bridgeに接続できません。Blueskyで仮パスワードを作成し、私のIDはcaraacentre.bsky.socialなの ですが、ログインできません。助けていただけますか?ありがとうございます。 選択したテキストの和訳を生成 Reply 返信文を生成 Actions
② 返信文の作成 返信先の和訳も表示 ット ード ト ィール 翻訳 こんにちは! Sky Followers Bridgeに接続できません。 Blueskyで仮パスワードを作成し、私のユーザー名は caraacentre.bsky.socialなのですが、ログインできません。 助けていただけますか?ありがとうございます。 言語を検出 Language 返信文の入力 Reply Text 質問ありがとう! 問題の詳細を知りたいです。エラー文言 を教えてください Tone Options Formal トーンの指定 返信文の入力 Generate Actions
③ 翻訳 & 再和訳 & クリップボードコピー 返信先の言語での翻訳 (クリップボードにコピー済み) 返信文 Merci de nous avoir contactés ! Pour mieux comprendre votre problème, pourriez-vous nous indiquer le message d'erreur que vous recevez lorsque vous essayez de vous connecter ? 翻訳結果 お問い合わせいただきありがとうございます。お客様の問題をより良く理解するために、ログインしようとした際に表示されるエラーメッ セージをお知らせいただけますでしょうか? 返信文の和訳 Reply Actions
結果 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒
結果 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒 Replyコマンドひとつで 和訳・翻訳・再和訳・コピーまで解決!
結果 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒 翻訳時のプロンプトに返信元の原文も加えることで、 コンテキストを考慮した翻訳が可能に!
結果 1. 単純に手数が多い。コマンドを複数回呼ぶ必要がある 2. 返信元のコンテキストを考慮した翻訳ができない 3. 英語以外の言語への翻訳が面倒 原文の言語を判定し、翻訳時のプロンプトで指示することで、 複数言語に自動で対応!
Prompts export const PROMPTS = { TRANSLATION: (selectedText: string) => ` あなたは高性能な翻訳システムです。与えられた文章を自然な日本語に翻訳してください。 翻訳文のみを出力し、元の文章や説明などは一切含めないでください。 翻訳のルール: - 文化的な文脈を考慮し、適切な日本語表現を選択する - 原文のニュアンスをできるだけ保持する 入力文: ${selectedText} `, DETECTED_LANGUAGE: (selectedText: string) => ` あなたは高精度の言語判定システムです。与えられたテキストの言語を判定し、対応する国旗の絵文字
まとめ
まとめ RaycastAI APIを使うと普通のAIコマンドではできないコンテキス トに合わせた多段階の生成ができる。こんな使いやすいAPIを公開し てくれるRaycastに感謝!✨
おまけ コードとインストール方法はこちら👋余裕できたらStore公開も頑張ります。 kawamataryo/raycast- commands Contributor Issues Stars Forks github.com GitHub - kawamataryo/raycast-commands Contribute to kawamataryo/raycast-commands... https://github.com/kawamataryo/raycast-commands
End👋