mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(artifacts): render artifacts from the checked path and serve raw files once
- show_artifact returns the validated path as tool metadata; the chat card renders from it and maps repo paths with getWorkspaceFilePath, so local repos and moved sessions load the right file - serve .htm as text/html - raw file route stats and reads once and adds ETag/Last-Modified with 304 - reuse isPathWithinRoot from utils/fs-safe - move readShowArtifactCall to frontend/src/lib/artifactTool
This commit is contained in:
1 parent
f7b2ffb865
commit
5e2452172c
26 files changed
+489
-58
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { memo } from 'react'
|
||||
import { readShowArtifactCall, type SessionMessageAssistant } from '@opencode-manager/shared/opencode'
|
||||
import type { SessionMessageAssistant } from '@opencode-manager/shared/opencode'
|
||||
import { TextPart } from './TextPart'
|
||||
import { ToolCallPart } from './ToolCallPart'
|
||||
import { readShowArtifactCall } from '@/lib/artifactTool'
|
||||
import { useSettings } from '@/hooks/useSettings'
|
||||
import type { ShellNoticeOutcome } from '@/lib/backgroundWork'
|
||||
import type { WalkthroughSource } from '@opencode-manager/shared/schemas'
|
||||
@@ -12,13 +13,15 @@ interface MessagePartProps {
|
||||
part: AssistantContentPart
|
||||
messageID?: string
|
||||
directory?: string
|
||||
repoFullPath?: string
|
||||
repoLocalPath?: string
|
||||
shellOutcome?: ShellNoticeOutcome
|
||||
onFileClick?: (filePath: string, lineNumber?: number) => void
|
||||
onChildSessionClick?: (sessionId: string) => void
|
||||
onOpenWalkthrough?: (source?: WalkthroughSource) => void
|
||||
}
|
||||
|
||||
export const MessagePart = memo(function MessagePart({ part, messageID, directory, shellOutcome, onFileClick, onChildSessionClick, onOpenWalkthrough }: MessagePartProps) {
|
||||
export const MessagePart = memo(function MessagePart({ part, messageID, directory, repoFullPath, repoLocalPath, shellOutcome, onFileClick, onChildSessionClick, onOpenWalkthrough }: MessagePartProps) {
|
||||
const { preferences } = useSettings()
|
||||
const simpleChatMode = preferences?.simpleChatMode ?? false
|
||||
const showReasoning = preferences?.showReasoning ?? false
|
||||
@@ -46,6 +49,8 @@ export const MessagePart = memo(function MessagePart({ part, messageID, director
|
||||
part={part}
|
||||
messageID={messageID}
|
||||
directory={directory}
|
||||
repoFullPath={repoFullPath}
|
||||
repoLocalPath={repoLocalPath}
|
||||
shellOutcome={shellOutcome}
|
||||
onFileClick={onFileClick}
|
||||
onChildSessionClick={onChildSessionClick}
|
||||
|
||||
Reference in new issue
Block a user