Commit Graph

401 Commits

Author SHA1 Message Date
44f446c069 fix: adjust timing for weather arts generation
- Increase MAX_DURATION to allow longer processing time.
- Double SLEEP_DURATION to reduce server load between runs.
- Raise PER_RUN_GENERATION_LIMIT to improve throughput.

These changes enhance the performance of the weather arts generation
job by allowing longer intervals and reducing the frequency of
interruptions while also accommodating additional requests per run.
2025-03-06 09:22:40 +08:00
d8a2600998 chore: update sleep duration for weather arts worker
- Increase SLEEP_DURATION from 10 seconds to 60 seconds

This change modifies the sleep duration used in the
BatchGenerateWeatherArtsWorker class, allowing for longer
wait times between executions. This may help prevent
exceeding resource limits during high-demand periods.
2025-03-05 17:53:02 +08:00
2aad3ec5b4 fix: improve tag formatting functionality
- Update `format_as_tag` method to replace hyphens with
  underscores in addition to spaces.
- Ensure the method handles blank inputs properly.

This change improves the consistency of tag formatting by
ensuring that both spaces and hyphens are converted into
underscores, enhancing the usability and reliability of
this helper method.
2025-03-05 16:43:14 +08:00
f4337240f7 feat: enhance tag formatting options
- Update formatting to replace spaces with underscores
- Add functionality to replace hyphens with underscores
- Clarify comments to reflect new formatting behavior

These changes improve the flexibility of the tag formatting method by
allowing both spaces and hyphens to be standardized as underscores,
ensuring consistent tag representations.
2025-03-05 16:36:28 +08:00
9ff27cbe4d fix: correct region and subregion retrieval
- Update region access to use country.region instead of city.region
- Update subregion access to use country.subregion instead of city.subregion

These changes ensure that the region and subregion are accurately retrieved based on the correct geographical hierarchy, improving the data integrity of the application.
2025-03-05 16:26:10 +08:00
5de3d4306f feat: add tag formatting helper 2025-03-05 16:20:08 +08:00
2d227d5871 feat: add region and subregion to RSS feed 2025-03-05 15:55:50 +08:00
789fe06c2a fix: update metadata structure in RSS feed 2025-03-05 15:40:33 +08:00
9dd6fc26f8 feat: add formatted date to RSS feed response
- Include formattedDate in the RSS feed response
- Utilize art.formatted_time method for better date formatting

This change enhances the RSS feed by providing a more user-friendly
formatted date alongside the existing weather date. This allows
clients consuming the RSS feed to display dates in a more readable
format, improving overall usability.
2025-03-05 15:38:53 +08:00
d39a7deea2 feat: update RSS feed routes and logging
- Change route for RSS feed to use defaults for format
- Add logging to RssController#feed to track request format

These changes improve the clarity of the routing for the RSS feed
and enhance debugging capabilities by logging the request format.
The new route definition ensures that the feed responds correctly
with the default format, while the logging provides insight into
how the feed is being accessed.
2025-03-05 15:18:15 +08:00
4e322bd6e9 feat: add JSON feed support for weather art
- Implement JSON feed generation in the RssController
- Add new API endpoint to serve JSON feed
- Update RSS feed view to include hidden machine-readable data

This commit introduces a new feature that allows the application to
serve weather art data in JSON format. The JSON feed includes
metadata such as the title, description, and additional custom
fields for better integration with other services. The changes
also enhance the existing RSS feed by embedding machine-readable
data within the HTML structure, improving accessibility and
usability for automated systems.
2025-03-05 14:59:02 +08:00
e22d3d86de feat: enhance RSS feed with weather data
- Add custom XML namespace for weather data
- Include additional weather fields: country, city, state,
  weather description, prompt, and formatted date
- Update enclosure type to 'image/webp' for better
  compatibility

This update improves the RSS feed by providing more detailed
weather information for each art piece, enhancing the
user experience and ensuring better data representation.
The new fields allow for richer content in the feed, making
it more informative for users.
2025-03-05 14:42:14 +08:00
2b7318a858 feat: optimize RSS feed with eager loading
- Include image attachments and city associations in the
  RSS feed query to improve performance.
- This change reduces the number of database queries
  needed when rendering the feed, addressing potential
  N+1 query problems.
2025-03-05 14:15:31 +08:00
c82af65c26 feat: enhance RSS feed with additional weather data
- Add country name, city name, and state name to the RSS feed
- Include weather description and AI-generated description
- Add weather date to provide more context for each item

These changes improve the RSS feed by providing more detailed
information about the weather art, enhancing the user experience
and making the feed more informative for subscribers.
2025-03-05 13:46:57 +08:00
acbde3b034 feat: add hashtag support to social share button
- Include data-hashtag attribute in the Facebook share button
- Comment out an alternative database URL in credentials

This update enhances the social sharing feature by allowing
users to include hashtags when sharing content on Facebook.
The commented-out database URL serves as a reference for
future configurations.
2025-03-04 14:46:13 +08:00
98094ac0e4 style: standardize role casing in AI service 2025-03-02 11:17:05 +08:00
98f60d270e refactor: remove language switcher from navbar
- Removed the language switcher component from the
  navigation bar.
- This change simplifies the user interface, focusing
  on primary navigation elements.

The decision was made to streamline navigation and reduce
clutter, as the language switcher was deemed not essential
for the current user experience.
2025-02-28 13:23:21 +08:00
30508af344 feat: add pagination parameters to weather arts
- Include region, country, state, and query parameters
  in the pagination helper for better filtering.
- This change enhances the user experience by allowing
  users to navigate through weather arts based on
  specific criteria, improving the relevance of the
  displayed results.
2025-02-26 15:59:39 +08:00
df7fbcd118 feat: enhance city pagination and data fetching
- Update cities controller to include state in city data
- Modify results partial to pass pagination parameters
- Adjust index view to support turbo frame actions

These changes improve the pagination functionality by ensuring
that the correct parameters are passed for filtering cities
based on region, country, and state. This enhances the user
experience by providing more relevant data and better
navigation through the city listings.
2025-02-26 15:31:45 +08:00
070a3dfc1c fix: handle nil state in city initialization
- Update city initialization to safely access state ID
- Use safe navigation operator to prevent potential nil errors

This change ensures that if the state is nil, the code will not raise
an error when trying to access its ID. It improves the robustness of
the city data synchronization process.
2025-02-26 14:44:07 +08:00
f9e86bed27 fix: update city attributes assignment 2025-02-26 14:43:34 +08:00
3da2abbfaa refactor: improve city syncing logic
- Use `find_or_initialize_by` to ensure uniqueness based on
  multiple attributes.
- Replace multiple `update!` calls with `assign_attributes` for
  better readability and maintainability.
- Add error handling for city saving process to log errors
  if saving fails.

These changes streamline the city syncing process, making it
more efficient and easier to understand while ensuring that
cities are created or updated correctly based on unique
attributes.
2025-02-26 14:36:38 +08:00
26f8d56632 feat: add sync_city task for city data synchronization
- Define a new Rake task `sync_city` to synchronize city data
- Update the `find_or_create_by!` method to include additional
  attributes such as `flag`, `wiki_data_id`, `active`, and
  `priority`

This new task allows for better management of city data by
ensuring that all relevant attributes are set during the
synchronization process. It enhances the existing functionality
by providing more detailed information for each city.
2025-02-26 11:58:10 +08:00
e219b53bab refactor: update city creation parameters
- Change country_code to country_id for better clarity
- Add state_id to the city creation process

These changes ensure that the City model is created with the correct
associations to country and state, improving data integrity.
This refactor also enhances the readability of the code.
2025-02-26 11:18:18 +08:00
b3154c64e8 fix: improve city creation with country and state codes
- Update city creation to include country and state codes
- Ensure that the country and state are fetched correctly
- Use safe navigation to avoid nil errors

This change enhances the city creation process by ensuring that
country and state codes are properly associated with the city,
improving data integrity and consistency.
2025-02-26 11:04:39 +08:00
bdabf49626 fix: update country_id during state sync
- Add assignment for country_id in state update

This change ensures that the country_id is correctly set when
updating state information, improving the accuracy of the
data synchronization process.
2025-02-26 10:35:38 +08:00
ef16242fc4 fix: handle nil country safely in geo data sync
- Update country lookup to use safe navigation operator
- Ensure state creation uses safe access for country attributes

These changes prevent potential errors when the country data is
not available, improving the reliability of the geo data sync
process.
2025-02-26 10:34:49 +08:00
90c9a8946b fix: update cities path parameters
- Change cities_path to include both region and country
- Update active class logic to reflect current state

This fix ensures that the dropdown links correctly point to the
appropriate cities based on the selected region and country,
improving navigation and user experience.
2025-02-26 10:21:45 +08:00
f51dc8370b feat: add state filtering to cities index
- Implement state filtering in the CitiesController
- Add new scope `by_state` in the City model
- Update cities index view to include state dropdown
- Add slug column to states for friendly URLs
- Update English locale to include 'All States'

This commit enhances the cities index page by allowing users to
filter cities based on the selected state. It introduces a new
scope in the City model for state filtering and updates the
view to present a dropdown for state selection. Additionally,
it adds a slug column to the states table to support friendly
URLs, improving the overall user experience.
2025-02-26 09:48:39 +08:00
fe5c0d5113 fix: update sitemap retrieval logic
Some checks failed
Docker Dev / docker (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Docker Main / docker (push) Has been cancelled
- Change from using `get_object` to `head_object` to check if the
  sitemap file exists before attempting to retrieve it.
- Implement a presigned URL for accessing the sitemap, which is valid
  for 15 minutes.
- Set cache headers to allow for 1 hour of caching.
- Improved logging for better error tracking and debugging.

This change enhances the efficiency of sitemap retrieval by reducing
unnecessary data transfer and provides a more secure way to access
the sitemaps through presigned URLs. It also improves error handling
by logging specific errors related to missing sitemaps.
2025-02-24 17:42:55 +08:00
3ae870047a feat: add sitemap management feature
- Implement index action to list sitemaps
- Create view for displaying sitemaps with details
- Add helper method for generating sitemap URLs
- Enhance error handling for S3 service errors

This commit introduces a new feature for managing sitemaps in the application. It includes an index view that lists all available sitemaps with their last modified date and size, along with a link to view each sitemap. The error handling for S3 interactions has also been improved to log errors and return appropriate responses.
2025-02-24 17:28:21 +08:00
2a360a6875 style: fix formatting in Arabic locale file
- Ensure consistent formatting in the long date string
- No functional changes were made, only a formatting adjustment

This commit addresses a minor formatting issue in the Arabic locale file, ensuring that the long date format is consistent with the expected output. No changes to functionality or behavior were introduced.
2025-02-24 17:09:21 +08:00
bd04bb63a1 feat: add support for multiple languages
- Update available locales to include Bengali, Hindi, Urdu, and Arabic
- Add new locale files for each language with translations for UI elements
- Ensure the application can now support a wider audience by providing
  localized content

This change enhances the application's accessibility and usability for
users who speak these languages, allowing for a more inclusive user
experience. The new translations cover key UI components and messages,
ensuring that users can interact with the application in their native
languages.
2025-02-24 17:04:23 +08:00
5f98d9ebfd feat: enhance language switcher dropdown
- Update dropdown to support dynamic locales from I18n
- Limit dropdown height with overflow handling for better UX

This change improves the language switcher by dynamically
loading available locales from the I18n configuration. It
also enhances the user experience by limiting the height
of the dropdown and enabling scrolling, making it easier
to navigate through multiple language options.
2025-02-24 15:55:01 +08:00
9ef2a92d60 feat: add multiple language support for locales
- Extend available locales in the application to include:
  - Portuguese (Brazil)
  - Croatian
  - Persian
  - German
  - Spanish
  - French
  - Italian
  - Turkish
  - Russian
  - Ukrainian
  - Polish

- Create new locale files for each language with appropriate translations.
- Update existing locale files to include new languages.

This update enhances the application's accessibility by supporting a wider range of languages, allowing users from different regions to interact with the application in their native language.
2025-02-24 15:46:29 +08:00
03c957e654 feat: add date formats to localization
- Introduce default, short, and long date formats
- Enhance date representation for better user experience

This update allows the application to display dates in multiple formats,
including a default format of 'YYYY-MM-DD', a short format of
'"MMM DD"', and a long format of '"Month DD, YYYY"'. This
improves localization support and user interface flexibility.
2025-02-24 14:20:49 +08:00
b2cc7e7016 chore: update keywords for SEO optimization
- Refactor keywords in cities_controller.rb
- Refactor keywords in weather_arts_controller.rb
- Refactor keywords in application.html.erb

This change improves the SEO of the application by updating
keywords to include 'ai' and 'ai web', which are more relevant
and likely to enhance search visibility. The previous keywords
were less optimized for current trends in AI-related searches.
2025-02-24 14:12:51 +08:00
da2f4f6c86 fix: update keywords for better SEO
- Modify keywords in cities_controller.rb to include 'ai weather'
- Update keywords in weather_arts_controller.rb to include 'ai weather'
- Change keywords in application.html.erb to include 'ai weather'

These changes enhance the search engine optimization (SEO) of the
application by ensuring that relevant keywords are included in
meta tags, improving visibility for users searching for AI
weather-related content.
2025-02-24 14:10:32 +08:00
3661d2b008 chore: update meta keywords for SEO
- Modify keywords in CitiesController for better
  categorization of AI art and weather art.
- Update keywords in WeatherArtsController to include
  city country name and description.
- Add keywords in application layout for overall site
  SEO improvement.

These changes aim to improve search engine visibility
and better describe the content related to AI-generated
weather art.
2025-02-24 14:08:25 +08:00
0e476b546d feat: add locking mechanism to batch task worker
Some checks failed
Docker Dev / docker (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Docker Main / docker (push) Has been cancelled
- Introduce a Redis-based lock to prevent concurrent execution of
  batch generation tasks.
- Set a TTL of 300 seconds for the lock to ensure it is released
  after a timeout.
- Add logging for situations where a task is already in progress.

This enhancement ensures that batch tasks do not overlap, which can
lead to data inconsistencies and resource contention. The locking
mechanism improves the reliability of the batch processing system.
2025-02-22 15:41:42 +08:00
d331a73a85 fix: update html lang attribute for I18n
- Change the lang attribute of the HTML tag to use the current I18n locale
- This change ensures that the application correctly reflects the user's language preferences

Updating this attribute improves accessibility and SEO by helping search engines and assistive technologies better understand the language of the content.
2025-02-22 15:19:40 +08:00
5a82fc9a10 style: correct string split style
- Change string split method from single quotes to double quotes.

This commit improves code consistency by aligning the string
split syntax with the rest of the codebase. No functional
changes were made as a result of this update.
2025-02-22 15:00:37 +08:00
926ba18e85 refactor: change locale handling to around_action
- Update set_locale method to use around_action instead of before_action.
- Modify locale extraction logic to handle more cases, ensuring better fallback handling.
- Improve overall method clarity and maintainability by restructuring code.

This change enhances the localization process by providing a clearer
way to manage locale settings and ensures that it correctly falls back
to the default locale when necessary. It also resolves some edge cases
in locale extraction based on the HTTP_ACCEPT_LANGUAGE header.
2025-02-22 15:00:22 +08:00
09fa1ceea9 feat: update sitemap generation for multiple locales
- Refactor generate_sitemap method to support locale
- Add setup_sitemap_config method for configuration
- Implement sitemap generation for default and localized paths

This update enhances the sitemap generation process by supporting
multiple languages. Users can now access a sitemap with language
prefixes, improving SEO and usability for different locales.
Additionally, error handling has been improved to log specific
errors related to locale generation.
2025-02-22 12:08:59 +08:00
5b996bb64a style: update layout and improve accessibility
Some checks are pending
Docker Dev / docker (push) Waiting to run
- Adjust footer components for better spacing
- Move language switcher to navbar for easier access
- Simplify language switcher links using iteration
- Enhance copyright text to dynamically reflect the current year
2025-02-22 01:03:40 +08:00
80ceac5d94 feat: add locale extraction and sanitization methods
- Implemented `extract_locale_from_accept_language_header` to
  retrieve the user's preferred language from the request.
- Added `sanitize_locale` for validating and sanitizing locale
  inputs against available locales.
- Updated `set_locale` method to prepare for incorporating
  browser language preference handling.

These changes enhance the application's ability to set the locale
based on the user's browser settings, paving the way for better
internationalization support.
2025-02-22 00:13:35 +08:00
bd42833953 feat: add translatable name module for countries and regions
- Introduced `TranslatableName` module to allow for
  localized names for `Country` and `Region` models.
- Updated views to display `localized_name` instead of
  `name` for improved internationalization.
- Refactored JSON serialization for `translations` attribute.
- Enhanced localization support by adding new languages:
  Japanese and Korean, with updated locale files.
- Removed outdated English and Chinese locales for countries
  and regions to clean up the codebase.
2025-02-21 23:46:25 +08:00
f6b9dcf187 feat: add internationalization support
- Implement locale extraction and fallback mechanism
- Add translation files for English and Chinese
- Update views to use translated strings for various UI elements

This commit introduces support for multiple languages in the application, enhancing accessibility for users. It includes a fallback mechanism for locales and updates to the user interface to display translated content.
2025-02-21 17:51:25 +08:00
517e3038cc chore: rename docker workflows and clean up city seeds
- Rename docker workflow files for clarity: 'docker-dev' and 'docker-main'
- Remove unused city seed files to streamline the database seeding process

These changes improve the organization of the workflow files and reduce clutter in the seed data, making it easier to manage and maintain the project.
2025-02-21 10:02:36 +08:00
9fe92b1fc4 feat: add RSS feed functionality
Some checks failed
Docker / docker (push) Has been cancelled
- Introduce RssController to handle RSS feed requests
- Add a new route for the RSS feed
- Implement RSS feed view to display weather art
- Update application layout to include RSS feed link
- Set content type for RSS responses

This commit adds an RSS feed feature that allows users to
subscribe to updates on daily AI-generated weather art.
The feed includes the latest weather art and relevant
metadata, enhancing user engagement and accessibility.
2025-02-19 17:38:49 +08:00