mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-27 07:44:48 +08:00
fix: allow the first activity to be reporting (#8)
This commit is contained in:
@@ -65,8 +65,10 @@ export function ResearchBlock({
|
|||||||
|
|
||||||
// When the research id changes, set the active tab to activities
|
// When the research id changes, set the active tab to activities
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setActiveTab("activities");
|
if (!hasReport) {
|
||||||
}, [researchId]);
|
setActiveTab("activities");
|
||||||
|
}
|
||||||
|
}, [hasReport, researchId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("h-full w-full", className)}>
|
<div className={cn("h-full w-full", className)}>
|
||||||
|
|||||||
@@ -182,24 +182,17 @@ function appendMessage(message: Message) {
|
|||||||
message.agent === "reporter" ||
|
message.agent === "reporter" ||
|
||||||
message.agent === "researcher"
|
message.agent === "researcher"
|
||||||
) {
|
) {
|
||||||
|
if (!getOngoingResearchId()) {
|
||||||
|
const id = message.id;
|
||||||
|
appendResearch(id);
|
||||||
|
openResearch(id);
|
||||||
|
}
|
||||||
appendResearchActivity(message);
|
appendResearchActivity(message);
|
||||||
}
|
}
|
||||||
useStore.getState().appendMessage(message);
|
useStore.getState().appendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMessage(message: Message) {
|
function updateMessage(message: Message) {
|
||||||
if (
|
|
||||||
message.agent === "researcher" ||
|
|
||||||
message.agent === "coder" ||
|
|
||||||
message.agent === "reporter"
|
|
||||||
) {
|
|
||||||
const id = message.id;
|
|
||||||
if (!getOngoingResearchId()) {
|
|
||||||
appendResearch(id);
|
|
||||||
openResearch(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
getOngoingResearchId() &&
|
getOngoingResearchId() &&
|
||||||
message.agent === "reporter" &&
|
message.agent === "reporter" &&
|
||||||
@@ -244,12 +237,15 @@ function appendResearchActivity(message: Message) {
|
|||||||
const researchId = getOngoingResearchId();
|
const researchId = getOngoingResearchId();
|
||||||
if (researchId) {
|
if (researchId) {
|
||||||
const researchActivityIds = useStore.getState().researchActivityIds;
|
const researchActivityIds = useStore.getState().researchActivityIds;
|
||||||
useStore.setState({
|
const current = researchActivityIds.get(researchId)!;
|
||||||
researchActivityIds: new Map(researchActivityIds).set(researchId, [
|
if (!current.includes(message.id)) {
|
||||||
...researchActivityIds.get(researchId)!,
|
useStore.setState({
|
||||||
message.id,
|
researchActivityIds: new Map(researchActivityIds).set(researchId, [
|
||||||
]),
|
...current,
|
||||||
});
|
message.id,
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
}
|
||||||
if (message.agent === "reporter") {
|
if (message.agent === "reporter") {
|
||||||
useStore.setState({
|
useStore.setState({
|
||||||
researchReportIds: new Map(useStore.getState().researchReportIds).set(
|
researchReportIds: new Map(useStore.getState().researchReportIds).set(
|
||||||
|
|||||||
Reference in New Issue
Block a user