songtianlun
d728d7f50e
- Created BatchGenerateWeatherArtsJob to process eligible cities and generate weather art. - Introduced GenerateWeatherArtJob for generating weather art and image attachment. - Added AiService for obtaining prompts and generating images with OpenAI API. - Implemented WeatherService to fetch current weather data from the QWeather API. - Updated Gemfile with necessary gems (whenever, ruby-openai, httparty, down, aws-sdk-s3). This commit introduces a system to create and store weather art images for various cities based on current weather conditions, leveraging external APIs for data and image generation.
27 lines
549 B
Ruby
27 lines
549 B
Ruby
turkey = Country.find_by code: 'TR'
|
|
|
|
City.create!([
|
|
{
|
|
name: 'İstanbul',
|
|
latitude: 41.0082,
|
|
longitude: 28.9784,
|
|
country: turkey,
|
|
timezone: 'Europe/Istanbul',
|
|
active: false,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
},
|
|
{
|
|
name: 'Ankara',
|
|
latitude: 39.9334,
|
|
longitude: 32.8597,
|
|
country: turkey,
|
|
timezone: 'Europe/Istanbul',
|
|
active: false,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
}
|
|
])
|