Class: Lhj::ChatGptConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/lhj/helper/chat_gpt_config.rb

Overview

chat gpt Config

Constant Summary collapse

CONFIG_NAME =
'chat_gpt_config.yml'

Class Method Summary collapse

Class Method Details

.api_key(idx) ⇒ Object



22
23
24
25
# File 'lib/lhj/helper/chat_gpt_config.rb', line 22

def self.api_key(idx)
  i = idx % config.length
  config[i]['api_key']
end

.cleanObject



18
19
20
# File 'lib/lhj/helper/chat_gpt_config.rb', line 18

def self.clean
  @yaml = nil
end

.configObject



14
15
16
# File 'lib/lhj/helper/chat_gpt_config.rb', line 14

def self.config
  @yaml ||= YAML.load_file(config_file)
end

.config_fileObject



10
11
12
# File 'lib/lhj/helper/chat_gpt_config.rb', line 10

def self.config_file
  File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
end

.org_id(idx) ⇒ Object



27
28
29
30
# File 'lib/lhj/helper/chat_gpt_config.rb', line 27

def self.org_id(idx)
  i = idx % config.length
  config[i]['org_id']
end