diff --git a/frontend/src/app/(main)/page.tsx b/frontend/src/app/(main)/page.tsx index 1f942a76..accf5439 100644 --- a/frontend/src/app/(main)/page.tsx +++ b/frontend/src/app/(main)/page.tsx @@ -29,16 +29,8 @@ export default function HomePage() { if (!message.trim()) return; try { - // Create the project - const result = await createProjectFromPrompt(message, isPublic, model); - - // If successful, clear the input - if (result) { - promptFormRef.current.clearMessage(); - - // Note: No need to navigate here as the ProjectContext's onCompleted handler - // in the createProject mutation will handle navigation to the chat page - } + await createProjectFromPrompt(message, isPublic, model); + promptFormRef.current.clearMessage(); } catch (error) { console.error('Error creating project:', error); } diff --git a/frontend/src/components/sidebar-item.tsx b/frontend/src/components/sidebar-item.tsx index 91b1897a..d405dca3 100644 --- a/frontend/src/components/sidebar-item.tsx +++ b/frontend/src/components/sidebar-item.tsx @@ -104,11 +104,11 @@ export function SideBarItem({ buttonVariants({ variant, }), - 'flex justify-between w-full h-14 text-base font-normal items-center group' + 'relative flex w-full h-14 text-base font-normal items-center group px-2' )} onClick={handleChatClick} > -
+
{title || 'New Chat'}
@@ -119,7 +119,7 @@ export function SideBarItem({ + + {/* SidebarTrigger 保证在 CodeFox 按钮的中间 */} + setIsCollapsed(!isCollapsed)} + /> +
+ )} + + {isCollapsed && ( + setIsCollapsed(!isCollapsed)} + /> )} - +
{/* Divider Line */}
- +
- {!isCollapsed && ( - - )} - - - + {/* 聊天列表 */} @@ -171,12 +181,14 @@ export function ChatSideBar({ - + {/* 底部设置 */} + setIsCollapsed(!isCollapsed)} isSimple={false} /> diff --git a/frontend/src/graphql/schema.gql b/frontend/src/graphql/schema.gql index b14c81ba..55d76b75 100644 --- a/frontend/src/graphql/schema.gql +++ b/frontend/src/graphql/schema.gql @@ -57,6 +57,11 @@ input CreateProjectInput { """Date custom scalar type""" scalar Date +type EmailConfirmationResponse { + message: String! + success: Boolean +} + input FetchPublicProjectsInputs { size: Float! strategy: String! @@ -101,6 +106,7 @@ type Message { type Mutation { clearChatHistory(chatId: String!): Boolean! + confirmEmail(token: String!): EmailConfirmationResponse! createChat(newChatInput: NewChatInput!): Chat! createProject(createProjectInput: CreateProjectInput!): Chat! deleteChat(chatId: String!): Boolean! @@ -110,6 +116,7 @@ type Mutation { refreshToken(refreshToken: String!): RefreshTokenResponse! regenerateDescription(input: String!): String! registerUser(input: RegisterUserInput!): User! + resendConfirmationEmail(input: ResendEmailInput!): EmailConfirmationResponse! subscribeToProject(projectId: ID!): Project! triggerChatStream(input: ChatInputType!): Boolean! updateChatTitle(updateChatTitleInput: UpdateChatTitleInput!): Chat @@ -137,9 +144,7 @@ type Project { projectPath: String! subNumber: Float! - """ - Projects that are copies of this project - """ + """Projects that are copies of this project""" subscribers: [Project!] uniqueProjectId: String! updatedAt: Date! @@ -171,6 +176,7 @@ type Query { getChatHistory(chatId: String!): [Message!]! getHello: String! getProject(projectId: String!): Project! + getRemainingProjectLimit: Int! getSubscribedProjects: [Project!]! getUserChats: [Chat!] getUserProjects: [Project!]! @@ -190,6 +196,10 @@ input RegisterUserInput { username: String! } +input ResendEmailInput { + email: String! +} + enum Role { Assistant System @@ -225,9 +235,10 @@ type User { id: ID! isActive: Boolean! isDeleted: Boolean! + isEmailConfirmed: Boolean! + lastEmailSendTime: Date! projects: [Project!]! - subscribedProjects: [Project!] - @deprecated(reason: "Use projects with forkedFromId instead") + subscribedProjects: [Project!] @deprecated(reason: "Use projects with forkedFromId instead") updatedAt: Date! username: String! } \ No newline at end of file diff --git a/frontend/src/providers/AuthProvider.tsx b/frontend/src/providers/AuthProvider.tsx index 20b99d25..f4239347 100644 --- a/frontend/src/providers/AuthProvider.tsx +++ b/frontend/src/providers/AuthProvider.tsx @@ -152,10 +152,12 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { let isValid = await validateToken(); + // 如果验证失败,再试图刷新 if (!isValid) { isValid = (await refreshAccessToken()) ? true : false; } + // 最终判断 if (isValid) { setIsAuthorized(true); await fetchUserInfo();