syle minor fix

This commit is contained in:
yiling
2026-07-12 10:29:29 +08:00
parent bcb17acaf7
commit 0a4622ed8a
3 changed files with 34 additions and 27 deletions
+19 -10
View File
@@ -7,6 +7,7 @@ import type { ChatMessage } from '@shumai/dtos'
import { ArrowLeft, ArrowUp, Bot, History, Loader2, Plus, Trash2 } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import Markdown from 'react-markdown'
import { formatTimeAgo } from '../lib/time'
interface ChatbotSidebarProps {
projectId: string
@@ -135,7 +136,19 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
return (
<div key={msg.id} className="flex flex-col w-full space-y-1">
<div className="text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words">
<Markdown>{preprocessMarkdown(getMessageText(msg.content))}</Markdown>
<Markdown
components={{
// Intercept the <pre> tag
pre: ({ node, ...props }) => (
<pre
className="whitespace-pre-wrap break-all break-words bg-gray-100 p-4 rounded-md"
{...props}
/>
),
}}
>
{preprocessMarkdown(getMessageText(msg.content))}
</Markdown>
</div>
<div className="text-[10px] text-muted-foreground self-start italic">
{m.created_by_agent()}
@@ -176,7 +189,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
<div
ref={setDroppableRef}
className={cn(
'relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0 border-l border-border',
'relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0',
)}
>
{isOver && (
@@ -191,11 +204,10 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
)}
{/* Header section */}
<div className="flex items-center justify-between p-4 flex-shrink-0">
<div className="flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0">
{isHistoryMode ? (
<>
<div className="flex items-center gap-2 font-semibold">
<History className="h-5 w-5 text-primary" />
<span>{m.history()}</span>
</div>
<button
@@ -209,7 +221,6 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
) : (
<>
<div className="flex items-center gap-2 font-semibold">
<Bot className="h-5 w-5 text-primary" />
<span>{m.shumai_agent()}</span>
</div>
<div className="flex items-center gap-1">
@@ -249,9 +260,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
key={sess.id}
className={cn(
'group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card',
isActive
? 'border-primary ring-1 ring-primary'
: 'border-border hover:bg-accent/30',
isActive ? 'border-primary' : 'border-border hover:bg-accent/30',
)}
>
<div onClick={() => loadSession(sess.id)} className="flex-1 min-w-0 pr-6">
@@ -259,7 +268,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
{sess.name || m.new_chat()}
</div>
<div className="text-xs text-muted-foreground mt-0.5">
{new Date(sess.createdAt).toLocaleString()}
{formatTimeAgo(sess.createdAt)}
</div>
</div>
<button
@@ -283,7 +292,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
) : (
<>
{/* Active Chat view */}
<ScrollArea className="flex-1 p-4 min-h-0">
<ScrollArea className="flex-1 p-4 min-h-0 [&>div>div]:!block">
{messages.length === 0 ? (
<div className="flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center">
<Bot className="h-8 w-8 mb-2 opacity-50 text-muted-foreground" />
@@ -1,13 +1,12 @@
import type { AssetInfo, AssetInfoPaginatedList } from '@shumai/dtos'
import type { CollectionInfo } from '@shumai/dtos'
import { type FieldInfo as MetadataFieldInfo } from '@shumai/dtos'
import type { SearchCondition, SearchSort } from '@shumai/dtos'
import { client } from '@/ui/api/client'
import { usePermissions } from '@/ui/hooks/use-permissions'
import { m } from '@/ui/paraglide/messages.js'
import type { AssetInfo, AssetInfoPaginatedList, CollectionInfo, SearchCondition, SearchSort } from '@shumai/dtos'
import { type FieldInfo as MetadataFieldInfo } from '@shumai/dtos'
import { useMutation } from '@tanstack/react-query'
import { InferRequestType, InferResponseType } from 'hono/client'
import { m } from '@/ui/paraglide/messages.js'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { useFieldStore } from '@/ui/stores/fields'
import { useMemberStore } from '@/ui/stores/members'
import { useTopNavStore } from '@/ui/stores/top-nav'
@@ -19,14 +18,13 @@ import { useInfiniteQuery, useQuery, useQueryClient } from '@tanstack/react-quer
import { useNavigate } from '@tanstack/react-router'
import { useEffect, useMemo, useRef, useState } from 'react'
import { cn } from '../lib/utils'
import { ChatbotSidebar } from './chatbot-sidebar'
import { SnapToPointer } from './dnd-modifiers'
import { FileBrowser } from './file-browser/file-browser'
import { FileViewerRightSidebar } from './file-viewer-right-sidebar'
import { FolderTree } from './folder-tree'
import { ResizeHandle } from './resize-handle'
import { useFileSystemDnd } from './use-file-system-dnd'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { ChatbotSidebar } from './chatbot-sidebar'
type FileSystemManagerProps = {
teamId: string
@@ -511,7 +509,7 @@ export default function FileSystemManager({
/>
<div
style={{ width: rightSidebarWidth }}
className="bg-background border-l border-border flex flex-col flex-shrink-0"
className="bg-background flex flex-col flex-shrink-0"
>
{isChatbotOpen ? (
<ChatbotSidebar projectId={projectId} contextAssetId={assetId} />
@@ -1,29 +1,29 @@
import { createLazyFileRoute } from '@tanstack/react-router'
import { client } from '@/ui/api/client'
import { FileViewer } from '@/ui/components/file-viewer'
import { CompareViewer } from '@/ui/components/compare/compare-viewer'
import { ChatbotSidebar } from '@/ui/components/chatbot-sidebar'
import { pickDefaultCompareVersions } from '@/ui/components/compare/compare-utils'
import { CompareViewer } from '@/ui/components/compare/compare-viewer'
import { FileViewer } from '@/ui/components/file-viewer'
import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar'
import { m } from '@/ui/paraglide/messages.js'
import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar'
import { ResizeHandle } from '@/ui/components/resize-handle'
import { FileDetailSkeleton } from '@/ui/components/loading-skeletons'
import { ResizeHandle } from '@/ui/components/resize-handle'
import { m } from '@/ui/paraglide/messages.js'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { useMemberStore } from '@/ui/stores/members'
import { useTeamContextStore } from '@/ui/stores/team-context'
import { useTopNavStore } from '@/ui/stores/top-nav'
import { useUiStore } from '@/ui/stores/ui'
import { useChatbotStore } from '@/ui/stores/chatbot'
import { ChatbotSidebar } from '@/ui/components/chatbot-sidebar'
import { type Annotation } from '@/ui/types'
import { useMutation } from '@tanstack/react-query'
import { createLazyFileRoute } from '@tanstack/react-router'
import { InferRequestType, InferResponseType } from 'hono/client'
import type { MediaController } from '@/ui/components/viewers/types'
import type { AssetInfo, AssetInfoPaginatedList, CommentInfo } from '@shumai/dtos'
import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router'
import { Loader2 } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import type { MediaController } from '@/ui/components/viewers/types'
function FileViewPage() {
const { projectId, fileId } = Route.useParams()
@@ -446,7 +446,7 @@ function FileViewPage() {
/>
<div
style={{ width: rightSidebarWidth }}
className="flex-shrink-0 bg-background border-l border-border flex flex-col"
className="flex-shrink-0 bg-background flex flex-col"
>
{isChatbotOpen ? (
<ChatbotSidebar projectId={projectId} contextAssetId={activeFileId} />