today_ai_weather/app/views/shared/_city_ai_description.html.erb
songtianlun 6f01174ea9 feat: enhance city description generation
- Modify get_description method to include an additional
  parameter for user context
- Update usage in views to reflect the new parameter
- Adjust temporary description message based on user context

This change enhances the city description generation logic by
allowing differentiation in how the description is provided
depending on whether the calling context is a user. It improves
the user experience while ensuring that non-user contexts
handle descriptions differently. This minor enhancement also
included updating the view to support this new logic.
2025-04-12 14:46:44 +08:00

22 lines
1.3 KiB
Plaintext

<%# app/views/shared/_city_ai_description.html.erb %>
<% if city && city.get_description.present? %>
<div class="card bg-base-100 backdrop-blur-md shadow-lg border border-primary/20 overflow-hidden">
<div class="card-body">
<h2 class="card-title flex items-center gap-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
</svg>
<span>City Description</span>
</h2>
<div class="prose max-w-none text-left">
<p><%= city.get_description('en', false, true, true) %></p>
</div>
<div class="text-sm opacity-70 mt-4 flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
</svg>
<span>Generated by AI</span>
</div>
</div>
</div>
<% end %>