Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
corybuecker committed Apr 14, 2024
1 parent d547787 commit 45f18d7
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Continuous Integration
run-name: ${{ github.actor }} is running the CI suite
on: [push]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rake
27 changes: 27 additions & 0 deletions bin/srb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'srb' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("sorbet", "srb")
27 changes: 27 additions & 0 deletions bin/srb-rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'srb-rbi' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("sorbet", "srb-rbi")
6 changes: 6 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ development:
database: db/development.sqlite3
pool: 5
timeout: 5000

test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
14 changes: 11 additions & 3 deletions lib/open_ai/completion.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# typed: true
# typed: strict
# frozen_string_literal: true

module OpenAi
class Completion
extend T::Sig
Expand All @@ -7,9 +9,11 @@ class Completion

def initialize(chat)
@chat = chat
@api_key = T.must(chat.user).chat_gpt_key
@api_key = T.let(T.must(T.must(chat.user).chat_gpt_key), String)
end

sig { void }

def ask
message = chat.messages.new(body: { content: "", role: "user" })

Expand All @@ -25,6 +29,10 @@ def ask

private

attr_reader :chat, :api_key
sig { returns(Chat) }
attr_reader :chat

sig { returns(String) }
attr_reader :api_key
end
end

0 comments on commit 45f18d7

Please sign in to comment.