0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MIT App InventorにてAIによる検索およびURLの取得とアクセスの実装

Posted at

はじめに

MIT App InventorではAIを利用できます!!便利ですよね~~!
AIで調べものもできるので,URLほしいですよね...実装してみます!

アプリの概要

AIに調べ事をしてもらい,調べた内容が記載されているURLも教えてもらうアプリです.ボタンをおすと,AIに教えてもらったURLへジャンプします.
Screen1:観光情報の表示
Screen2:Screen1で取得したURLのページを表示

ブロック画面

Screen1

スクリーンショット 2025-03-03 023935.png

機能 内容
Button_観光案内 クリックしたら東京都の観光地の一つを教えてもらう
Button_url クリックしたらScreen2へ移動
Label_URL AIがら取得したURLを表示する
Label_text 観光情報の表示

Screen2

スクリーンショット 2025-03-03 024606.png

機能 内容
Button_Screen1 クリックしたらScreen1へ移動
WebViewer1 URLへのアクセス

ブロック画面

Screeen1

変数

apiKey
ご自身のAPIKeyを入れて下さい.
blocks.png

Geminiへのアクセスリンク
blocks (1).png

when Button_観光案内. Click

紫色のpost text内のテキストを変えることでAIへの質問内容を変えることができます.
blocks (2).png

when Web1. GotText

Geminiからのレスポンスを処理.レスポンスからURLを抽出し,Label_URLにURLを表示する.
blocks (9).png

when Button_url. Click

ボタンが押されたら,Screen2へ移動し,URLのサイトを表示する.
blocks (6).png

Screeen2

when Screen2. Inutialize

Screen2が開いたら,URLのページを表示する.
blocks (8).png

when Button_screen1. Click

ボタンを押したら,Screen1へ移動する.
blocks (7).png

実行画面

##おわりに
AIからURLのみを抽出することができました.この方法ではURLの出力形式を指定していないので抽出できないことがあるかもです.
json chemaを使用したら,不具合が減りそうですね.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?