mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-07-09 17:28:35 +00:00
fix: use per-task question when loading from history (#1366)
Previously, loading a project from history used the same single question string (project.last_prompt) for every task, regardless of what question each individual task had been created with. Now each task is replayed with its own question from task.question, falling back to the project-level question if a task's question is missing. Closes #1366
This commit is contained in:
parent
8da53e8644
commit
c6cf573cb8
3 changed files with 15 additions and 6 deletions
|
|
@ -146,6 +146,9 @@ export default function HistorySidebar() {
|
|||
const taskIdsList = project?.tasks.map(
|
||||
(task: HistoryTask) => task.task_id
|
||||
) || [projectId];
|
||||
const taskQuestionsList = project?.tasks.map(
|
||||
(task: HistoryTask) => task.question
|
||||
);
|
||||
|
||||
// If no tasks to replay, create an empty project
|
||||
if (!taskIdsList || taskIdsList.length === 0) {
|
||||
|
|
@ -165,7 +168,8 @@ export default function HistorySidebar() {
|
|||
question,
|
||||
historyId,
|
||||
taskIdsList,
|
||||
project?.project_name
|
||||
project?.project_name,
|
||||
taskQuestionsList
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ export const loadProjectFromHistory = async (
|
|||
question: string,
|
||||
historyId: string,
|
||||
taskIdsList?: string[],
|
||||
projectName?: string
|
||||
projectName?: string,
|
||||
taskQuestions?: string[]
|
||||
) => {
|
||||
const taskIds = taskIdsList || [projectId];
|
||||
await projectStore.loadProjectFromHistory(
|
||||
|
|
@ -44,7 +45,8 @@ export const loadProjectFromHistory = async (
|
|||
question,
|
||||
projectId,
|
||||
historyId,
|
||||
projectName
|
||||
projectName,
|
||||
taskQuestions
|
||||
);
|
||||
navigate({ pathname: '/' });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ interface ProjectStore {
|
|||
question: string,
|
||||
projectId: string,
|
||||
historyId?: string,
|
||||
projectName?: string
|
||||
projectName?: string,
|
||||
taskQuestions?: string[]
|
||||
) => Promise<string>;
|
||||
|
||||
// Project-level queued messages management
|
||||
|
|
@ -635,7 +636,8 @@ const projectStore = create<ProjectStore>()((set, get) => ({
|
|||
question: string,
|
||||
projectId: string,
|
||||
historyId?: string,
|
||||
projectName?: string
|
||||
projectName?: string,
|
||||
taskQuestions?: string[]
|
||||
) => {
|
||||
const { projects, removeProject, createProject, createChatStore } = get();
|
||||
|
||||
|
|
@ -679,7 +681,8 @@ const projectStore = create<ProjectStore>()((set, get) => ({
|
|||
const chatStore = project.chatStores[chatId];
|
||||
if (chatStore) {
|
||||
try {
|
||||
await chatStore.getState().replay(taskId, question, 0);
|
||||
const taskQuestion = taskQuestions?.[index] || question;
|
||||
await chatStore.getState().replay(taskId, taskQuestion, 0);
|
||||
console.log(`[ProjectStore] Loaded task ${taskId}`);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue