Skip to content

Commit 7c189a8

Browse files
committed
stretch3 の申請フォームを登録して ChatGPT2Scratch を利用できるように
1 parent 965caaf commit 7c189a8

File tree

8 files changed

+142
-1
lines changed

8 files changed

+142
-1
lines changed

app/assets/stylesheets/custom.scss

+17
Original file line numberDiff line numberDiff line change
@@ -1055,3 +1055,20 @@ section {
10551055
line-height: 1.7em;
10561056
color: #909090;
10571057
}
1058+
1059+
.stretch3-notes {
1060+
margin-top: 100px;
1061+
font-size: 11.8px;
1062+
line-height: 1.7em;
1063+
color: #909090;
1064+
}
1065+
1066+
.stretch3-eyecatch-container {
1067+
height: 35rem;
1068+
margin-bottom: 50px;
1069+
}
1070+
1071+
.stretch3-eyecatch {
1072+
border-radius: 10px;
1073+
object-fit: cover;
1074+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Stretch3sController < ApplicationController
2+
def new
3+
@stretch3 = Stretch3.new
4+
end
5+
6+
def create
7+
@stretch3 = Stretch3.new(stretch3_params)
8+
if @stretch3.save
9+
# NOTE: coderdojo.jp ドメインから遷移すると Stretch3 側で ChatGPT2Scratch の API キーが不要になる処理が走る
10+
redirect_to 'https://stretch3.github.io', allow_other_host: true
11+
else
12+
render :new
13+
end
14+
end
15+
16+
private
17+
18+
def stretch3_params
19+
params.require(:stretch3).permit(:email, :parent_name, :participant_name, :dojo_name)
20+
end
21+
end

app/models/stretch3.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Stretch3 < ApplicationRecord
2+
validates :email, presence: true
3+
validates :parent_name, presence: true
4+
validates :participant_name, presence: true
5+
validates :dojo_name, presence: true
6+
end

app/views/stretch3s/new.html.haml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
- provide(:title, 'Stretch3 x OpenAI Azure for Non-profit プログラム申請')
2+
- provide(:desc, 'Stretch3 から OpenAI の API を呼び出せる拡張機能 ChatGPT2Scratch を API キー不要で利用するための申請フォームです。')
3+
- provide(:url, '/stretch3')
4+
- provide(:meta_image, '/img/stretch3_openai.webp')
5+
6+
.container
7+
%section.introduction{style: "padding: 50px 0px;"}
8+
%div.text-center
9+
%h1{style: "line-height: 1.4em;"}
10+
Stretch3 x OpenAI
11+
%br
12+
Azure for Non-profit プログラム申請
13+
.stretch3-eyecatch-container
14+
= lazy_image_tag '/img/stretch3_openai.webp',
15+
alt: 'ポケモン・ワークショップのカバー画像',
16+
min: true,
17+
class: 'stretch3-eyecatch',
18+
style: 'box-shadow: 0 2.5rem 2rem -2rem hsl(200 50% 20% / 40%);'
19+
%p
20+
Stretch3 は自作の拡張機能を使えるように改造した Scratch です。
21+
%p
22+
この申請フォームは OpenAI の Chat API を呼び出す拡張機能 ChatGPT2Scratch を
23+
%br
24+
API キー不要で利用出来るようにするための申請フォームです。
25+
%br
26+
これにより本来有料の Chat API を無料で利用できます。
27+
%p
28+
利用規約は、
29+
%b<> 保護者の方が参加者と一緒に
30+
ご確認いただくようお願い致します。
31+
32+
= form_with model: @stretch3, url: stretch3_path, class: 'form' do |f|
33+
.field
34+
= f.label :email, "メールアドレス"
35+
= f.email_field :email, required: true, autocomplete: "email", class: "form__field", placeholder: '例: [email protected]'
36+
.field
37+
= f.label :parent_name, "保護者の名前"
38+
= f.text_field :parent_name, required: true, autocomplete: "name", class: "form__field", placeholder: '例: 幸田 道場'
39+
.field
40+
= f.label :participant_name, "参加者の名前"
41+
= f.text_field :participant_name, required: true, autocomplete: "name", class: "form__field", placeholder: '例: 幸田 道子'
42+
.field
43+
= f.label :dojo_name, "道場名"
44+
= f.text_field :dojo_name, required: true, class: "form__field", placeholder: '例: CoderDojo 柏'
45+
.form__terms
46+
%h2.form__h2 利用規約
47+
%ul
48+
%li
49+
%small
50+
= link_to 'https://learn.microsoft.com/ja-jp/azure/ai-services/responsible-use-of-ai-overview', target: '_blank' do
51+
Azure AI サービスにおける AI の責任ある使用
52+
に従うことy
53+
%li
54+
%small
55+
%b<> 事前に保護者から同意を得ること
56+
%br
57+
(参考: #{link_to '文部科学省 - 生成AIの利活用に関するガイドライン','https://www.mext.go.jp/a_menu/other/mext_02412.html', target: '_blank'})
58+
%li
59+
%small CoderDojo 以外の用途で使う場合は、一般社団法人 CoderDojo Japan からの書面による許諾を事前に得るようお願いします。
60+
%p
61+
%small
62+
※ 本サービスは Azure AI の利用上限に達した場合、または上記事項への違反で使用できなくなった場合などの理由により、予告なく無効化される場合もあります。あらかじめご了承いただけると幸いです。
63+
.field.text-center
64+
= f.check_box :term_of_use, required: true
65+
= f.label :term_of_use, "上記の利用規約に同意する", style: "display:inline"
66+
67+
= f.submit "申し込んで利用開始する", class: "form__submit"
68+
.text-center
69+
%small 送信後、Stretch3 のページへ移動します。
70+
71+
%p.stretch3-notes
72+
Scratchは、Scratch財団がMITメディアラボのライフロング・キンダーガーテン・グループの協力により開発しているプロジェクトです。
73+
%a{href: "https://scratch.mit.edu", rel: "noopener", target: "_blank"}<> scratch.mit.edu
74+
\ から自由に入手できます。

config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
get "/podcast", to: redirect('/podcasts')
7070
get "/podcasts/feed" => "podcasts#feed"
7171
get "/stats" => "stats#show"
72+
get "/stretch3" => "stretch3s#new"
73+
post "/stretch3" => "stretch3s#create"
7274
get "/pokemon" => "pokemons#new"
7375
#post "/pokemon" => "pokemons#create"
7476
#get "/pokemon/download" => "pokemons#show"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class CreateStretch3s < ActiveRecord::Migration[7.0]
2+
def change
3+
create_table :stretch3s do |t|
4+
t.string :email, null: false
5+
t.string :parent_name, null: false
6+
t.string :participant_name, null: false
7+
t.string :dojo_name, null: false
8+
9+
t.timestamps
10+
end
11+
end
12+
end

db/schema.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.0].define(version: 2024_06_18_025325) do
13+
ActiveRecord::Schema[7.0].define(version: 2025_03_15_124619) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_stat_statements"
1616
enable_extension "plpgsql"
@@ -91,6 +91,15 @@
9191
t.index ["region"], name: "index_prefectures_on_region"
9292
end
9393

94+
create_table "stretch3s", force: :cascade do |t|
95+
t.string "email", null: false
96+
t.string "parent_name", null: false
97+
t.string "participant_name", null: false
98+
t.string "dojo_name", null: false
99+
t.datetime "created_at", null: false
100+
t.datetime "updated_at", null: false
101+
end
102+
94103
create_table "upcoming_events", force: :cascade do |t|
95104
t.integer "dojo_event_service_id", null: false
96105
t.string "event_id", null: false

public/img/stretch3_openai.webp

30.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)