fix: resolve context block typings

This commit is contained in:
Innei
2025-08-30 10:45:50 +08:00
parent 371fc19796
commit 7944f974bf
4 changed files with 12 additions and 5 deletions
@@ -71,8 +71,8 @@ export const ContextBlock: FC<{ block: AIChatContextBlock }> = memo(({ block })
<div className="flex items-center gap-1.5">
<div className="relative">
<ImageThumbnail
previewUrl={previewUrl || dataUrl}
originalUrl={dataUrl}
previewUrl={previewUrl || dataUrl || ""}
originalUrl={dataUrl || ""}
alt={name}
filename={name}
className={"m-0.5 size-5 rounded-md"}
@@ -123,6 +123,8 @@ export function isImageAttachment(block: AIChatContextBlock): boolean {
* Gets display content for file attachments based on upload status
*/
export function getFileDisplayContent(attachment: FileAttachment): string {
const statusLabel = FILE_STATUS_LABELS[attachment.uploadStatus]
const status = attachment.uploadStatus
const statusLabel =
status !== undefined ? FILE_STATUS_LABELS[status as keyof typeof FILE_STATUS_LABELS] : undefined
return statusLabel || attachment.name
}
@@ -202,6 +202,7 @@ export async function uploadFileAttachment(
onProgressUpdate?.(currentAttachment)
const { dataUrl } = fileAttachment
if (!dataUrl) throw new Error("Missing data URL")
const blob = await fetch(dataUrl).then((r) => r.blob())
// TODO: Replace with real progress tracking when followApi supports it
@@ -1,5 +1,5 @@
import type { MCPService } from "@follow/shared/settings/interface"
import type { UpdateConnectionRequest } from "@follow-app/client-sdk"
import type { McpConnectionInfo, UpdateConnectionRequest } from "@follow-app/client-sdk"
import { followApi } from "~/lib/api-client"
@@ -14,7 +14,11 @@ export const createMCPConnection = async (connectionData: {
export const fetchMCPConnections = async (): Promise<MCPService[]> => {
const response = await followApi.mcp.getConnections()
return response.data
return response.data.map(
(service: McpConnectionInfo): MCPService => ({
...service,
}),
)
}
export const updateMCPConnection = async (