style: lint
This commit is contained in:
+7
-2
@@ -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()
|
||||
}
|
||||
|
||||
-1
@@ -60,4 +60,3 @@ export function useElectronMouseAroundWindowBorder(
|
||||
}
|
||||
|
||||
export type UseElectronMouseAroundWindowBorderReturn = ReturnType<typeof useElectronMouseAroundWindowBorder>
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ export interface SidebarLink {
|
||||
}
|
||||
|
||||
function ensureStartingSlash(path: string): string {
|
||||
return /^\//.test(path) ? path : `/${path}`
|
||||
return path.startsWith('/') ? path : `/${path}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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]'))
|
||||
}
|
||||
|
||||
@@ -67,23 +67,23 @@ function updateCustomModelName(value: string) {
|
||||
:title="metadata.localizedName || 'Unknown'"
|
||||
:description="metadata.localizedDescription"
|
||||
/>
|
||||
<RouterLink
|
||||
to="/settings/providers"
|
||||
border="2px solid"
|
||||
class="bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30"
|
||||
rounded-xl p-4
|
||||
flex="~ col items-center justify-center"
|
||||
min-w-50 w-fit
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
<RouterLink
|
||||
to="/settings/providers"
|
||||
border="2px solid"
|
||||
class="border-neutral-100 bg-white dark:border-neutral-900 hover:border-primary-500/30 dark:bg-neutral-900/20 dark:hover:border-primary-400/30"
|
||||
|
||||
flex="~ col items-center justify-center"
|
||||
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative min-w-50 w-fit rounded-xl p-4
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
</fieldset>
|
||||
<div v-else>
|
||||
<RouterLink
|
||||
|
||||
@@ -247,23 +247,23 @@ onUnmounted(() => {
|
||||
:title="metadata.localizedName || 'Unknown'"
|
||||
:description="metadata.localizedDescription"
|
||||
/>
|
||||
<RouterLink
|
||||
to="/settings/providers#transcription"
|
||||
border="2px solid"
|
||||
class="bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30"
|
||||
rounded-xl p-4
|
||||
flex="~ col items-center justify-center"
|
||||
min-w-50 w-fit
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
<RouterLink
|
||||
to="/settings/providers#transcription"
|
||||
border="2px solid"
|
||||
class="border-neutral-100 bg-white dark:border-neutral-900 hover:border-primary-500/30 dark:bg-neutral-900/20 dark:hover:border-primary-400/30"
|
||||
|
||||
flex="~ col items-center justify-center"
|
||||
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative min-w-50 w-fit rounded-xl p-4
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
</fieldset>
|
||||
<div v-else>
|
||||
<RouterLink
|
||||
|
||||
@@ -198,23 +198,23 @@ function updateCustomModelName(value: string) {
|
||||
:title="metadata.localizedName || 'Unknown'"
|
||||
:description="metadata.localizedDescription"
|
||||
/>
|
||||
<RouterLink
|
||||
to="/settings/providers#speech"
|
||||
border="2px solid"
|
||||
class="bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30"
|
||||
rounded-xl p-4
|
||||
flex="~ col items-center justify-center"
|
||||
min-w-50 w-fit
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
<RouterLink
|
||||
to="/settings/providers#speech"
|
||||
border="2px solid"
|
||||
class="border-neutral-100 bg-white dark:border-neutral-900 hover:border-primary-500/30 dark:bg-neutral-900/20 dark:hover:border-primary-400/30"
|
||||
|
||||
flex="~ col items-center justify-center"
|
||||
|
||||
transition="all duration-200 ease-in-out"
|
||||
relative min-w-50 w-fit rounded-xl p-4
|
||||
>
|
||||
<div i-solar:add-circle-line-duotone class="text-2xl text-neutral-500 dark:text-neutral-500" />
|
||||
<div
|
||||
class="bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50"
|
||||
absolute inset-0 z--1
|
||||
style="background-size: 10px 10px; mask-image: linear-gradient(165deg, white 30%, transparent 50%);"
|
||||
/>
|
||||
</RouterLink>
|
||||
</fieldset>
|
||||
<div v-else>
|
||||
<RouterLink
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
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
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -36,7 +36,7 @@ useScrollToHash(() => route.hash, {
|
||||
</div>
|
||||
</div>
|
||||
<div flex="~ row items-center gap-2">
|
||||
<div i-solar:chat-square-like-bold-duotone id="chat" text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div id="chat" i-solar:chat-square-like-bold-duotone text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div>
|
||||
<div>
|
||||
<span text="neutral-300 dark:neutral-500 sm sm:base">Text generation model providers. e.g. OpenRouter, OpenAI, Ollama.</span>
|
||||
@@ -67,7 +67,7 @@ useScrollToHash(() => route.hash, {
|
||||
/>
|
||||
</div>
|
||||
<div flex="~ row items-center gap-2" my-5>
|
||||
<div i-solar:user-speak-rounded-bold-duotone id="speech" text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div id="speech" i-solar:user-speak-rounded-bold-duotone text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div>
|
||||
<div>
|
||||
<span text="neutral-300 dark:neutral-500 sm sm:base">Speech (text-to-speech) model providers. e.g. ElevenLabs, Azure Speech.</span>
|
||||
@@ -98,7 +98,7 @@ useScrollToHash(() => route.hash, {
|
||||
/>
|
||||
</div>
|
||||
<div flex="~ row items-center gap-2" my-5>
|
||||
<div i-solar:microphone-3-bold-duotone id="transcription" text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div id="transcription" i-solar:microphone-3-bold-duotone text="neutral-500 dark:neutral-400 4xl" />
|
||||
<div>
|
||||
<div>
|
||||
<span text="neutral-300 dark:neutral-500 sm sm:base">Transcription (speech-to-text) model providers. e.g. Whisper.cpp, OpenAI, Azure Speech</span>
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -34,9 +34,7 @@ async function main() {
|
||||
sdk.start()
|
||||
|
||||
await initDb()
|
||||
await Promise.all([
|
||||
startTelegramBot(),
|
||||
])
|
||||
await startTelegramBot()
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
|
||||
@@ -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.)
|
||||
`),
|
||||
|
||||
@@ -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.)
|
||||
`),
|
||||
|
||||
+7
-9
@@ -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<string, string | WebFontMeta | (string | WebFontMeta)[]> {
|
||||
|
||||
Reference in New Issue
Block a user