feat: Refactor Font Configuration for Consistency and Correctness (#409)

* feat(unocss): centralize font configuration and fix cyrillic font handling (#389)

This commit refactors the UnoCSS font configuration to establish a single source of truth and resolve issues with Cyrillic character rendering.

- Centralizes all font definitions within the root uno.config.ts.
- Updates the theme.fontFamily to use a correct fallback chain, ensuring "Comfortaa" is used for Cyrillic characters.
- Restricts the "Kiwi Maru" font to Latin and Japanese character subsets to prevent incorrect application.
- Simplifies application-specific uno.config.ts files by removing redundant local font overrides.

* fix(ui): ensure provider models reload reactively (#407)

This commit resolves a persistent reactivity issue where the model list would not update automatically after changing provider credentials. This was a recurring problem reported by users on Discord.

Previously, the model list was only fetched when the consciousness settings page was first mounted. This meant that if a user updated an API key and navigated back, the page would still display the old, stale model list until the application was fully restarted.

The fix introduces two key changes:

1.  A `watch` effect has been added to the `providers.ts` store. It now monitors `providerCredentials` and automatically refetches the model list for a specific provider whenever its credentials change.
2.  The `consciousness.vue` component now uses the `onActivated` lifecycle hook in addition to `onMounted`. This ensures that the model list is refreshed every time the component becomes active, such as when navigating back to it. A `watch` on the `activeProvider` was also added to handle provider switching within the page.

These changes ensure that the model list is always synchronized with the current provider configuration, providing a much smoother and more intuitive user experience.

Closes #407

---------

Co-authored-by: Neko <neko@ayaka.moe>
This commit is contained in:
Ilya Bogdanov
2025-08-25 11:44:10 +08:00
committed by GitHub
co-authored by Neko
parent 31daae13fc
commit 5c1eb33ad8
5 changed files with 32 additions and 69 deletions
+5 -3
View File
@@ -85,6 +85,7 @@ export function presetWebFontsFonts(provider: 'fontsource' | 'none'): Record<str
'cutejp': {
name: 'Kiwi Maru',
provider,
subsets: ['latin', 'japanese'],
},
'cuteen': {
name: 'Sniglet',
@@ -109,6 +110,7 @@ export function presetWebFontsFonts(provider: 'fontsource' | 'none'): Record<str
'comfortaa': {
name: provider === 'fontsource' ? 'Comfortaa' : 'Comfortaa Variable',
provider,
subsets: ['cyrillic'],
},
'm-plus-rounded': {
name: 'M PLUS Rounded 1c',
@@ -193,9 +195,9 @@ export function sharedUnoConfig() {
fontFamily: {
'sans': `"DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'sans-rounded': `"Comfortaa Variable", "Comfortaa", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cute': `"Sniglet", "Kiwi Maru", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cuteen': `"Sniglet", "Kiwi Maru", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cutejp': `"Sniglet", "Kiwi Maru", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cute': `"Sniglet", "Kiwi Maru", "Comfortaa", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cuteen': `"Sniglet", "Kiwi Maru", "Comfortaa", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
'cutejp': `"Sniglet", "Kiwi Maru", "Comfortaa", "xiaolai", "DM Sans Variant", "DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`,
},
/**
* https://github.com/unocss/unocss/blob/1031312057a3bea1082b7d938eb2ad640f57613a/packages-presets/preset-wind4/src/theme/animate.ts