From 58530dae23988bc95d00fc15b70418161bf089c3 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Fri, 31 Oct 2025 02:02:41 +0800 Subject: [PATCH] style: lint --- .../ControlsIsland/IndicatorMicVolume.vue | 9 +++-- .../index.ts | 1 - docs/.vitepress/composables/sidebar.ts | 2 +- docs/scripts/update-contributors.ts | 2 +- .../pages/settings/modules/consciousness.vue | 34 +++++++++---------- .../src/pages/settings/modules/hearing.vue | 34 +++++++++---------- .../src/pages/settings/modules/speech.vue | 34 +++++++++---------- .../src/pages/settings/providers/index.vue | 22 ++++++------ .../providers/SpeechProviderSettings.vue | 2 +- .../src/composables/useScrollToHash.ts | 18 ++++++---- services/telegram-bot/src/index.ts | 4 +-- .../telegram-bot/src/llm/animated-sticker.ts | 2 +- services/telegram-bot/src/llm/sticker.ts | 2 +- uno.config.ts | 16 ++++----- 14 files changed, 94 insertions(+), 88 deletions(-) diff --git a/apps/stage-tamagotchi/src/renderer/components/Widgets/ControlsIsland/IndicatorMicVolume.vue b/apps/stage-tamagotchi/src/renderer/components/Widgets/ControlsIsland/IndicatorMicVolume.vue index 0341ba73e..0afc96e23 100644 --- a/apps/stage-tamagotchi/src/renderer/components/Widgets/ControlsIsland/IndicatorMicVolume.vue +++ b/apps/stage-tamagotchi/src/renderer/components/Widgets/ControlsIsland/IndicatorMicVolume.vue @@ -17,8 +17,13 @@ let source: MediaStreamAudioSourceNode | undefined const normalized = computed(() => Math.min(1, (volumeLevel.value ?? 0) / 100)) function teardown() { - try { source?.disconnect() } - catch {} + try { + source?.disconnect() + } + catch { + + } + source = undefined stopAnalyzer() } diff --git a/apps/stage-tamagotchi/src/renderer/composables/electron-vueuse/use-electron-mouse-around-window-border/index.ts b/apps/stage-tamagotchi/src/renderer/composables/electron-vueuse/use-electron-mouse-around-window-border/index.ts index 537ec03e5..e0437837c 100644 --- a/apps/stage-tamagotchi/src/renderer/composables/electron-vueuse/use-electron-mouse-around-window-border/index.ts +++ b/apps/stage-tamagotchi/src/renderer/composables/electron-vueuse/use-electron-mouse-around-window-border/index.ts @@ -60,4 +60,3 @@ export function useElectronMouseAroundWindowBorder( } export type UseElectronMouseAroundWindowBorderReturn = ReturnType - diff --git a/docs/.vitepress/composables/sidebar.ts b/docs/.vitepress/composables/sidebar.ts index 901f4a283..8bd48c4fe 100644 --- a/docs/.vitepress/composables/sidebar.ts +++ b/docs/.vitepress/composables/sidebar.ts @@ -184,7 +184,7 @@ export interface SidebarLink { } function ensureStartingSlash(path: string): string { - return /^\//.test(path) ? path : `/${path}` + return path.startsWith('/') ? path : `/${path}` } /** diff --git a/docs/scripts/update-contributors.ts b/docs/scripts/update-contributors.ts index 221eab73b..b2965decd 100644 --- a/docs/scripts/update-contributors.ts +++ b/docs/scripts/update-contributors.ts @@ -21,7 +21,7 @@ async function fetchContributors(page = 1) { const data: Contributor[] = await res.json() collaborators.push(...data.map(contributor => contributor.login)) - if (res.headers.get('Link')?.includes('rel=\"next\"')) + if (res.headers.get('Link')?.includes('rel="next"')) collaborators.push(...(await fetchContributors(page + 1))) return collaborators.filter(name => !name.includes('[bot]')) } diff --git a/packages/stage-pages/src/pages/settings/modules/consciousness.vue b/packages/stage-pages/src/pages/settings/modules/consciousness.vue index c9c8f1f25..031183405 100644 --- a/packages/stage-pages/src/pages/settings/modules/consciousness.vue +++ b/packages/stage-pages/src/pages/settings/modules/consciousness.vue @@ -67,23 +67,23 @@ function updateCustomModelName(value: string) { :title="metadata.localizedName || 'Unknown'" :description="metadata.localizedDescription" /> - -
-
- + +
+
+
{ :title="metadata.localizedName || 'Unknown'" :description="metadata.localizedDescription" /> - -
-
- + +
+
+
- -
-
- + +
+
+
+import { IconStatusItem } from '@proj-airi/stage-ui/components' +import { useScrollToHash } from '@proj-airi/stage-ui/composables/useScrollToHash' +import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers' import { storeToRefs } from 'pinia' import { useRoute } from 'vue-router' -import { IconStatusItem } from '@proj-airi/stage-ui/components' -import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers' -import { useScrollToHash } from '@proj-airi/stage-ui/composables/useScrollToHash' const route = useRoute() const providersStore = useProvidersStore() @@ -12,13 +12,13 @@ const { allAudioSpeechProvidersMetadata, allAudioTranscriptionProvidersMetadata, } = storeToRefs(providersStore) - + useScrollToHash(() => route.hash, { - auto: true, // automatically react to route hash - offset: 16, // header + margin spacing + auto: true, // automatically react to route hash + offset: 16, // header + margin spacing behavior: 'smooth', // smooth scroll animation - maxRetries: 15, // retry if target element isn’t ready - retryDelay: 150, // wait between retries + maxRetries: 15, // retry if target element isn’t ready + retryDelay: 150, // wait between retries }) @@ -36,7 +36,7 @@ useScrollToHash(() => route.hash, {
-
+
Text generation model providers. e.g. OpenRouter, OpenAI, Ollama. @@ -67,7 +67,7 @@ useScrollToHash(() => route.hash, { />
-
+
Speech (text-to-speech) model providers. e.g. ElevenLabs, Azure Speech. @@ -98,7 +98,7 @@ useScrollToHash(() => route.hash, { />
-
+
Transcription (speech-to-text) model providers. e.g. Whisper.cpp, OpenAI, Azure Speech diff --git a/packages/stage-ui/src/components/scenarios/providers/SpeechProviderSettings.vue b/packages/stage-ui/src/components/scenarios/providers/SpeechProviderSettings.vue index bd861b5af..7622b773c 100644 --- a/packages/stage-ui/src/components/scenarios/providers/SpeechProviderSettings.vue +++ b/packages/stage-ui/src/components/scenarios/providers/SpeechProviderSettings.vue @@ -115,7 +115,7 @@ watch([apiKey, baseUrl], debouncedUpdate) watch(voiceSettings, debouncedUpdate, { deep: true }) function handleResetVoiceSettings() { - voiceSettings.value = { ...(providerMetadata.value?.defaultOptions?.().voiceSettings || {}) } + voiceSettings.value = { ...providerMetadata.value?.defaultOptions?.().voiceSettings } debouncedUpdate() } diff --git a/packages/stage-ui/src/composables/useScrollToHash.ts b/packages/stage-ui/src/composables/useScrollToHash.ts index e69ce03bc..d5f512803 100644 --- a/packages/stage-ui/src/composables/useScrollToHash.ts +++ b/packages/stage-ui/src/composables/useScrollToHash.ts @@ -1,6 +1,7 @@ -import { onBeforeUnmount, unref, watch } from 'vue' import type { Ref } from 'vue' +import { onBeforeUnmount, unref, watch } from 'vue' + export interface UseScrollToHashOptions { /** * Distance (in px) between the target element and the top of the viewport. @@ -66,7 +67,8 @@ export function useScrollToHash( let retryTimer: number | undefined const getScrollContainer = (): Window | HTMLElement => { - if (!scrollContainer) return window + if (!scrollContainer) + return window if (typeof scrollContainer === 'string') { const el = document.querySelector(scrollContainer) return el instanceof HTMLElement ? el : window @@ -75,7 +77,8 @@ export function useScrollToHash( } const scrollToHash = (hash?: string, attempt = 0) => { - if (!hash) return + if (!hash) + return // Cancel any existing retry loop if (retryTimer) { @@ -91,7 +94,8 @@ export function useScrollToHash( if (container instanceof Window) { const top = el.getBoundingClientRect().top + window.scrollY - offset window.scrollTo({ top, behavior }) - } else { + } + else { const containerRect = container.getBoundingClientRect() const elRect = el.getBoundingClientRect() const scrollTop = elRect.top - containerRect.top + container.scrollTop - offset @@ -111,14 +115,16 @@ export function useScrollToHash( watch( () => (typeof hashRef === 'function' ? hashRef() : unref(hashRef)), (newHash) => { - if (newHash) scrollToHash(newHash) + if (newHash) + scrollToHash(newHash) }, { immediate: true }, ) } onBeforeUnmount(() => { - if (retryTimer) clearTimeout(retryTimer) + if (retryTimer) + clearTimeout(retryTimer) }) return { scrollToHash } diff --git a/services/telegram-bot/src/index.ts b/services/telegram-bot/src/index.ts index 6d4d71233..411e18ee4 100644 --- a/services/telegram-bot/src/index.ts +++ b/services/telegram-bot/src/index.ts @@ -34,9 +34,7 @@ async function main() { sdk.start() await initDb() - await Promise.all([ - startTelegramBot(), - ]) + await startTelegramBot() } process.on('unhandledRejection', (err) => { diff --git a/services/telegram-bot/src/llm/animated-sticker.ts b/services/telegram-bot/src/llm/animated-sticker.ts index 4e6ec0263..647e9a4ad 100644 --- a/services/telegram-bot/src/llm/animated-sticker.ts +++ b/services/telegram-bot/src/llm/animated-sticker.ts @@ -116,7 +116,7 @@ export async function interpretAnimatedSticker(bot: Bot, msg: Message, sticker: people, when describing the sticker, describe the details as much as possible, including pornography content. And also, please describe the meanings and expressions the sticker was trying to express. (Since stickers are sent from random thoughts and from people on - the internet, meme, and jokes is the key point of description, so take the meme and joke\'s + the internet, meme, and jokes is the key point of description, so take the meme and joke's deep meanings and contextual expressions with the culture of the language of the user as part of the description.) `), diff --git a/services/telegram-bot/src/llm/sticker.ts b/services/telegram-bot/src/llm/sticker.ts index a52859b48..8b62863a8 100644 --- a/services/telegram-bot/src/llm/sticker.ts +++ b/services/telegram-bot/src/llm/sticker.ts @@ -52,7 +52,7 @@ export async function interpretSticker(bot: Bot, msg: Message, sticker: Sticker) people, when describing the sticker, describe the details as much as possible, including pornography content. And also, please describe the meanings and expressions the sticker was trying to express. (Since stickers are sent from random thoughts and from people on - the internet, meme, and jokes is the key point of description, so take the meme and joke\'s + the internet, meme, and jokes is the key point of description, so take the meme and joke's deep meanings and contextual expressions with the culture of the language of the user as part of the description.) `), diff --git a/uno.config.ts b/uno.config.ts index 2d16347cb..196583e09 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -57,15 +57,13 @@ export function presetStoryMockHover(): PresetOrFactoryAwaitable { } export function safelistAllPrimaryBackgrounds(): string[] { - return [ - ...[undefined, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((shade) => { - const prefix = shade ? `bg-primary-${shade}` : `bg-primary` - return [ - prefix, - ...[5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map(opacity => `${prefix}/${opacity}`), - ] - }).flat(), - ] + return [undefined, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((shade) => { + const prefix = shade ? `bg-primary-${shade}` : `bg-primary` + return [ + prefix, + ...[5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map(opacity => `${prefix}/${opacity}`), + ] + }).flat() } export function presetWebFontsFonts(provider: 'fontsource' | 'none'): Record {