提交 59b14e7f 编写于 作者: D DebugIsFalse

Merge branch 'main' of gitcode.com:git_bot/ai-fe

<template>
<NuxtPwaManifest />
<NuxtLoadingIndicator />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<UNotifications />
<UModals />
<NuxtPwaManifest/>
<NuxtLoadingIndicator/>
<NuxtLayout>
<NuxtPage/>
</NuxtLayout>
<UNotifications/>
<UModals/>
</template>
<script setup>
const { $updateUserInfo } = useUserStore()
......
<template>
<UPopover :popper="{ strategy: 'absolute' }" :ui="{ width: 'w-[156px]' }">
<template #default="{ open }">
<UButton
<UPopover :popper="{ strategy: 'absolute' }" :ui="{ width: 'w-[156px]' }">
<template #default="{ open }">
<UButton
color="gray"
variant="ghost"
square
:class="[open && 'bg-gray-50 dark:bg-gray-800']"
icon="i-heroicons-swatch-16-solid"
:ui="{ icon: { base: 'text-primary-500 dark:text-primary-400' } }"
aria-label="Color picker"
/>
</template>
<template #panel>
<div class="flex flex-col p-2 gap-2">
<div class="grid grid-cols-5 gap-px">
<ColorPickerPill v-for="color in primaryColors" :key="color.value" :color="color" :selected="primary" @select="primary = color" />
</div>
<UDivider />
<div class="grid grid-cols-5 gap-px">
<ColorPickerPill v-for="color in grayColors" :key="color.value" :color="color" :selected="gray" @select="gray = color" />
</div>
</div>
</template>
</UPopover>
variant="ghost"
square
:class="[open && 'bg-gray-50 dark:bg-gray-800']"
icon="i-heroicons-swatch-16-solid"
:ui="{ icon: { base: 'text-primary-500 dark:text-primary-400' } }"
aria-label="Color picker"
/>
</template>
<template #panel>
<div class="flex flex-col p-2 gap-2">
<div class="grid grid-cols-5 gap-px">
<ColorPickerPill v-for="color in primaryColors" :key="color.value" :color="color" :selected="primary"
@select="primary = color"/>
</div>
<UDivider/>
<div class="grid grid-cols-5 gap-px">
<ColorPickerPill v-for="color in grayColors" :key="color.value" :color="color" :selected="gray"
@select="gray = color"/>
</div>
</div>
</template>
</UPopover>
</template>
<script setup lang="ts">
......
<template>
<UTooltip :text="color.value" class="capitalize" :open-delay="500">
<UButton
color="white"
square
:ui="{
<UTooltip :text="color.value" class="capitalize" :open-delay="500">
<UButton
color="white"
square
:ui="{
color: {
white: {
solid: 'ring-0 bg-gray-100 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-800',
......@@ -11,12 +11,12 @@
}
}
}"
:variant="color.value === selected.value ? 'solid' : 'ghost'"
@click.stop.prevent="$emit('select')"
>
<span class="inline-block w-3 h-3 rounded-full" :style="{ backgroundColor: color.hex }" />
</UButton>
</UTooltip>
:variant="color.value === selected.value ? 'solid' : 'ghost'"
@click.stop.prevent="$emit('select')"
>
<span class="inline-block w-3 h-3 rounded-full" :style="{ backgroundColor: color.hex }"/>
</UButton>
</UTooltip>
</template>
<script setup lang="ts">
......
<template>
<div class="flex-grow overflow-hidden bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800">
<div class="p-4 h-full flex flex-col">
<ILogo class="mt-2" />
<UButton
:ui="{ rounded: 'rounded-full' }"
class="flex w-full mt-6"
color="gray"
leading-icon="i-heroicons-plus-20-solid"
size="md"
@click="handleShowCreate"
>
<div class="flex flex-grow justify-between items-center">
<span>新主题</span>
<div v-if="$device.isDesktop" class="flex items-center gap-0.5">
<UKbd>{{ metaSymbol }}</UKbd>
<UKbd>K</UKbd>
</div>
</div>
</UButton>
<div class="flex flex-grow overflow-hidden mt-4">
<INav />
</div>
</div>
</div>
<UDivider />
<div class="bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800 flex flex-col items-center justify-center">
<IUserInfo />
</div>
<UModal v-model="isOpenCreate" :ui="{ width: 'w-full sm:max-w-screen-md' }">
<ICreate @search="handleCloseCreate" />
</UModal>
<div class="flex-grow overflow-hidden bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800">
<div class="p-4 h-full flex flex-col">
<ILogo class="mt-2"/>
<UButton
:ui="{ rounded: 'rounded-full' }"
class="flex w-full mt-6"
color="gray"
leading-icon="i-heroicons-plus-20-solid"
size="md"
@click="handleShowCreate"
>
<div class="flex flex-grow justify-between items-center">
<span>新主题</span>
<div v-if="$device.isDesktop" class="flex items-center gap-0.5">
<UKbd>{{ metaSymbol }}</UKbd>
<UKbd>K</UKbd>
</div>
</div>
</UButton>
<div class="flex flex-grow overflow-hidden mt-4">
<INav/>
</div>
</div>
</div>
<UDivider/>
<div
class="bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800 flex flex-col items-center justify-center">
<IUserInfo/>
</div>
<UModal v-model="isOpenCreate" :ui="{ width: 'w-full sm:max-w-screen-md' }">
<ICreate @search="handleCloseCreate"/>
</UModal>
</template>
<script setup>
const { metaSymbol } = useShortcuts()
......
<template>
<Transition
@enter="onEnter"
@after-enter="onAfterEnter"
@before-leave="onBeforeLeave"
@leave="onLeave"
>
<div v-show="open" class="flex transition-[height] overflow-hidden"><slot /></div>
</Transition>
<Transition
@enter="onEnter"
@after-enter="onAfterEnter"
@before-leave="onBeforeLeave"
@leave="onLeave"
>
<div v-show="open" class="flex transition-[height] overflow-hidden">
<slot/>
</div>
</Transition>
</template>
<script setup>
defineProps({
......
<template>
<UModal :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<div class="flex p-6 gap-4">
<div class="flex">
<div class="mx-auto flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-red-100">
<UIcon name="i-heroicons-exclamation-triangle" class="w-6 h-6 text-red-600" />
</div>
</div>
<div class="flex-grow flex flex-col">
<div class="text-base leading-6 text-gray-900 dark:text-gray-300 truncate">{{ title }}</div>
<div class="mt-2 text-sm text-gray-500">{{ description }}</div>
</div>
</div>
<div class="p-4 flex justify-end gap-2">
<UButton color="white" @click="handleCancel">取消</UButton>
<UButton color="red" @click="handleSuccess">确定</UButton>
</div>
</UModal>
<UModal :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<div class="flex p-6 gap-4">
<div class="flex">
<div class="mx-auto flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-red-100">
<UIcon name="i-heroicons-exclamation-triangle" class="w-6 h-6 text-red-600"/>
</div>
</div>
<div class="flex-grow flex flex-col">
<div class="text-base leading-6 text-gray-900 dark:text-gray-300 truncate">{{ title }}</div>
<div class="mt-2 text-sm text-gray-500">{{ description }}</div>
</div>
</div>
<div class="p-4 flex justify-end gap-2">
<UButton color="white" @click="handleCancel">取消</UButton>
<UButton color="red" @click="handleSuccess">确定</UButton>
</div>
</UModal>
</template>
<script setup>
defineProps({
......
<template>
<div class="max-w-screen-md w-full flex flex-col space-y-4 p-6">
<UCard
class="transition-[box-shadow] hover:ring-2 has-[textarea:focus]:ring-2 has-[textarea:focus]:ring-primary-500 dark:has-[textarea:focus]:ring-primary-400"
:ui="cardUI"
>
<UTextarea
v-model="query"
name="createInput"
autoresize
placeholder="输入搜索内容..."
:rows="5"
variant="none"
:padded="false"
maxlength="2000"
/>
<div class="flex justify-between items-center">
<div class="flex items-center gap-2">
<UTooltip class="relative" :text="isPro ? '已开启专家搜索' : '已关闭专家搜索'" :shortcuts="[metaSymbol, 'O']">
<div v-show="!isPro" class="absolute w-7 h-0.5 rotate-45 top-3.5 left-1 bg-gray-700 dark:bg-gray-200 hover:bg-gray-900 dark:hover:bg-white rounded"/>
<UButton
:ui="{ rounded: 'rounded-full' }"
:icon="isPro ? 'i-heroicons-sparkles-20-solid' : 'i-heroicons-sparkles-20-solid'"
color="gray"
variant="ghost"
@click="handleTogglePro"
/>
</UTooltip>
<USelectMenu
v-model="selectedRepo"
:ui-menu="menuUI"
:options="$repos"
placeholder="选择 GitHub 项目"
value-attribute="label"
option-attribute="label"
>
<UTooltip v-if="!selectedRepo" :text="isPro ? '选择 GitHub 项目' : '选择 GitHub 项目(需开启专家搜索)'">
<UButton
:ui="{ rounded: 'rounded-full' }"
icon="i-simple-icons-github"
color="gray"
variant="ghost"
:disabled="!isPro"
/>
</UTooltip>
<div class="max-w-screen-md w-full flex flex-col space-y-4 p-6">
<UCard
class="transition-[box-shadow] hover:ring-2 has-[textarea:focus]:ring-2 has-[textarea:focus]:ring-primary-500 dark:has-[textarea:focus]:ring-primary-400"
:ui="cardUI"
>
<UTextarea
v-model="query"
name="createInput"
autoresize
placeholder="输入搜索内容..."
:rows="5"
variant="none"
:padded="false"
maxlength="2000"
/>
<div class="flex justify-between items-center">
<div class="flex items-center gap-2">
<UTooltip class="relative" :text="isPro ? '已开启专家搜索' : '已关闭专家搜索'" :shortcuts="[metaSymbol, 'O']">
<div v-show="!isPro"
class="absolute w-7 h-0.5 rotate-45 top-3.5 left-1 bg-gray-700 dark:bg-gray-200 hover:bg-gray-900 dark:hover:bg-white rounded"/>
<UButton
:ui="{ rounded: 'rounded-full' }"
:icon="isPro ? 'i-heroicons-sparkles-20-solid' : 'i-heroicons-sparkles-20-solid'"
color="gray"
variant="ghost"
@click="handleTogglePro"
/>
</UTooltip>
<USelectMenu
v-model="selectedRepo"
:ui-menu="menuUI"
:options="$repos"
placeholder="选择 GitHub 项目"
value-attribute="label"
option-attribute="label"
>
<UTooltip v-if="!selectedRepo" :text="isPro ? '选择 GitHub 项目' : '选择 GitHub 项目(需开启专家搜索)'">
<UButton
:ui="{ rounded: 'rounded-full' }"
icon="i-simple-icons-github"
color="gray"
variant="ghost"
:disabled="!isPro"
/>
</UTooltip>
<UButton v-else color="gray" variant="ghost" :class="{ 'group': selectedRepo }">
<UIcon name="i-simple-icons-github" />
<span>{{ selectedRepo }}</span>
<UIcon name="i-heroicons-chevron-down-20-solid" class="text-xl flex group-hover:hidden" />
<UButton
v-if="selectedRepo"
class="hidden group-hover:flex"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
color="gray"
variant="link"
@click.stop.prevent="handleClearRepo"
/>
</UButton>
</USelectMenu>
</div>
<UTooltip text="搜索" :shortcuts="[metaSymbol, '↵']">
<UButton
:ui="{ rounded: 'rounded-full' }"
icon="i-heroicons-chevron-right-20-solid"
:loading="loading"
:disabled="query === ''"
size="md"
@click="handleSearch"
/>
</UTooltip>
</div>
</UCard>
</div>
<UButton v-else color="gray" variant="ghost" :class="{ 'group': selectedRepo }">
<UIcon name="i-simple-icons-github"/>
<span>{{ selectedRepo }}</span>
<UIcon name="i-heroicons-chevron-down-20-solid" class="text-xl flex group-hover:hidden"/>
<UButton
v-if="selectedRepo"
class="hidden group-hover:flex"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
color="gray"
variant="link"
@click.stop.prevent="handleClearRepo"
/>
</UButton>
</USelectMenu>
</div>
<UTooltip text="搜索" :shortcuts="[metaSymbol, '↵']">
<UButton
:ui="{ rounded: 'rounded-full' }"
icon="i-heroicons-chevron-right-20-solid"
:loading="loading"
:disabled="query === ''"
size="md"
@click="handleSearch"
/>
</UTooltip>
</div>
</UCard>
</div>
</template>
<script setup>
const { $repos } = storeToRefs(useReposStore())
......
<template>
<div class="flex flex-col justify-center h-72 items-center text-gray-300" :class="{ 'h-36': size === 'xs' }">
<UIcon name="i-heroicons-inbox" class="text-6xl" />
<div>暂无数据</div>
</div>
<div class="flex flex-col justify-center h-72 items-center text-gray-300" :class="{ 'h-36': size === 'xs' }">
<UIcon name="i-heroicons-inbox" class="text-6xl"/>
<div>暂无数据</div>
</div>
</template>
<script setup>
defineProps({
......
<template>
<div class="grid min-h-full place-items-center px-6 py-24 sm:py-32 lg:px-8">
<div class="text-center">
<p class="text-base font-semibold text-red-600">{{ code }}</p>
<h1 class="mt-4 text-3xl font-bold tracking-tight sm:text-5xl">{{ errorTitle }}</h1>
<p class="mt-6 text-base leading-7">{{ errorDescription }}</p>
<div class="mt-10 flex items-center justify-center gap-x-6">
<UButton to="/" size="lg">返回首页</UButton>
</div>
</div>
</div>
<div class="grid min-h-full place-items-center px-6 py-24 sm:py-32 lg:px-8">
<div class="text-center">
<p class="text-base font-semibold text-red-600">{{ code }}</p>
<h1 class="mt-4 text-3xl font-bold tracking-tight sm:text-5xl">{{ errorTitle }}</h1>
<p class="mt-6 text-base leading-7">{{ errorDescription }}</p>
<div class="mt-10 flex items-center justify-center gap-x-6">
<UButton to="/" size="lg">返回首页</UButton>
</div>
</div>
</div>
</template>
<script setup>
const props = defineProps({
......
<template>
<div class="flex justify-center">
<NuxtLink to="/" class="font-mono text-2xl font-medium">GitBot.<span class="text-primary">AI</span></NuxtLink>
</div>
<div class="flex justify-center">
<NuxtLink to="/" class="font-mono text-2xl font-medium">GitBot.<span class="text-primary">AI</span></NuxtLink>
</div>
</template>
\ No newline at end of file
<template>
<div class="flex md:hidden flex-shrink-0">
<UButton
class="z-20"
:class="{ 'fixed top-2 left-2' : fixed }"
color="white"
trailing-icon="i-heroicons-bars-3-20-solid"
@click="handleToggleAside"
/>
<USlideover
v-model="isOpenAside"
class="w-64"
side="left"
:overlay="false"
>
<UButton
class="absolute top-2 right-2 z-20"
color="white"
trailing-icon="i-heroicons-x-mark-20-solid"
@click="handleToggleAside"
/>
<IAside />
</USlideover>
</div>
<div class="flex md:hidden flex-shrink-0">
<UButton
class="z-20"
:class="{ 'fixed top-2 left-2' : fixed }"
color="white"
trailing-icon="i-heroicons-bars-3-20-solid"
@click="handleToggleAside"
/>
<USlideover
v-model="isOpenAside"
class="w-64"
side="left"
:overlay="false"
>
<UButton
class="absolute top-2 right-2 z-20"
color="white"
trailing-icon="i-heroicons-x-mark-20-solid"
@click="handleToggleAside"
/>
<IAside/>
</USlideover>
</div>
</template>
<script setup>
defineProps({
......
<template>
<div class="flex flex-col w-full gap-2">
<UButton
leading-icon="i-heroicons-home"
color="gray"
variant="ghost"
size="md"
label="首页"
to="/"
/>
<UButton
leading-icon="i-heroicons-rectangle-stack"
color="gray"
variant="ghost"
size="md"
label="主题"
to="/library"
/>
<ISearchHistory @sign="$openSign" />
<ClientOnly>
<UButton
v-if="!$isSignIn"
class="flex gap-2 justify-center"
size="lg"
label="登录"
@click="$openSign"
/>
</ClientOnly>
</div>
<UModal v-model="$isOpenSign">
<ISign @close="$closeSign" />
</UModal>
<div class="flex flex-col w-full gap-2">
<UButton
leading-icon="i-heroicons-home"
color="gray"
variant="ghost"
size="md"
label="首页"
to="/"
/>
<UButton
leading-icon="i-heroicons-rectangle-stack"
color="gray"
variant="ghost"
size="md"
label="主题"
to="/library"
/>
<ISearchHistory @sign="$openSign"/>
<ClientOnly>
<UButton
v-if="!$isSignIn"
class="flex gap-2 justify-center"
size="lg"
label="登录"
@click="$openSign"
/>
</ClientOnly>
</div>
<UModal v-model="$isOpenSign">
<ISign @close="$closeSign"/>
</UModal>
</template>
<script setup>
const { $isSignIn, $isOpenSign } = storeToRefs(useUserStore())
......
<template>
<div class="flex flex-col overflow-hidden group">
<div class="flex justify-between">
<UButton
class="flex-grow cursor-default hover:bg-transparent dark:hover:bg-transparent"
leading-icon="i-heroicons-queue-list"
color="gray"
variant="ghost"
size="md"
label="浏览记录"
/>
<UButton
class="hidden group-hover:flex"
label="清空"
size="md"
variant="link"
@click="handleClear"
/>
</div>
<ClientOnly>
<div v-auto-animate class="flex overflow-y-auto flex-col gap-1 border-l border-gray-200 dark:border-gray-800 pl-2 ml-5">
<template v-for="item in $searchHistory.reverse()" :key="item.c_id">
<UButton
class="flex text-gray-400"
color="gray"
variant="ghost"
size="xs"
long
:to="`/search/${item.c_id}`"
>
<div class="flex-grow truncate" :title="item.title">{{ item.title }}</div>
</UButton>
</template>
</div>
</ClientOnly>
</div>
<div class="flex flex-col overflow-hidden group">
<div class="flex justify-between">
<UButton
class="flex-grow cursor-default hover:bg-transparent dark:hover:bg-transparent"
leading-icon="i-heroicons-queue-list"
color="gray"
variant="ghost"
size="md"
label="浏览记录"
/>
<UButton
class="hidden group-hover:flex"
label="清空"
size="md"
variant="link"
@click="handleClear"
/>
</div>
<ClientOnly>
<div v-auto-animate
class="flex overflow-y-auto flex-col gap-1 border-l border-gray-200 dark:border-gray-800 pl-2 ml-5">
<template v-for="item in $searchHistory.reverse()" :key="item.c_id">
<UButton
class="flex text-gray-400"
color="gray"
variant="ghost"
size="xs"
long
:to="`/search/${item.c_id}`"
>
<div class="flex-grow truncate" :title="item.title">{{ item.title }}</div>
</UButton>
</template>
</div>
</ClientOnly>
</div>
</template>
<script setup>
const { $searchHistory } = storeToRefs(useSearchStore())
......
<template>
<div class="flex flex-col items-start gap-4 p-4">
<div class="flex w-full justify-between">
<ILogo />
<UButton
color="gray"
variant="ghost"
leading-icon="i-heroicons-x-mark-20-solid"
@click="handleClose"
/>
</div>
<div>登录以继续使用</div>
<UButton
block
color="gray"
size="md"
@click="handleGetSignUrl('gitcode')"
>
<img src="~/assets/svg/logo-gitcode.svg" >
使用 GitCode 登录
</UButton>
<UButton
block
leading-icon="i-simple-icons-github"
label="使用 GitHub 登录"
color="gray"
size="md"
@click="handleGetSignUrl('github')"
/>
<UButton
block
leading-icon="i-simple-icons-google"
label="使用 Google 登录"
color="gray"
size="md"
disabled
/>
<!-- <UDivider label="或" />-->
<!-- <UInput-->
<!-- class="w-full"-->
<!-- v-model="email"-->
<!-- placeholder="输入邮箱地址..."-->
<!-- size="md"-->
<!-- />-->
<!-- <UButton-->
<!-- block-->
<!-- leading-icon="i-heroicons-envelope-20-solid"-->
<!-- label="邮箱登录"-->
<!-- size="md"-->
<!-- @click="handleSign"-->
<!-- />-->
</div>
<div class="flex flex-col items-start gap-4 p-4">
<div class="flex w-full justify-between">
<ILogo/>
<UButton
color="gray"
variant="ghost"
leading-icon="i-heroicons-x-mark-20-solid"
@click="handleClose"
/>
</div>
<div>登录以继续使用</div>
<UButton
block
color="gray"
size="md"
@click="handleGetSignUrl('gitcode')"
>
<img src="~/assets/svg/logo-gitcode.svg">
使用 GitCode 登录
</UButton>
<UButton
block
leading-icon="i-simple-icons-github"
label="使用 GitHub 登录"
color="gray"
size="md"
@click="handleGetSignUrl('github')"
/>
<UButton
block
leading-icon="i-simple-icons-google"
label="使用 Google 登录"
color="gray"
size="md"
disabled
/>
<!-- <UDivider label="或" />-->
<!-- <UInput-->
<!-- class="w-full"-->
<!-- v-model="email"-->
<!-- placeholder="输入邮箱地址..."-->
<!-- size="md"-->
<!-- />-->
<!-- <UButton-->
<!-- block-->
<!-- leading-icon="i-heroicons-envelope-20-solid"-->
<!-- label="邮箱登录"-->
<!-- size="md"-->
<!-- @click="handleSign"-->
<!-- />-->
</div>
</template>
<script setup>
const emits = defineEmits(['close', 'signIn'])
......
<template>
<div class="flex flex-col w-full">
<ClientOnly>
<template v-if="$isSignIn">
<div class="flex flex-grow justify-between items-center p-4">
<UDropdown class="flex flex-grow" :items="items">
<UButton class="flex flex-grow" color="gray" variant="ghost">
<div class="flex flex-grow items-center gap-2">
<UAvatar :src="$info.avatar_url" />
<div>{{ $info.nickname }}</div>
<UBadge v-if="$info.pro" size="xs" color="yellow" variant="soft" label="PRO" />
<UBadge v-else size="xs" color="gray" variant="soft" label="FREE" />
</div>
<UIcon name="i-heroicons-chevron-down-20-solid" class="text-lg" />
</UButton>
</UDropdown>
</div>
<UDivider />
</template>
</ClientOnly>
<div class="flex justify-between gap-2 p-4">
<UButton
color="gray"
variant="ghost"
label="问题反馈"
/>
<ClientOnly>
<div class="flex">
<ColorPicker />
<USelectMenu
v-model="colorMode.preference"
:ui-menu="{ width: 'w-32' }"
:options="themeItems"
value-attribute="value"
>
<UButton
color="gray"
variant="ghost"
square
:icon="colorMode.value === 'dark' ? 'i-heroicons-moon-16-solid' : 'i-heroicons-sun-16-solid'"
aria-label="Theme"
/>
</USelectMenu>
<USelectMenu
v-if="false"
:ui-menu="{ width: 'w-32' }"
:model-value="$lang"
:options="$langOptions"
value-attribute="value"
>
<UButton
icon="i-heroicons-language-16-solid"
color="gray"
variant="ghost"
/>
</USelectMenu>
</div>
</ClientOnly>
</div>
</div>
<div class="flex flex-col w-full">
<ClientOnly>
<template v-if="$isSignIn">
<div class="flex flex-grow justify-between items-center p-4">
<UDropdown class="flex flex-grow" :items="items">
<UButton class="flex flex-grow" color="gray" variant="ghost">
<div class="flex flex-grow items-center gap-2">
<UAvatar :src="$info.avatar_url"/>
<div>{{ $info.nickname }}</div>
<UBadge v-if="$info.pro" size="xs" color="yellow" variant="soft" label="PRO"/>
<UBadge v-else size="xs" color="gray" variant="soft" label="FREE"/>
</div>
<UIcon name="i-heroicons-chevron-down-20-solid" class="text-lg"/>
</UButton>
</UDropdown>
</div>
<UDivider/>
</template>
</ClientOnly>
<div class="flex justify-between gap-2 p-4">
<UButton
color="gray"
variant="ghost"
label="问题反馈"
/>
<ClientOnly>
<div class="flex">
<ColorPicker/>
<USelectMenu
v-model="colorMode.preference"
:ui-menu="{ width: 'w-32' }"
:options="themeItems"
value-attribute="value"
>
<UButton
color="gray"
variant="ghost"
square
:icon="colorMode.value === 'dark' ? 'i-heroicons-moon-16-solid' : 'i-heroicons-sun-16-solid'"
aria-label="Theme"
/>
</USelectMenu>
<USelectMenu
v-if="false"
:ui-menu="{ width: 'w-32' }"
:model-value="$lang"
:options="$langOptions"
value-attribute="value"
>
<UButton
icon="i-heroicons-language-16-solid"
color="gray"
variant="ghost"
/>
</USelectMenu>
</div>
</ClientOnly>
</div>
</div>
</template>
<script setup>
const { $signOut } = useUserStore()
......
<template>
<UDropdown class="flex flex-grow" :items="actionItems">
<UButton
color="gray"
variant="ghost"
square
icon="i-heroicons-ellipsis-horizontal"
/>
</UDropdown>
<ILibraryEdit :id="id" ref="refEdit" />
<UDropdown class="flex flex-grow" :items="actionItems">
<UButton
color="gray"
variant="ghost"
square
icon="i-heroicons-ellipsis-horizontal"
/>
</UDropdown>
<ILibraryEdit :id="id" ref="refEdit"/>
</template>
<script setup>
import { IConfirm } from '#components'
......
<template>
<UDropdown class="flex flex-grow" :items="actionItems">
<UButton
color="gray"
variant="ghost"
:size="size"
square
icon="i-heroicons-ellipsis-horizontal"
/>
</UDropdown>
<UDropdown class="flex flex-grow" :items="actionItems">
<UButton
color="gray"
variant="ghost"
:size="size"
square
icon="i-heroicons-ellipsis-horizontal"
/>
</UDropdown>
</template>
<script setup>
import { IConfirm } from '#components'
......
<template>
<ULink :to="`/library/${item.id}`">
<UCard :ui="cardUI">
<div class="flex flex-col gap-1">
<div>{{ item.name }}</div>
<div class="flex">
<div class="flex items-center text-gray-500 text-sm gap-0.5">
<UIcon name="i-heroicons-square-3-stack-3d" />
<span>{{ item.record_count }}</span>
</div>
</div>
</div>
</UCard>
</ULink>
<ULink :to="`/library/${item.id}`">
<UCard :ui="cardUI">
<div class="flex flex-col gap-1">
<div>{{ item.name }}</div>
<div class="flex">
<div class="flex items-center text-gray-500 text-sm gap-0.5">
<UIcon name="i-heroicons-square-3-stack-3d"/>
<span>{{ item.record_count }}</span>
</div>
</div>
</div>
</UCard>
</ULink>
</template>
<script setup>
defineProps({
......
<template>
<UModal
:model-value="!id ? $isLibraryCreateOpen : updateVisible"
:ui="{ width: 'w-96 sm:max-w-screen-md' }"
@update:model-value="handleCloseModal"
>
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<div class="flex items-center justify-between">
<div v-if="!id" class="text-xl">创建合集</div>
<div v-else class="text-xl">更新合集</div>
<UButton
leading-icon="i-heroicons-x-mark-20-solid"
color="gray"
variant="ghost"
@click="handleClose"
/>
</div>
</template>
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-1">
<div class="flex content-center items-center justify-between text-sm">
<label class="block font-medium text-gray-700 dark:text-gray-200">标题</label>
</div>
<UInput
v-model="title"
placeholder="合集标题"
autofocus
/>
</div>
<div class="flex flex-col gap-1">
<div class="flex content-center items-center justify-between text-sm">
<label class="block font-medium text-gray-700 dark:text-gray-200">
描述
<span class="text-gray-400 dark:text-gray-100">(可选)</span>
</label>
</div>
<UTextarea
v-model="description"
placeholder="合集描述"
/>
</div>
</div>
<template #footer>
<div class="flex justify-end">
<UButton
v-if="!id"
size="md"
label="创建"
:loading="loading"
:disabled="!title"
@click="handleCreate"
/>
<UButton
v-else
size="md"
label="更新"
:loading="loading"
:disabled="!title"
@click="handleUpdate"
/>
</div>
</template>
</UCard>
</UModal>
<UModal
:model-value="!id ? $isLibraryCreateOpen : updateVisible"
:ui="{ width: 'w-96 sm:max-w-screen-md' }"
@update:model-value="handleCloseModal"
>
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<div class="flex items-center justify-between">
<div v-if="!id" class="text-xl">创建合集</div>
<div v-else class="text-xl">更新合集</div>
<UButton
leading-icon="i-heroicons-x-mark-20-solid"
color="gray"
variant="ghost"
@click="handleClose"
/>
</div>
</template>
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-1">
<div class="flex content-center items-center justify-between text-sm">
<label class="block font-medium text-gray-700 dark:text-gray-200">标题</label>
</div>
<UInput
v-model="title"
placeholder="合集标题"
autofocus
/>
</div>
<div class="flex flex-col gap-1">
<div class="flex content-center items-center justify-between text-sm">
<label class="block font-medium text-gray-700 dark:text-gray-200">
描述
<span class="text-gray-400 dark:text-gray-100">(可选)</span>
</label>
</div>
<UTextarea
v-model="description"
placeholder="合集描述"
/>
</div>
</div>
<template #footer>
<div class="flex justify-end">
<UButton
v-if="!id"
size="md"
label="创建"
:loading="loading"
:disabled="!title"
@click="handleCreate"
/>
<UButton
v-else
size="md"
label="更新"
:loading="loading"
:disabled="!title"
@click="handleUpdate"
/>
</div>
</template>
</UCard>
</UModal>
</template>
<script setup>
const { $isLibraryCreateOpen, $collection } = storeToRefs(useLibraryStore())
......
<template>
<ILibraryCreate :id="id" ref="refCreate" />
<ILibraryCreate :id="id" ref="refCreate"/>
</template>
<script setup>
defineProps({
......
<template>
<div class="flex flex-col w-full items-center sticky top-0 bg-white dark:bg-black z-10">
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6">
<div class="flex justify-between items-center gap-4">
<div class="flex gap-4">
<IMenuSider />
<div v-if="!collect" class="flex flex-shrink-0 items-center text-xl gap-2">
<UIcon name="i-heroicons-rectangle-stack-20-solid" />
<div>主题</div>
</div>
<template v-else>
<UButton
icon="i-heroicons-chevron-left"
color="gray"
variant="ghost"
to="/library"
/>
<div class="flex items-center text-xl gap-2">
<UIcon name="i-heroicons-squares-2x2" />
<div>{{ collect }}</div>
<UBadge color="gray" variant="soft" :label="count" />
</div>
</template>
</div>
<div class="flex flex-grow justify-end items-center gap-4">
<div class="flex">
<IActionCollect v-if="collect" :id="collectId" />
</div>
<div v-if="!collect" class="flex">
<UInput
v-model="searchQuery"
name="queryInput"
:ui="{ icon: { trailing: { pointer: '' } } }"
:loading="searchLoading"
icon="i-heroicons-magnifying-glass-20-solid"
placeholder="搜索你的主题..."
size="md"
>
<template #trailing>
<UButton
v-show="searchQuery !== ''"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="handleClear"
/>
</template>
</UInput>
</div>
</div>
</div>
<div v-if="description" class="text-gray-500 ml-12 mt-2">{{ description }}</div>
</div>
<UDivider />
<div v-if="showTabs" class="w-full p-6 block lg:hidden">
<UTabs :model-value="tab" :items="tabs" @update:model-value="handleChangeTab" />
</div>
</div>
<div class="flex flex-col w-full items-center sticky top-0 bg-white dark:bg-black z-10">
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6">
<div class="flex justify-between items-center gap-4">
<div class="flex gap-4">
<IMenuSider/>
<div v-if="!collect" class="flex flex-shrink-0 items-center text-xl gap-2">
<UIcon name="i-heroicons-rectangle-stack-20-solid"/>
<div>主题</div>
</div>
<template v-else>
<UButton
icon="i-heroicons-chevron-left"
color="gray"
variant="ghost"
to="/library"
/>
<div class="flex items-center text-xl gap-2">
<UIcon name="i-heroicons-squares-2x2"/>
<div>{{ collect }}</div>
<UBadge color="gray" variant="soft" :label="count"/>
</div>
</template>
</div>
<div class="flex flex-grow justify-end items-center gap-4">
<div class="flex">
<IActionCollect v-if="collect" :id="collectId"/>
</div>
<div v-if="!collect" class="flex">
<UInput
v-model="searchQuery"
name="queryInput"
:ui="{ icon: { trailing: { pointer: '' } } }"
:loading="searchLoading"
icon="i-heroicons-magnifying-glass-20-solid"
placeholder="搜索你的主题..."
size="md"
>
<template #trailing>
<UButton
v-show="searchQuery !== ''"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="handleClear"
/>
</template>
</UInput>
</div>
</div>
</div>
<div v-if="description" class="text-gray-500 ml-12 mt-2">{{ description }}</div>
</div>
<UDivider/>
<div v-if="showTabs" class="w-full p-6 block lg:hidden">
<UTabs :model-value="tab" :items="tabs" @update:model-value="handleChangeTab"/>
</div>
</div>
</template>
<script setup>
defineProps({
......
<template>
<UModal v-model="$isLibrarySelectOpen" :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<div class="flex items-center justify-between">
<div class="text-xl">选择合集</div>
<UButton
leading-icon="i-heroicons-x-mark-20-solid"
color="gray"
variant="ghost"
@click="handleClose"
/>
</div>
</template>
<div class="flex flex-col gap-4">
<UButton
leading-icon="i-heroicons-plus-20-solid"
label="创建新合集"
color="gray"
@click="handleOpenCreate"
/>
<div class="flex flex-col gap-2">
<UButton
v-for="item in $collection"
:key="item.id"
color="white"
size="md"
class="flex"
@click="handleSelected(item.id)"
>
<div class="flex flex-grow justify-between items-center">
<div>{{ item.name }}</div>
<UIcon v-if="selected.includes(item.id)" name="i-heroicons-check-circle-20-solid" class="text-primary text-lg" />
</div>
</UButton>
</div>
</div>
<template #footer>
<div class="flex justify-end">
<UButton
size="md"
label="保存"
:loading="loading"
@click="handleSave"
/>
</div>
</template>
</UCard>
</UModal>
<UModal v-model="$isLibrarySelectOpen" :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<div class="flex items-center justify-between">
<div class="text-xl">选择合集</div>
<UButton
leading-icon="i-heroicons-x-mark-20-solid"
color="gray"
variant="ghost"
@click="handleClose"
/>
</div>
</template>
<div class="flex flex-col gap-4">
<UButton
leading-icon="i-heroicons-plus-20-solid"
label="创建新合集"
color="gray"
@click="handleOpenCreate"
/>
<div class="flex flex-col gap-2">
<UButton
v-for="item in $collection"
:key="item.id"
color="white"
size="md"
class="flex"
@click="handleSelected(item.id)"
>
<div class="flex flex-grow justify-between items-center">
<div>{{ item.name }}</div>
<UIcon v-if="selected.includes(item.id)" name="i-heroicons-check-circle-20-solid"
class="text-primary text-lg"/>
</div>
</UButton>
</div>
</div>
<template #footer>
<div class="flex justify-end">
<UButton
size="md"
label="保存"
:loading="loading"
@click="handleSave"
/>
</div>
</template>
</UCard>
</UModal>
</template>
<script setup>
const { $isLibrarySelectOpen, $selectCollectionId, $selectThreadId, $collection } = storeToRefs(useLibraryStore())
......
<template>
<ULink :to="`/search/${thread.c_id}`" class="flex flex-col group">
<div class="flex items-center gap-2 transition group-hover:text-primary">{{ thread.title }}</div>
<div v-if="false" class="break-word text-balance line-clamp-2 font-sans text-sm" :class="textColor">
{{ thread.description }}
</div>
</ULink>
<div class="flex justify-between items-center">
<div class="flex gap-4">
<UTooltip class="flex items-center text-sm gap-0.5" :class="textColor" :text="thread.is_public ? '公开主题,链接可被发现' : '私密主题,仅自己可见'">
<UIcon :name="thread.is_public ? 'i-heroicons-lock-open' : 'i-heroicons-lock-closed'" />
<span>{{ thread.is_public ? '公开' : '私有' }}</span>
</UTooltip>
<!-- <div class="flex items-center text-sm gap-0.5" :class="textColor">-->
<!-- <UIcon name="i-heroicons-eye" />-->
<!-- <span>1</span>-->
<!-- </div>-->
<div class="flex" :class="textColor">
<UTooltip class="flex items-center text-sm gap-0.5">
<UIcon name="i-heroicons-clock" />
<span>{{ useTime(thread.create_time) }}</span>
<template #text>
{{ toValue(useDateFormat(thread.create_time, 'YYYY年M月D日 HH:mm')) }}
</template>
</UTooltip>
</div>
</div>
<div class="flex gap-4">
<template v-for="collect in thread.collections" :key="collect.collection_id">
<UButton
:ui="{ rounded: 'rounded-full' }"
:to="`/library/${collect.collection_id}`"
color="white"
size="2xs"
:label="collect.collection_name"
/>
</template>
<UTooltip v-if="!thread.collections.length" text="添加到收藏">
<UButton
color="gray"
variant="ghost"
size="2xs"
square
icon="i-heroicons-plus"
@click="handleOpenSelect"
/>
</UTooltip>
<IActionThread
:collection_id="thread.collections.length ? thread.collections[0].collection_id : ''"
:c_id="item.c_id"
size="2xs"
@delete="handleDeletedThread"
/>
</div>
</div>
<UDivider />
<ULink :to="`/search/${thread.c_id}`" class="flex flex-col group">
<div class="flex items-center gap-2 transition group-hover:text-primary">{{ thread.title }}</div>
<div v-if="false" class="break-word text-balance line-clamp-2 font-sans text-sm" :class="textColor">
{{ thread.description }}
</div>
</ULink>
<div class="flex justify-between items-center">
<div class="flex gap-4">
<UTooltip class="flex items-center text-sm gap-0.5" :class="textColor"
:text="thread.is_public ? '公开主题,链接可被发现' : '私密主题,仅自己可见'">
<UIcon :name="thread.is_public ? 'i-heroicons-lock-open' : 'i-heroicons-lock-closed'"/>
<span>{{ thread.is_public ? '公开' : '私有' }}</span>
</UTooltip>
<!-- <div class="flex items-center text-sm gap-0.5" :class="textColor">-->
<!-- <UIcon name="i-heroicons-eye" />-->
<!-- <span>1</span>-->
<!-- </div>-->
<div class="flex" :class="textColor">
<UTooltip class="flex items-center text-sm gap-0.5">
<UIcon name="i-heroicons-clock"/>
<span>{{ useTime(thread.create_time) }}</span>
<template #text>
{{ toValue(useDateFormat(thread.create_time, 'YYYY年M月D日 HH:mm')) }}
</template>
</UTooltip>
</div>
</div>
<div class="flex gap-4">
<template v-for="collect in thread.collections" :key="collect.collection_id">
<UButton
:ui="{ rounded: 'rounded-full' }"
:to="`/library/${collect.collection_id}`"
color="white"
size="2xs"
:label="collect.collection_name"
/>
</template>
<UTooltip v-if="!thread.collections.length" text="添加到收藏">
<UButton
color="gray"
variant="ghost"
size="2xs"
square
icon="i-heroicons-plus"
@click="handleOpenSelect"
/>
</UTooltip>
<IActionThread
:collection_id="thread.collections.length ? thread.collections[0].collection_id : ''"
:c_id="item.c_id"
size="2xs"
@delete="handleDeletedThread"
/>
</div>
</div>
<UDivider/>
</template>
<script setup>
const Layout = inject('Layout')
......
<template>
<div class="grid grid-cols-1">
<MDC v-if="content" class="prose dark:prose-invert max-w-none" :class="'prose-' + size" :value="content" tag="article" />
</div>
<div class="grid grid-cols-1">
<MDC v-if="content" class="prose dark:prose-invert max-w-none" :class="'prose-' + size" :value="content"
tag="article"/>
</div>
</template>
<script setup>
defineProps({
......
<template>
<div class="flex flex-col lg:flex-row gap-6 space-x-0 lg:space-x-6">
<div class="flex flex-grow flex-col gap-6">
<div class="grid">
<slot name="title" />
</div>
<slot />
</div>
<div v-if="$slots.extra" class="flex flex-col w-full lg:w-64 flex-shrink-0 gap-6">
<slot name="extra" />
</div>
</div>
<div class="flex flex-col lg:flex-row gap-6 space-x-0 lg:space-x-6">
<div class="flex flex-grow flex-col gap-6">
<div class="grid">
<slot name="title"/>
</div>
<slot/>
</div>
<div v-if="$slots.extra" class="flex flex-col w-full lg:w-64 flex-shrink-0 gap-6">
<slot name="extra"/>
</div>
</div>
</template>
<script setup>
</script>
\ No newline at end of file
<template>
<div class="flex w-full justify-center">
<UCard
class="hover:ring-2 has-[textarea:focus]:ring-2 has-[textarea:focus]:ring-primary-500 dark:has-[textarea:focus]:ring-primary-400"
:ui="cardUI"
>
<UTextarea
ref="queryInput"
v-model="continueQuestion"
class="flex-grow"
name="queryInput"
:rows="1"
:maxrows="10"
autoresize
:placeholder="placeholder"
size="xl"
:padded="false"
variant="none"
maxlength="2000"
@focus="handleInputFocus"
@blur="handleInputBlur"
/>
<div class="flex flex-shrink-0 gap-2">
<UButton
v-if="!asking"
:ui="{ rounded: 'rounded-full' }"
:disabled="!continueQuestion"
trailing-icon="i-heroicons-chevron-right-20-solid"
size="xl"
@click.stop="handleAsk"
/>
<UTooltip v-else text="停止生成">
<UButton
:ui="{ rounded: 'rounded-full' }"
color="red"
trailing-icon="i-heroicons-stop-20-solid"
size="xl"
variant="ghost"
@click.stop="handleStop"
/>
</UTooltip>
</div>
</UCard>
</div>
<div class="flex w-full justify-center">
<UCard
class="hover:ring-2 has-[textarea:focus]:ring-2 has-[textarea:focus]:ring-primary-500 dark:has-[textarea:focus]:ring-primary-400"
:ui="cardUI"
>
<UTextarea
ref="queryInput"
v-model="continueQuestion"
class="flex-grow"
name="queryInput"
:rows="1"
:maxrows="10"
autoresize
:placeholder="placeholder"
size="xl"
:padded="false"
variant="none"
maxlength="2000"
@focus="handleInputFocus"
@blur="handleInputBlur"
/>
<div class="flex flex-shrink-0 gap-2">
<UButton
v-if="!asking"
:ui="{ rounded: 'rounded-full' }"
:disabled="!continueQuestion"
trailing-icon="i-heroicons-chevron-right-20-solid"
size="xl"
@click.stop="handleAsk"
/>
<UTooltip v-else text="停止生成">
<UButton
:ui="{ rounded: 'rounded-full' }"
color="red"
trailing-icon="i-heroicons-stop-20-solid"
size="xl"
variant="ghost"
@click.stop="handleStop"
/>
</UTooltip>
</div>
</UCard>
</div>
</template>
<script setup>
const { metaSymbol } = useShortcuts()
......
<template>
<ISearchProcess :collapse="collapse" :actions="actions" :status="processStatus" />
<template v-if="item.source && item.source.length > 0">
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-link-20-solid" />
<span>来源</span>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
<ISearchSource :source="item.source" />
</div>
</template>
<div v-if="processStatus ==='finish'" class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-chat-bubble-left-right-20-solid" />
<span>{{ item.ansLoading ? '回答中' : '回答' }}</span>
</div>
<IMdMdc :content="item.article" />
<div v-if="item.showActions" class="space-x-2">
<UButton size="xs" color="gray" leading-icon="i-heroicons-document-duplicate-20-solid" label="复制" @click="handleCopyMD" />
<UButton size="xs" color="gray" leading-icon="i-heroicons-share-20-solid" label="分享" @click="handleShare" />
<UButton v-if="isLastIndex" size="xs" color="gray" leading-icon="i-heroicons-arrow-path-rounded-square-20-solid" label="重写" @click="handleReGenerate" />
</div>
<ISearchProcess :collapse="collapse" :actions="actions" :status="processStatus"/>
<template v-if="item.source && item.source.length > 0">
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-link-20-solid"/>
<span>来源</span>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
<ISearchSource :source="item.source"/>
</div>
</template>
<div v-if="processStatus ==='finish'" class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-chat-bubble-left-right-20-solid"/>
<span>{{ item.ansLoading ? '回答中' : '回答' }}</span>
</div>
<IMdMdc :content="item.article"/>
<div v-if="item.showActions" class="space-x-2">
<UButton size="xs" color="gray" leading-icon="i-heroicons-document-duplicate-20-solid" label="复制"
@click="handleCopyMD"/>
<UButton size="xs" color="gray" leading-icon="i-heroicons-share-20-solid" label="分享" @click="handleShare"/>
<UButton v-if="isLastIndex" size="xs" color="gray" leading-icon="i-heroicons-arrow-path-rounded-square-20-solid"
label="重写" @click="handleReGenerate"/>
</div>
</template>
<script setup>
const Search = inject('Search')
......
<template>
<div class="flex flex-col gap-4 sticky top-16">
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-square-3-stack-3d-20-solid" />
<span>补充信息</span>
</div>
<template v-for="(item, index) in data" :key="index">
<template v-if="item.ready">
<template v-if="item.type === 'search_relate_repo'">
<template v-if="item.data.length">
<template v-for="(chart, cIndex) in item.data" :key="cIndex">
<UCard :ui="cardUI">
<template v-if="chart.info">
<div class="flex mb-2">
<div class="flex items-center gap-1 text-sm overflow-hidden">
<UIcon class="flex-shrink-0" name="i-simple-icons-github" />
<ULink class="flex-grow truncate underline" :to="chart.info.url" target="_blank" :title="chart.info.description">{{ chart.info.name }}</ULink>
<UIcon class="flex-shrink-0" name="i-heroicons-arrow-top-right-on-square" />
</div>
</div>
</template>
<ProseChart
type="line"
:labels="chart.labels"
:data="chart.data"
:info="chart.info"
simple
/>
<div class="text-xs text-center text-gray-500 dark:text-gray-400 mt-2">{{ item.title }}</div>
</UCard>
</template>
</template>
<template v-else>
<UCard :ui="cardUI">
<IEmpty size="xs"/>
</UCard>
</template>
</template>
</template>
<template v-else>
<UCard :ui="cardUI">
<div class="flex flex-col gap-1">
<USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" />
<USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" />
</div>
</UCard>
</template>
</template>
</div>
<div class="flex flex-col gap-4 sticky top-16">
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-square-3-stack-3d-20-solid"/>
<span>补充信息</span>
</div>
<template v-for="(item, index) in data" :key="index">
<template v-if="item.ready">
<template v-if="item.type === 'search_relate_repo'">
<template v-if="item.data.length">
<template v-for="(chart, cIndex) in item.data" :key="cIndex">
<UCard :ui="cardUI">
<template v-if="chart.info">
<div class="flex mb-2">
<div class="flex items-center gap-1 text-sm overflow-hidden">
<UIcon class="flex-shrink-0" name="i-simple-icons-github"/>
<ULink class="flex-grow truncate underline" :to="chart.info.url" target="_blank"
:title="chart.info.description">{{ chart.info.name }}
</ULink>
<UIcon class="flex-shrink-0" name="i-heroicons-arrow-top-right-on-square"/>
</div>
</div>
</template>
<ProseChart
type="line"
:labels="chart.labels"
:data="chart.data"
:info="chart.info"
simple
/>
<div class="text-xs text-center text-gray-500 dark:text-gray-400 mt-2">{{ item.title }}</div>
</UCard>
</template>
</template>
<template v-else>
<UCard :ui="cardUI">
<IEmpty size="xs"/>
</UCard>
</template>
</template>
</template>
<template v-else>
<UCard :ui="cardUI">
<div class="flex flex-col gap-1">
<USkeleton class="h-4"/>
<USkeleton class="h-4 w-2/3"/>
<USkeleton class="h-4"/>
<USkeleton class="h-4 w-2/3"/>
</div>
</UCard>
</template>
</template>
</div>
</template>
<script setup>
defineProps({
......
<template>
<header class="sticky top-0 z-10 bg-white dark:bg-black w-full flex flex-col">
<div class="w-full p-2 justify-between flex">
<IMenuSider />
<div class="hidden md:flex">
<div v-if="repo" class="flex items-center gap-2">
<UIcon name="i-simple-icons-github" />{{ repo }}
</div>
</div>
<div class="flex-grow justify-center items-center space-x-2 hidden sm:flex">
<UTooltip v-if="!isEditTitle" text="点击修改标题">
<div @click="handleFocusTitle">{{ editTitle }}</div>
</UTooltip>
<UInput
v-else
ref="titleRef"
autofocus
:model-value="editTitle"
@blur="handleBlurTitle"
/>
</div>
<div class="flex gap-2">
<IActionThread
:collection_id="$selectCollectionId.length ? $selectCollectionId[0] : ''"
:c_id="state.id"
@delete="handleDeletedThread"
/>
<UButton
color="gray"
variant="ghost"
leading-icon="i-heroicons-plus-small"
:label="$selectCollectionId.length ? '已收藏' : '收藏'"
@click="handleOpenSelect"
/>
<UPopover v-model:open="isShareOpen">
<UButton
:leading-icon="isOpen ? 'i-heroicons-share-16-solid' : 'i-heroicons-lock-closed-16-solid'"
label="分享"
@click="handleSetOpenState"
/>
<template #panel>
<div class="flex flex-col p-3 gap-2 min-w-72">
<div>访问权限</div>
<div class="flex flex-col border dark:border-gray-800 rounded">
<div
class="flex flex-grow justify-between m-1 p-1 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-gray-800"
@click="handleUpdateOpenState(false)"
>
<div class="flex-grow flex flex-col gap-1 text-sm">
<div class="flex items-center gap-1" :class="{ 'text-primary-500': !isOpen }">
<UIcon name="i-heroicons-lock-closed-16-solid" />
<span>私密</span>
</div>
<div class="text-xs text-gray-500">只有作者可以查看</div>
</div>
<div v-if="!isOpen">
<UIcon name="i-heroicons-check-circle-20-solid" class="text-primary-500 text-xl" />
</div>
</div>
<UDivider />
<div
class="flex flex-grow justify-between m-1 p-1 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-gray-800"
@click="handleUpdateOpenState(true)"
>
<div class="flex-grow flex flex-col gap-1 text-sm" :class="{ 'text-primary-500': isOpen }">
<div class="flex items-center gap-1">
<UIcon name="i-heroicons-share-20-solid" />
<span>可分享的</span>
</div>
<div class="text-xs text-gray-500">任何持有链接的人都可以查看</div>
</div>
<div v-if="isOpen">
<UIcon name="i-heroicons-check-circle-20-solid" class="text-primary-500 text-xl" />
</div>
</div>
</div>
<div v-if="isOpen" class="flex gap-1 items-center text-xs text-primary-500">
<UIcon name="i-heroicons-clipboard-document-check" />
<span>链接已复制</span>
</div>
</div>
</template>
</UPopover>
</div>
</div>
<UDivider />
</header>
<header class="sticky top-0 z-10 bg-white dark:bg-black w-full flex flex-col">
<div class="w-full p-2 justify-between flex">
<IMenuSider/>
<div class="hidden md:flex">
<div v-if="repo" class="flex items-center gap-2">
<UIcon name="i-simple-icons-github"/>
{{ repo }}
</div>
</div>
<div class="flex-grow justify-center items-center space-x-2 hidden sm:flex">
<UTooltip v-if="!isEditTitle" text="点击修改标题">
<div @click="handleFocusTitle">{{ editTitle }}</div>
</UTooltip>
<UInput
v-else
ref="titleRef"
autofocus
:model-value="editTitle"
@blur="handleBlurTitle"
/>
</div>
<div class="flex gap-2">
<IActionThread
:collection_id="$selectCollectionId.length ? $selectCollectionId[0] : ''"
:c_id="state.id"
@delete="handleDeletedThread"
/>
<UButton
color="gray"
variant="ghost"
leading-icon="i-heroicons-plus-small"
:label="$selectCollectionId.length ? '已收藏' : '收藏'"
@click="handleOpenSelect"
/>
<UPopover v-model:open="isShareOpen">
<UButton
:leading-icon="isOpen ? 'i-heroicons-share-16-solid' : 'i-heroicons-lock-closed-16-solid'"
label="分享"
@click="handleSetOpenState"
/>
<template #panel>
<div class="flex flex-col p-3 gap-2 min-w-72">
<div>访问权限</div>
<div class="flex flex-col border dark:border-gray-800 rounded">
<div
class="flex flex-grow justify-between m-1 p-1 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-gray-800"
@click="handleUpdateOpenState(false)"
>
<div class="flex-grow flex flex-col gap-1 text-sm">
<div class="flex items-center gap-1" :class="{ 'text-primary-500': !isOpen }">
<UIcon name="i-heroicons-lock-closed-16-solid"/>
<span>私密</span>
</div>
<div class="text-xs text-gray-500">只有作者可以查看</div>
</div>
<div v-if="!isOpen">
<UIcon name="i-heroicons-check-circle-20-solid" class="text-primary-500 text-xl"/>
</div>
</div>
<UDivider/>
<div
class="flex flex-grow justify-between m-1 p-1 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-gray-800"
@click="handleUpdateOpenState(true)"
>
<div class="flex-grow flex flex-col gap-1 text-sm" :class="{ 'text-primary-500': isOpen }">
<div class="flex items-center gap-1">
<UIcon name="i-heroicons-share-20-solid"/>
<span>可分享的</span>
</div>
<div class="text-xs text-gray-500">任何持有链接的人都可以查看</div>
</div>
<div v-if="isOpen">
<UIcon name="i-heroicons-check-circle-20-solid" class="text-primary-500 text-xl"/>
</div>
</div>
</div>
<div v-if="isOpen" class="flex gap-1 items-center text-xs text-primary-500">
<UIcon name="i-heroicons-clipboard-document-check"/>
<span>链接已复制</span>
</div>
</div>
</template>
</UPopover>
</div>
</div>
<UDivider/>
</header>
</template>
<script setup>
const toast = useToast()
......
<template>
<UCard :ui="{ body: { padding: 'p-4 sm:p-4' } }">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2 text-lg">
<UIcon name="i-heroicons-sparkles-20-solid" />
搜索过程
</div>
<UButton
size="md"
color="gray"
variant="ghost"
:icon="openCollapse ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'"
:ui="{ rounded: 'rounded-full' }"
@click="handleToggleCollapse"
/>
</div>
<ICollapse :open="openCollapse" class="mt-2">
<div v-auto-animate class="flex flex-col gap-2 w-full text-gray-500 dark:text-gray-400">
<template v-if="status !== 'finish' && !actions.length">
<USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" />
</template>
<template v-for="(action, index) in actions" :key="action.action">
<ISearchProcessAction
:action="action"
:last="actions.length === index + 1"
:status="status"
/>
</template>
</div>
</ICollapse>
</UCard>
<UCard :ui="{ body: { padding: 'p-4 sm:p-4' } }">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2 text-lg">
<UIcon name="i-heroicons-sparkles-20-solid"/>
搜索过程
</div>
<UButton
size="md"
color="gray"
variant="ghost"
:icon="openCollapse ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'"
:ui="{ rounded: 'rounded-full' }"
@click="handleToggleCollapse"
/>
</div>
<ICollapse :open="openCollapse" class="mt-2">
<div v-auto-animate class="flex flex-col gap-2 w-full text-gray-500 dark:text-gray-400">
<template v-if="status !== 'finish' && !actions.length">
<USkeleton class="h-4"/>
<USkeleton class="h-4 w-2/3"/>
</template>
<template v-for="(action, index) in actions" :key="action.action">
<ISearchProcessAction
:action="action"
:last="actions.length === index + 1"
:status="status"
/>
</template>
</div>
</ICollapse>
</UCard>
</template>
<script setup>
const props = defineProps({
......
<template>
<div class="text-base flex items-center gap-1">
<UIcon :name="item.icon" />
{{ item.name }}
</div>
<template v-if="['rephrase_question', 'tool_select'].includes((action.action))">
<div class="pl-5">
<IMdMdc :content="action.output" size="sm" />
</div>
</template>
<template v-else-if="['search_file', 'search_web'].includes(action.action)">
<div class="text-xs pl-5">找到 {{ action.output.length }} 条来源</div>
</template>
<template v-if="last && status !== 'finish'">
<USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" />
</template>
<div class="text-base flex items-center gap-1">
<UIcon :name="item.icon"/>
{{ item.name }}
</div>
<template v-if="['rephrase_question', 'tool_select'].includes((action.action))">
<div class="pl-5">
<IMdMdc :content="action.output" size="sm"/>
</div>
</template>
<template v-else-if="['search_file', 'search_web'].includes(action.action)">
<div class="text-xs pl-5">找到 {{ action.output.length }} 条来源</div>
</template>
<template v-if="last && status !== 'finish'">
<USkeleton class="h-4"/>
<USkeleton class="h-4 w-2/3"/>
</template>
</template>
<script setup>
const props = defineProps({
......
<template>
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-rectangle-group-20-solid" />
<span>相关问题</span>
</div>
<div class="flex flex-col gap-2">
<UButton
<div class="text-xl flex items-center space-x-1">
<UIcon name="i-heroicons-rectangle-group-20-solid"/>
<span>相关问题</span>
</div>
<div class="flex flex-col gap-2">
<UButton
v-for="(item, index) in recommendQuestions"
:key="index"
color="gray"
......@@ -12,12 +12,12 @@
variant="soft"
@click="handleClick(item.title)"
>
<div class="justify-between w-full flex items-center">
<div class="truncate">{{ item.title }}</div>
<UIcon name="i-heroicons-plus-20-solid" class="text-base" />
</div>
</UButton>
</div>
<div class="justify-between w-full flex items-center">
<div class="truncate">{{ item.title }}</div>
<UIcon name="i-heroicons-plus-20-solid" class="text-base"/>
</div>
</UButton>
</div>
</template>
<script setup>
defineProps({
......
<template>
<ULink v-for="(item, index) in limitSource" :key="index" :to="item.url" :title="item.url" target="_blank">
<UCard :ui="cardUI">
<div class="flex flex-col h-full gap-1">
<template v-if="getIconPath(item.url) === 'github'">
<div class="items-center flex gap-1">
<UIcon name="i-simple-icons-github" class="flex-shrink-0" />
<div class="flex flex-grow overflow-hidden">
<div class="truncate">{{ item.title }}</div>
</div>
<div class="text-gray-200">{{ index + 1 }}</div>
</div>
<div class="text-blue-500 line-clamp-1">{{ item.label }}</div>
</template>
<template v-else>
<div class="flex gap-1 h-full">
<div class="line-clamp-2 text-sm">{{ item.title }}</div>
</div>
<div class="items-center flex gap-1">
<UAvatar :src="getIconPath(item.url)" size="2xs" class="flex-shrink-0" />
<div class="flex flex-grow overflow-hidden">
<div class="truncate text-xs text-gray-500">{{ getDomain(item.url) }}</div>
</div>
<div class="text-gray-200 text-sm">{{ index + 1 }}</div>
</div>
</template>
</div>
</UCard>
</ULink>
<UCard v-if="source.length > 6" class="cursor-pointer" :ui="cardUI" @click="handleToggleShowAll">
<div class="flex items-center justify-center h-full gap-1">
<UIcon v-if="!showAllSource" name="i-heroicons-chevron-down-20-solid" />
<UIcon v-else name="i-heroicons-chevron-up-20-solid" />
<div v-if="!showAllSource">查看全部{{ source.length }}个来源</div>
<div v-else>收起</div>
</div>
</UCard>
<ULink v-for="(item, index) in limitSource" :key="index" :to="item.url" :title="item.url" target="_blank">
<UCard :ui="cardUI">
<div class="flex flex-col h-full gap-1">
<template v-if="getIconPath(item.url) === 'github'">
<div class="items-center flex gap-1">
<UIcon name="i-simple-icons-github" class="flex-shrink-0"/>
<div class="flex flex-grow overflow-hidden">
<div class="truncate">{{ item.title }}</div>
</div>
<div class="text-gray-200">{{ index + 1 }}</div>
</div>
<div class="text-blue-500 line-clamp-1">{{ item.label }}</div>
</template>
<template v-else>
<div class="flex gap-1 h-full">
<div class="line-clamp-2 text-sm">{{ item.title }}</div>
</div>
<div class="items-center flex gap-1">
<UAvatar :src="getIconPath(item.url)" size="2xs" class="flex-shrink-0"/>
<div class="flex flex-grow overflow-hidden">
<div class="truncate text-xs text-gray-500">{{ getDomain(item.url) }}</div>
</div>
<div class="text-gray-200 text-sm">{{ index + 1 }}</div>
</div>
</template>
</div>
</UCard>
</ULink>
<UCard v-if="source.length > 6" class="cursor-pointer" :ui="cardUI" @click="handleToggleShowAll">
<div class="flex items-center justify-center h-full gap-1">
<UIcon v-if="!showAllSource" name="i-heroicons-chevron-down-20-solid"/>
<UIcon v-else name="i-heroicons-chevron-up-20-solid"/>
<div v-if="!showAllSource">查看全部{{ source.length }}个来源</div>
<div v-else>收起</div>
</div>
</UCard>
</template>
<script setup>
const props = defineProps({
......
<template>
<component :is="titleTag" :id="id" :class="{ 'text-3xl': titleTag !== 'div' }">{{ title }}</component>
<component :is="titleTag" :id="id" :class="{ 'text-3xl': titleTag !== 'div' }">{{ title }}</component>
</template>
<script setup>
const props = defineProps({
......
<template>
<div class="grid grid-cols-1">
<article class="prose dark:prose-invert max-w-none" v-html="mdHtml"/>
</div>
<div class="grid grid-cols-1">
<article class="prose dark:prose-invert max-w-none" v-html="mdHtml"/>
</div>
</template>
<script setup>
import MarkdownIt from 'markdown-it'
......
<template>
<div class="w-full relative" style="aspect-ratio: 2/1">
<canvas ref="refChart" :aria-label="title"/>
</div>
<div class="w-full relative" style="aspect-ratio: 2/1">
<canvas ref="refChart" :aria-label="title"/>
</div>
</template>
<script setup>
import { Chart } from 'chart.js/auto';
......
<template>
<UTable
:rows="data"
:columns="columns"
:ui="config"
:sort-button="sortButton"
>
<template #repo_name-data="{ row }">
<ULink :to="'https://github.com/' + row.repo_name" target="_blank">{{ row.repo_name }}</ULink>
</template>
<template #repo_url-data="{ row }">
<ULink :to="row.repo_url" target="_blank">{{ row.repo_url }}</ULink>
</template>
</UTable>
<UTable
:rows="data"
:columns="columns"
:ui="config"
:sort-button="sortButton"
>
<template #repo_name-data="{ row }">
<ULink :to="'https://github.com/' + row.repo_name" target="_blank">{{ row.repo_name }}</ULink>
</template>
<template #repo_url-data="{ row }">
<ULink :to="row.repo_url" target="_blank">{{ row.repo_url }}</ULink>
</template>
</UTable>
</template>
<script setup>
const props = defineProps({
......
<template>
<NuxtLink
:href="href"
:target="target"
>
<slot />
</NuxtLink>
<NuxtLink
:href="href"
:target="target"
>
<slot/>
</NuxtLink>
</template>
<script setup lang="ts">
......
<template>
<UCard :ui="cardUI">
<UCard :ui="cardUI">
<pre class="flex justify-between items-center m-0 p-1 pl-4 pr-1 rounded-none dark">
<div>{{ language }}</div>
<UButton
leading-icon="i-heroicons-document-duplicate-20-solid"
color="gray"
variant="link"
@click="handleCopy"
/>
</pre>
<UDivider :ui="{ border: { base: 'border-gray-700' } }" />
<pre :class="$props.class" class="m-0 rounded-none"><code v-html="codeBlock"/></pre>
</UCard>
<div>{{ language }}</div>
<UButton
leading-icon="i-heroicons-document-duplicate-20-solid"
color="gray"
variant="link"
@click="handleCopy"
/>
</pre>
<UDivider :ui="{ border: { base: 'border-gray-700' } }"/>
<pre :class="$props.class" class="m-0 rounded-none"><code v-html="codeBlock"/></pre>
</UCard>
</template>
<script setup>
......
......@@ -6,8 +6,8 @@ export default withNuxt({
rules: {
'semi': [0],
'vue/html-indent': ['off'],
'indent': ['error', 2],
'vue/html-indent': ['off', 2, {}],
'no-empty': ['error', { 'allowEmptyCatch': true }],
'vue/no-v-html': 'off',
'no-useless-escape': 'error',
......
<template>
<div class="flex min-h-screen">
<div class="fixed top-0 w-64 hidden md:flex flex-col h-screen">
<IAside />
</div>
<div class="w-full ml-0 md:ml-64 bg-white dark:bg-black flex flex-grow">
<slot />
</div>
</div>
<ILibraryCreate />
<ILibrarySelect @success="handleCollectSuccess" />
<div class="flex min-h-screen">
<div class="fixed top-0 w-64 hidden md:flex flex-col h-screen">
<IAside/>
</div>
<div class="w-full ml-0 md:ml-64 bg-white dark:bg-black flex flex-grow">
<slot/>
</div>
</div>
<ILibraryCreate/>
<ILibrarySelect @success="handleCollectSuccess"/>
</template>
<script setup>
const selectCollectData = ref(null)
......
<template>
<slot />
<slot/>
</template>
......@@ -5012,8 +5012,6 @@
},
"node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/napi-wasm/-/napi-wasm-1.1.0.tgz",
"integrity": "sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==",
"inBundle": true,
"license": "MIT"
},
......@@ -24105,8 +24103,6 @@
"dependencies": {
"napi-wasm": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/napi-wasm/-/napi-wasm-1.1.0.tgz",
"integrity": "sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==",
"bundled": true
}
}
<template>
<div class="flex flex-col items-center justify-center w-full h-full">
<ILogo />
<div class="mt-2">开源搜索,直达结果</div>
<ICreate ref="refCreate" />
<div class="max-w-screen-md w-full p-6 grid grid-cols-1 lg:grid-cols-2 gap-4">
<template v-for="(item, index) in recommendQuestions" :key="index">
<UButton
class="flex justify-between"
color="gray"
variant="soft"
size="md"
:trailing-icon="item.c_id ? 'i-heroicons-chevron-right-20-solid' : 'i-heroicons-plus-20-solid'"
:label="item.title"
:to="item.c_id ? `/search/${item.c_id}` : ''"
@click="handleSearch(item)"
/>
</template>
</div>
</div>
<IMenuSider fixed />
<div class="flex flex-col items-center justify-center w-full h-full">
<ILogo/>
<div class="mt-2">开源搜索,直达结果</div>
<ICreate ref="refCreate"/>
<div class="max-w-screen-md w-full p-6 grid grid-cols-1 lg:grid-cols-2 gap-4">
<template v-for="(item, index) in recommendQuestions" :key="index">
<UButton
class="flex justify-between"
color="gray"
variant="soft"
size="md"
:trailing-icon="item.c_id ? 'i-heroicons-chevron-right-20-solid' : 'i-heroicons-plus-20-solid'"
:label="item.title"
:to="item.c_id ? `/search/${item.c_id}` : ''"
@click="handleSearch(item)"
/>
</template>
</div>
</div>
<IMenuSider fixed/>
</template>
<script setup>
const recommendQuestions = [
......
<template>
<div class="w-full items-center flex flex-col">
<ILibraryHeader
v-if="currentCollect"
:collect="currentCollect.name"
:description="currentCollect.description"
:count="currentCollect.record_count"
:collect-id="currentCollect.id"
/>
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6">
<div class="flex gap-10">
<div class="flex flex-col flex-grow">
<div v-auto-animate class="flex flex-col gap-4">
<ILibraryThread
v-for="item in themesTagList"
:key="item.id"
:item="item"
is-item
@delete="handleDeletedThread"
/>
</div>
</div>
</div>
</div>
</div>
<div class="w-full items-center flex flex-col">
<ILibraryHeader
v-if="currentCollect"
:collect="currentCollect.name"
:description="currentCollect.description"
:count="currentCollect.record_count"
:collect-id="currentCollect.id"
/>
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6">
<div class="flex gap-10">
<div class="flex flex-col flex-grow">
<div v-auto-animate class="flex flex-col gap-4">
<ILibraryThread
v-for="item in themesTagList"
:key="item.id"
:item="item"
is-item
@delete="handleDeletedThread"
/>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
const route = useRoute()
......
<template>
<div class="w-full items-center flex flex-col">
<ILibraryHeader show-tabs :tab="tab" @change-tab="handleChangeTab" @search="handleSearch" @clear="getThreadData" />
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6 pt-0 lg:pt-6">
<div v-show="ready" class="flex gap-10">
<div v-show="tab === 0 || tab === -1" class="flex flex-col flex-grow">
<div v-auto-animate class="flex flex-col gap-4">
<ILibraryThread
v-for="item in threads"
:key="item.c_id"
:item="item"
@delete="handleDeletedThread"
/>
<IEmpty v-if="!threads.length" />
</div>
</div>
<div v-show="tab === 1 || tab === -1" class="flex flex-col flex-shrink-0 w-full lg:w-56">
<div class="flex justify-between items-center">
<div class="flex items-center text-lg gap-2">
<UIcon name="i-heroicons-squares-2x2" />
<div>合集</div>
</div>
<UButton
icon="i-heroicons-plus-20-solid"
variant="soft"
@click="handleOpenCreateLibrary"
/>
</div>
<div v-auto-animate class="flex flex-col gap-4 mt-4">
<ILibraryCollect
v-for="item in $collection"
:key="item.id"
:item="item"
/>
</div>
</div>
</div>
</div>
</div>
<div class="w-full items-center flex flex-col">
<ILibraryHeader show-tabs :tab="tab" @change-tab="handleChangeTab" @search="handleSearch" @clear="getThreadData"/>
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6 pt-0 lg:pt-6">
<div v-show="ready" class="flex gap-10">
<div v-show="tab === 0 || tab === -1" class="flex flex-col flex-grow">
<div v-auto-animate class="flex flex-col gap-4">
<ILibraryThread
v-for="item in threads"
:key="item.c_id"
:item="item"
@delete="handleDeletedThread"
/>
<IEmpty v-if="!threads.length"/>
</div>
</div>
<div v-show="tab === 1 || tab === -1" class="flex flex-col flex-shrink-0 w-full lg:w-56">
<div class="flex justify-between items-center">
<div class="flex items-center text-lg gap-2">
<UIcon name="i-heroicons-squares-2x2"/>
<div>合集</div>
</div>
<UButton
icon="i-heroicons-plus-20-solid"
variant="soft"
@click="handleOpenCreateLibrary"
/>
</div>
<div v-auto-animate class="flex flex-col gap-4 mt-4">
<ILibraryCollect
v-for="item in $collection"
:key="item.id"
:item="item"
/>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import {LG} from '~/composables/useMQ.js';
......
<template>
<div class="w-full p-6">
<IMdMdc :content="lineChart"/>
<UDivider />
<IMdMdc :content="tableChart"/>
</div>
<div class="w-full p-6">
<IMdMdc :content="lineChart"/>
<UDivider/>
<IMdMdc :content="tableChart"/>
</div>
</template>
<script setup>
const lineChart = `
......
<template>
<div class="w-full items-center flex flex-col">
<IException v-if="historyStatus !== 200" :code="historyStatus" />
<template v-else>
<iSearchHeader
ref="refHeader"
:query="state.title"
:is-public="state.isPublic"
:repo="state.repo"
@update-query="handleUpdateQuery"
/>
<div ref="scrollElement" class="container min-h-svh max-w-screen-lg 2xl:max-w-screen-xl flex flex-col space-y-6 p-6 mb-6 pb-0">
<template v-for="(item, index) in data" :key="index">
<ISearchArticle>
<template #title>
<ISearchTitle :id="index + 1" as="h2" :title="item.question" />
</template>
<ISearchContent
:item="item"
:asking="false"
:is-last-index="false"
:index="index"
:actions="item.actions"
:collapse="false"
process-status="finish"
/>
<template v-if="item.extra && item.extra.length > 0" #extra>
<ISearchExtraInfo :data="item.extra" />
</template>
</ISearchArticle>
<UDivider v-if="data.length !== index + 1 || askingData.question" class="pt-3 pb-2" />
</template>
<template v-if="askingData.question">
<ISearchArticle>
<template #title>
<ISearchTitle :id="data.length + 1" as="h2" :title="askingData.question" />
</template>
<ISearchContent
:item="askingData"
:asking="asking"
:collapse="askingData.collapse"
:is-last-index="true"
:actions="askingData.actions"
:process-status="askingData.processStatus"
@regenerate="handleReGenerate"
/>
<template v-if="askingSidebarCards.length > 0" #extra>
<ISearchExtraInfo :data="askingSidebarCards" />
</template>
</ISearchArticle>
</template>
<ISearchRecommendQuestion
v-if="recommendQuestions.length > 0 && !asking"
:recommend-questions="recommendQuestions"
@click="handleContinueAsk"
/>
</div>
<div class="container max-w-screen-lg 2xl:max-w-screen-xl sticky bottom-4 flex pl-6 pr-6">
<ISearchAsk :asking="asking" @stop="handleStopGenerate" @ask="handleContinueAsk" />
</div>
</template>
</div>
<div class="w-full items-center flex flex-col">
<IException v-if="historyStatus !== 200" :code="historyStatus"/>
<template v-else>
<iSearchHeader
ref="refHeader"
:query="state.title"
:is-public="state.isPublic"
:repo="state.repo"
@update-query="handleUpdateQuery"
/>
<div ref="scrollElement"
class="container min-h-svh max-w-screen-lg 2xl:max-w-screen-xl flex flex-col space-y-6 p-6 mb-6 pb-0">
<template v-for="(item, index) in data" :key="index">
<ISearchArticle>
<template #title>
<ISearchTitle :id="index + 1" as="h2" :title="item.question"/>
</template>
<ISearchContent
:item="item"
:asking="false"
:is-last-index="false"
:index="index"
:actions="item.actions"
:collapse="false"
process-status="finish"
/>
<template v-if="item.extra && item.extra.length > 0" #extra>
<ISearchExtraInfo :data="item.extra"/>
</template>
</ISearchArticle>
<UDivider v-if="data.length !== index + 1 || askingData.question" class="pt-3 pb-2"/>
</template>
<template v-if="askingData.question">
<ISearchArticle>
<template #title>
<ISearchTitle :id="data.length + 1" as="h2" :title="askingData.question"/>
</template>
<ISearchContent
:item="askingData"
:asking="asking"
:collapse="askingData.collapse"
:is-last-index="true"
:actions="askingData.actions"
:process-status="askingData.processStatus"
@regenerate="handleReGenerate"
/>
<template v-if="askingSidebarCards.length > 0" #extra>
<ISearchExtraInfo :data="askingSidebarCards"/>
</template>
</ISearchArticle>
</template>
<ISearchRecommendQuestion
v-if="recommendQuestions.length > 0 && !asking"
:recommend-questions="recommendQuestions"
@click="handleContinueAsk"
/>
</div>
<div class="container max-w-screen-lg 2xl:max-w-screen-xl sticky bottom-4 flex pl-6 pr-6">
<ISearchAsk :asking="asking" @stop="handleStopGenerate" @ask="handleContinueAsk"/>
</div>
</template>
</div>
</template>
<script setup>
const route = useRoute()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册