ajuste no build
This commit is contained in:
parent
2f4812f138
commit
ba73476647
@ -5,11 +5,14 @@ Rails.application.config.after_initialize do
|
||||
api_key = ENV.fetch('OPENAI_API_KEY', nil)
|
||||
|
||||
if api_key.present?
|
||||
RubyLLM.configure do |config|
|
||||
config.openai_api_key = api_key
|
||||
config.openai_organization_id = ENV['OPENAI_ORGANIZATION_ID'] if ENV['OPENAI_ORGANIZATION_ID'].present?
|
||||
config.gemini_api_key = ENV['GEMINI_API_KEY'] if ENV['GEMINI_API_KEY'].present?
|
||||
config.google_api_key = ENV['GEMINI_API_KEY'] if ENV['GEMINI_API_KEY'].present?
|
||||
begin
|
||||
RubyLLM.configure do |config|
|
||||
config.openai_api_key = api_key
|
||||
config.openai_organization_id = ENV['OPENAI_ORGANIZATION_ID'] if ENV['OPENAI_ORGANIZATION_ID'].present?
|
||||
config.gemini_api_key = ENV['GEMINI_API_KEY'] if ENV['GEMINI_API_KEY'].present?
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.error "[RubyLLM] Init failed: #{e.class} #{e.message}"
|
||||
end
|
||||
Rails.logger.info "[RubyLLM] Configured with OPENAI_API_KEY: #{api_key[0..10]}..."
|
||||
puts "[RubyLLM] Configured with OPENAI_API_KEY: #{api_key[0..10]}..." # Log to stdout for rails runner visibility
|
||||
|
||||
@ -3,8 +3,9 @@ GlobalConfig.clear_cache
|
||||
ConfigLoader.new.process
|
||||
|
||||
## Seeds productions
|
||||
if Rails.env.production?
|
||||
if Rails.env.production? && User.count.zero?
|
||||
# Setup Onboarding flow
|
||||
# Only enable onboarding if no users exist to prevent loop on updates
|
||||
Redis::Alfred.set(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING, true)
|
||||
end
|
||||
|
||||
|
||||
@ -86,7 +86,9 @@ RUN SECRET_KEY_BASE=precompile_placeholder RAILS_LOG_TO_STDOUT=enabled bundle ex
|
||||
&& rm -rf spec node_modules tmp/cache
|
||||
|
||||
# Generate .git_sha file with current commit hash
|
||||
RUN echo "wuzapi-v1" > /app/.git_sha
|
||||
ARG BUILD_SHA=dev
|
||||
ENV BUILD_SHA=${BUILD_SHA}
|
||||
RUN echo "${BUILD_SHA}" > /app/BUILD_SHA
|
||||
|
||||
# Remove unnecessary files
|
||||
RUN rm -rf /gems/ruby/3.4.0/cache/*.gem \
|
||||
@ -145,7 +147,7 @@ COPY --from=pre-builder /gems/ /gems/
|
||||
COPY --from=pre-builder /app /app
|
||||
|
||||
# Copy .git_sha file from pre-builder stage
|
||||
COPY --from=pre-builder /app/.git_sha /app/.git_sha
|
||||
COPY --from=pre-builder /app/BUILD_SHA /app/BUILD_SHA
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user