fix: restore isnew handling and frontend dockerfile path
This commit is contained in:
parent
9dc8970ab7
commit
6062b994a9
2
Makefile
2
Makefile
|
|
@ -279,7 +279,7 @@ docker-publish:
|
||||||
@echo "=========================================="
|
@echo "=========================================="
|
||||||
@IMAGE=registry.xueai.art/deerflow/deerflow-$(SVC):$(VER); \
|
@IMAGE=registry.xueai.art/deerflow/deerflow-$(SVC):$(VER); \
|
||||||
DOCKERFILE=$$(case "$(SVC)" in \
|
DOCKERFILE=$$(case "$(SVC)" in \
|
||||||
frontend) echo "frontend/Dockerfile.prod";; \
|
frontend) echo "frontend/Dockerfile";; \
|
||||||
gateway) echo "backend/Dockerfile";; \
|
gateway) echo "backend/Dockerfile";; \
|
||||||
langgraph) echo "backend/Dockerfile";; \
|
langgraph) echo "backend/Dockerfile";; \
|
||||||
*) echo "";; \
|
*) echo "";; \
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { FilesIcon, ListTodoIcon, XIcon } from "lucide-react";
|
import { FilesIcon, ListTodoIcon, XIcon } from "lucide-react";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
import { ConversationEmptyState } from "@/components/ai-elements/conversation";
|
import { ConversationEmptyState } from "@/components/ai-elements/conversation";
|
||||||
|
|
@ -54,6 +55,20 @@ export default function ChatPage() {
|
||||||
fullscreen,
|
fullscreen,
|
||||||
} = useArtifacts();
|
} = useArtifacts();
|
||||||
const { threadId, isNewThread, setIsNewThread, isMock } = useThreadChat();
|
const { threadId, isNewThread, setIsNewThread, isMock } = useThreadChat();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
// Submission strategy is controlled by `isnew` query param only.
|
||||||
|
// - isnew=false: reuse existing thread
|
||||||
|
// - otherwise: create/start a new session
|
||||||
|
const createNewSession = useMemo(() => {
|
||||||
|
if (!isNewThread) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return searchParams.get("isnew")?.trim().toLowerCase() !== "false";
|
||||||
|
}, [isNewThread, searchParams]);
|
||||||
|
const streamThreadId = useMemo(() => {
|
||||||
|
return isNewThread && createNewSession ? undefined : threadId;
|
||||||
|
}, [createNewSession, isNewThread, threadId]);
|
||||||
|
|
||||||
const { showNotification } = useNotification();
|
const { showNotification } = useNotification();
|
||||||
|
|
||||||
|
|
@ -64,7 +79,7 @@ export default function ChatPage() {
|
||||||
isBootstrapping: isSelectedSkillBootstrapping,
|
isBootstrapping: isSelectedSkillBootstrapping,
|
||||||
} = useSelectedSkillListener({ threadId });
|
} = useSelectedSkillListener({ threadId });
|
||||||
const [thread, sendMessage, isUploading] = useThreadStream({
|
const [thread, sendMessage, isUploading] = useThreadStream({
|
||||||
threadId: isNewThread ? undefined : threadId,
|
threadId: streamThreadId,
|
||||||
context: settings.context,
|
context: settings.context,
|
||||||
isMock,
|
isMock,
|
||||||
onStart: (currentThreadId) => {
|
onStart: (currentThreadId) => {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,14 @@ export function useThreadChat() {
|
||||||
|
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const [threadId, setThreadId] = useState(() => {
|
const [threadId, setThreadId] = useState(() => {
|
||||||
return threadIdFromPath === "new" ? uuid() : threadIdFromPath;
|
if (threadIdFromPath === "new") {
|
||||||
|
const shouldUseQueryThreadId = pathname.startsWith("/workspace/chats/");
|
||||||
|
const queryThreadId = shouldUseQueryThreadId
|
||||||
|
? searchParams.get("thread_id")?.trim()
|
||||||
|
: undefined;
|
||||||
|
return queryThreadId ?? uuid();
|
||||||
|
}
|
||||||
|
return threadIdFromPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
const [isNewThread, setIsNewThread] = useState(
|
const [isNewThread, setIsNewThread] = useState(
|
||||||
|
|
@ -21,9 +28,16 @@ export function useThreadChat() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pathname.endsWith("/new")) {
|
if (pathname.endsWith("/new")) {
|
||||||
setIsNewThread(true);
|
setIsNewThread(true);
|
||||||
setThreadId(uuid());
|
const shouldUseQueryThreadId = pathname.startsWith("/workspace/chats/");
|
||||||
|
const queryThreadId = shouldUseQueryThreadId
|
||||||
|
? searchParams.get("thread_id")?.trim()
|
||||||
|
: undefined;
|
||||||
|
setThreadId(queryThreadId ?? uuid());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}, [pathname]);
|
setIsNewThread(false);
|
||||||
|
setThreadId(threadIdFromPath);
|
||||||
|
}, [pathname, searchParams, threadIdFromPath]);
|
||||||
const isMock = searchParams.get("mock") === "true";
|
const isMock = searchParams.get("mock") === "true";
|
||||||
return { threadId, isNewThread, setIsNewThread, isMock };
|
return { threadId, isNewThread, setIsNewThread, isMock };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue