From 909485f5b468b838e1bc849d5d65f8fd8243566b Mon Sep 17 00:00:00 2001 From: Lokendra Singh Date: Mon, 10 Nov 2025 16:26:38 +0530 Subject: [PATCH 1/2] minor changes --- src/api/chat-event-stream.ts | 9 ++++++--- src/api/create-chat-stream.ts | 5 +++-- src/config.ts | 2 +- src/features/chat.tsx | 12 ++++++------ src/features/storymap-preview.tsx | 4 ++-- src/tests/dummy-templates.ts | 4 ++-- src/types/storymap.types.ts | 4 ++-- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/api/chat-event-stream.ts b/src/api/chat-event-stream.ts index 6b13030..d187f3f 100644 --- a/src/api/chat-event-stream.ts +++ b/src/api/chat-event-stream.ts @@ -26,11 +26,14 @@ export function createStreamManager(options: StreamManagerOptions) { try { const parsedData = JSON.parse(event.data); console.log("Parsed Data: ", parsedData); - if(parsedData.type === "presentation_content"){ - onStorymapMessage?.(parsedData.data); - } else if(parsedData.type === "status" || parsedData.type === "complete"){ + if(parsedData.type === "placestory"){ + console.log("Placestory: ", parsedData.payload); + onStorymapMessage?.(parsedData.payload); + } else if(parsedData.type === "status"){ console.log("Status: ", parsedData); onJobStatus?.(parsedData); + } else if(parsedData.type === "message"){ + onStreaming?.(parsedData.payload); } else { onStreaming?.(parsedData); console.log("Streaming: ", parsedData); diff --git a/src/api/create-chat-stream.ts b/src/api/create-chat-stream.ts index 577310e..fdaecb6 100644 --- a/src/api/create-chat-stream.ts +++ b/src/api/create-chat-stream.ts @@ -12,10 +12,11 @@ export const createChatStream = async (props: ChatProps) => { try { const result = await ky.post(`${BASE_URL}/v1/storymap/chat/${sessionId}`, { + timeout: 30000, json: { user_message: prompt - } - } + }, + }, ).json() console.log("Result:", result); return result diff --git a/src/config.ts b/src/config.ts index 0af0ab6..a54a5bf 100644 --- a/src/config.ts +++ b/src/config.ts @@ -16,4 +16,4 @@ export const LOCAL_API_URL = "http://localhost:8000" // } // } -export const BASE_URL = API_URL \ No newline at end of file +export const BASE_URL = LOCAL_API_URL \ No newline at end of file diff --git a/src/features/chat.tsx b/src/features/chat.tsx index 569fa98..7b18550 100644 --- a/src/features/chat.tsx +++ b/src/features/chat.tsx @@ -23,9 +23,9 @@ import remarkGfm from "remark-gfm"; import { v4 as uuidv4 } from "uuid"; const queries = [ - "Build me an interactive presentation for 1 S Main St, Bel Air, MD 21014 for use as a Restaurant", - "Build me an interactive presentation for 123 Market Street, San Francisco, CA 94105 for use as a Retail", - "Build me an interactive presentation for 555 Madison Avenue, New York, NY 10022 for use as an Office", + "Plan a placestory highlighting the redevelopment of 1 S Main St, Bel Air, MD 21014 into a farm-to-table dining destination.", + "Design a placestory showcasing 123 Market Street, San Francisco, CA 94105 as an innovative retail hub for emerging brands.", + "Craft a placestory that positions 555 Madison Avenue, New York, NY 10022 as a premium corporate headquarters for finance firms.", ]; export const Chat = () => { @@ -225,7 +225,7 @@ const ChatMessages = ({ const messagesEndRef = useRef(null); const scrollContainerRef = useRef(null); const [showCopiedMessage, setShowCopiedMessage] = useState(false); - const { streamId, jobStatus } = useUserStore(); + const { streamId, jobStatus, isProcessingMessage } = useUserStore(); console.log("Job status: ", jobStatus); @@ -307,7 +307,7 @@ const ChatMessages = ({
- IP Agent + Placestory
)} @@ -483,7 +483,7 @@ const ChatMessages = ({ {/* Copy button for assistant messages only */} - {message.type === "assistant" && !streamId && ( + {message.type === "assistant" && !isProcessingMessage && (
diff --git a/src/features/storymap-preview.tsx b/src/features/storymap-preview.tsx index 6fedce8..1ed1b56 100644 --- a/src/features/storymap-preview.tsx +++ b/src/features/storymap-preview.tsx @@ -63,12 +63,12 @@ export const StorymapPreview = () => { return (
- {storymapContent?.presentation_title || "Presentation Title here..."} + {storymapContent?.placestory_title || "Presentation Title here..."}
{storymapContent && ( - + )}
diff --git a/src/tests/dummy-templates.ts b/src/tests/dummy-templates.ts index 6b9ac66..7319b14 100644 --- a/src/tests/dummy-templates.ts +++ b/src/tests/dummy-templates.ts @@ -3,8 +3,8 @@ import type { StorymapTemplate } from "@/types/storymap.types"; const dummyImageUrl = "https://res.cloudinary.com/truva-production/image/upload/t_large_image/t_invisible_watermark/f_auto/oykm1v47ofwvz737xz27" export const DummyTemplate: StorymapTemplate = { - presentation_title: "A Premier Culinary Destination: 555 Madison Avenue", - presentation_blocks: [ + placestory_title: "A Premier Culinary Destination: 555 Madison Avenue", + placestory_blocks: [ { id: "cover_block_01", type: "cover" as const, diff --git a/src/types/storymap.types.ts b/src/types/storymap.types.ts index 4c48ec8..4958c6e 100644 --- a/src/types/storymap.types.ts +++ b/src/types/storymap.types.ts @@ -103,6 +103,6 @@ export type StorymapBlocks = CoverBlockType | TextBlockType | ImageBlockType | M export interface StorymapTemplate { - presentation_title: string; - presentation_blocks: StorymapBlocks[]; + placestory_title: string; + placestory_blocks: StorymapBlocks[]; } \ No newline at end of file From 9546780aad41e0dbd2daba40571eafabeaac652c Mon Sep 17 00:00:00 2001 From: Lokendra Singh Date: Mon, 10 Nov 2025 16:33:35 +0530 Subject: [PATCH 2/2] remove build error --- src/features/chat.tsx | 2 +- src/lib/utils.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/chat.tsx b/src/features/chat.tsx index 7b18550..788f406 100644 --- a/src/features/chat.tsx +++ b/src/features/chat.tsx @@ -225,7 +225,7 @@ const ChatMessages = ({ const messagesEndRef = useRef(null); const scrollContainerRef = useRef(null); const [showCopiedMessage, setShowCopiedMessage] = useState(false); - const { streamId, jobStatus, isProcessingMessage } = useUserStore(); + const { jobStatus, isProcessingMessage } = useUserStore(); console.log("Job status: ", jobStatus); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 3e07eb4..9532c4e 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -96,13 +96,13 @@ export const mdForBlock = (presentationBlock: StorymapBlocks, level = 2): string export const storymapToMarkdown = (t: StorymapTemplate): string => { const frontmatter = [ "---", - `Title: ${t.presentation_title}`, + `Title: ${t.placestory_title}`, "Exported: true", "---", "", ].join("\n"); - const title = `# ${t.presentation_title}\n\n`; - const body = t.presentation_blocks.map(b => mdForBlock(b, 2)).join("\n"); + const title = `# ${t.placestory_title}\n\n`; + const body = t.placestory_blocks.map(b => mdForBlock(b, 2)).join("\n"); return frontmatter + title + body; }