filmov
tv
How To Integrate Chatgpt With Rails 7: Step-by-step Tutorial
![preview_player](https://i.ytimg.com/vi/_3AsaXoLdj4/maxresdefault.jpg)
Показать описание
In this video I will go through making a Ruby on Rails frontend/middle-tier that will talk to OpenAI’s API. All of this will let you mimic what the ChatGPT website does.
This code will:
- Let you create/manage users by hooking in Devise
- Let you create conversations with ChatGPT that are assigned to a user
- Let you save and retrieve these conversations so that they can be continued at any time.
As I have tried to keep this on target I am not doing any error checking, nor am I doing the stuff we don’t specifically need for this (logging out, creating users via UI, etc etc). I leave that as an exercise to the reader!
Timestamps
00:00 Intro
00:50 Create app
02:02 Install devise
03:30 Add seed data
04:00 Add docker
05:00 Add dotenv-rails, .env file
09:00 Start the database
10:35 Create chat object, controller, views (scaffolded)
13:20 devise: force account and make better looking
16:20 add ruby-openai
17:15 OpenAI access token
18:50 create views
21:30 work on controllers to create the chat
23:30 turbo_streams
29:20 chat index
31:00 chat view (finally!)
36:20 Talking to OpenAI
43:40 How to continue the conversation
46:30 save the raw response
47:05 fix the sidebar list
48:20 Conclusion - tips for a product
### Source code and notes 🗳
This is a 'pay what you want' item, meaning you can get it for free. But any payment is really appreciated as it helps me transition to creating great content like this full-time!
### Talk to me!
Looking for great hosting? I've been using DigitalOcean for 7 years and they have never let me down. Amazing.
#techEntrepreneur #entrepreneurship #softwareDevelopment
This code will:
- Let you create/manage users by hooking in Devise
- Let you create conversations with ChatGPT that are assigned to a user
- Let you save and retrieve these conversations so that they can be continued at any time.
As I have tried to keep this on target I am not doing any error checking, nor am I doing the stuff we don’t specifically need for this (logging out, creating users via UI, etc etc). I leave that as an exercise to the reader!
Timestamps
00:00 Intro
00:50 Create app
02:02 Install devise
03:30 Add seed data
04:00 Add docker
05:00 Add dotenv-rails, .env file
09:00 Start the database
10:35 Create chat object, controller, views (scaffolded)
13:20 devise: force account and make better looking
16:20 add ruby-openai
17:15 OpenAI access token
18:50 create views
21:30 work on controllers to create the chat
23:30 turbo_streams
29:20 chat index
31:00 chat view (finally!)
36:20 Talking to OpenAI
43:40 How to continue the conversation
46:30 save the raw response
47:05 fix the sidebar list
48:20 Conclusion - tips for a product
### Source code and notes 🗳
This is a 'pay what you want' item, meaning you can get it for free. But any payment is really appreciated as it helps me transition to creating great content like this full-time!
### Talk to me!
Looking for great hosting? I've been using DigitalOcean for 7 years and they have never let me down. Amazing.
#techEntrepreneur #entrepreneurship #softwareDevelopment
Комментарии