refactor: clean up ai_service code formatting

- Adjust formatting for message parameters in the chat call
- Eliminate unnecessary blank lines in generate_prompt_request method
- Ensure consistent styles for arrays and block indentation

These changes improve code readability and maintain consistency in
formatting for better maintainability without altering functionality.
This commit is contained in:
songtianlun 2025-01-22 16:50:21 +08:00
parent d728d7f50e
commit 853a1d03ce
3 changed files with 8 additions and 9 deletions

View File

@ -30,5 +30,4 @@ class BatchGenerateWeatherArtsJob < ApplicationJob
# time = Time.current.in_time_zone(timezone)
# time.hour == 2
# end
end

View File

@ -11,13 +11,13 @@ class AiService
response = @client.chat(
parameters: {
model: "gpt-4",
messages: [{
messages: [ {
role: "system",
content: "You are a professional artist creating prompts for DALL-E 3. Create realistic, artistic weather scenes featuring iconic landmarks."
}, {
role: "user",
content: generate_prompt_request(city, weather_data)
}],
} ],
temperature: 0.7,
max_tokens: 300
}

View File

@ -1,8 +1,8 @@
Rails.application.routes.draw do
root "home#index"
resources :cities, only: [:index, :show] do
resources :weather_arts, path: 'weather', only: [:show], param: :slug
resources :cities, only: [ :index, :show ] do
resources :weather_arts, path: "weather", only: [ :show ], param: :slug
end
# namespace :admin do