Merge pull request #6762 from menloresearch/fix/remove-setup-screen
fix: remove setup screen on project id to make same behavior with thread
This commit is contained in:
commit
814034d3d7
@ -3,12 +3,10 @@ import { useMemo } from 'react'
|
|||||||
|
|
||||||
import { useThreadManagement } from '@/hooks/useThreadManagement'
|
import { useThreadManagement } from '@/hooks/useThreadManagement'
|
||||||
import { useThreads } from '@/hooks/useThreads'
|
import { useThreads } from '@/hooks/useThreads'
|
||||||
import { useModelProvider } from '@/hooks/useModelProvider'
|
|
||||||
import { useTranslation } from '@/i18n/react-i18next-compat'
|
import { useTranslation } from '@/i18n/react-i18next-compat'
|
||||||
|
|
||||||
import ChatInput from '@/containers/ChatInput'
|
import ChatInput from '@/containers/ChatInput'
|
||||||
import HeaderPage from '@/containers/HeaderPage'
|
import HeaderPage from '@/containers/HeaderPage'
|
||||||
import SetupScreen from '@/containers/SetupScreen'
|
|
||||||
import ThreadList from '@/containers/ThreadList'
|
import ThreadList from '@/containers/ThreadList'
|
||||||
import DropdownAssistant from '@/containers/DropdownAssistant'
|
import DropdownAssistant from '@/containers/DropdownAssistant'
|
||||||
|
|
||||||
@ -26,7 +24,6 @@ export const Route = createFileRoute('/project/$projectId')({
|
|||||||
function ProjectPage() {
|
function ProjectPage() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { projectId } = useParams({ from: '/project/$projectId' })
|
const { projectId } = useParams({ from: '/project/$projectId' })
|
||||||
const { providers } = useModelProvider()
|
|
||||||
const { getFolderById } = useThreadManagement()
|
const { getFolderById } = useThreadManagement()
|
||||||
const threads = useThreads((state) => state.threads)
|
const threads = useThreads((state) => state.threads)
|
||||||
|
|
||||||
@ -43,18 +40,6 @@ function ProjectPage() {
|
|||||||
.sort((a, b) => (b.updated || 0) - (a.updated || 0))
|
.sort((a, b) => (b.updated || 0) - (a.updated || 0))
|
||||||
}, [threads, projectId])
|
}, [threads, projectId])
|
||||||
|
|
||||||
// Conditional to check if there are any valid providers
|
|
||||||
const hasValidProviders = providers.some(
|
|
||||||
(provider) =>
|
|
||||||
provider.api_key?.length ||
|
|
||||||
(provider.provider === 'llamacpp' && provider.models.length) ||
|
|
||||||
(provider.provider === 'jan' && provider.models.length)
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!hasValidProviders) {
|
|
||||||
return <SetupScreen />
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!project) {
|
if (!project) {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col items-center justify-center">
|
<div className="flex h-full flex-col items-center justify-center">
|
||||||
@ -93,7 +78,9 @@ function ProjectPage() {
|
|||||||
{projectThreads.length > 0 && (
|
{projectThreads.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<h2 className="text-xl font-semibold text-main-view-fg mb-2">
|
<h2 className="text-xl font-semibold text-main-view-fg mb-2">
|
||||||
{t('projects.conversationsIn', { projectName: project.name })}
|
{t('projects.conversationsIn', {
|
||||||
|
projectName: project.name,
|
||||||
|
})}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-main-view-fg/70">
|
<p className="text-main-view-fg/70">
|
||||||
{t('projects.conversationsDescription')}
|
{t('projects.conversationsDescription')}
|
||||||
@ -105,7 +92,11 @@ function ProjectPage() {
|
|||||||
{/* Thread List or Empty State */}
|
{/* Thread List or Empty State */}
|
||||||
<div className="mb-0">
|
<div className="mb-0">
|
||||||
{projectThreads.length > 0 ? (
|
{projectThreads.length > 0 ? (
|
||||||
<ThreadList threads={projectThreads} variant="project" currentProjectId={projectId} />
|
<ThreadList
|
||||||
|
threads={projectThreads}
|
||||||
|
variant="project"
|
||||||
|
currentProjectId={projectId}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col items-center justify-center py-12 text-center">
|
<div className="flex flex-col items-center justify-center py-12 text-center">
|
||||||
<IconMessage
|
<IconMessage
|
||||||
@ -113,10 +104,14 @@ function ProjectPage() {
|
|||||||
className="text-main-view-fg/30 mb-4"
|
className="text-main-view-fg/30 mb-4"
|
||||||
/>
|
/>
|
||||||
<h3 className="text-lg font-medium text-main-view-fg/60 mb-2">
|
<h3 className="text-lg font-medium text-main-view-fg/60 mb-2">
|
||||||
{t('projects.noConversationsIn', { projectName: project.name })}
|
{t('projects.noConversationsIn', {
|
||||||
|
projectName: project.name,
|
||||||
|
})}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-main-view-fg/50 text-sm">
|
<p className="text-main-view-fg/50 text-sm">
|
||||||
{t('projects.startNewConversation', { projectName: project.name })}
|
{t('projects.startNewConversation', {
|
||||||
|
projectName: project.name,
|
||||||
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user