mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-19 16:31:36 +00:00
fix: display bugs (#560)
This commit is contained in:
commit
594fc6dad3
6 changed files with 45 additions and 21 deletions
|
|
@ -285,11 +285,17 @@ def auto_listen_toolkit(base_toolkit_class: Type[T]) -> Callable[[Type[T]], Type
|
|||
for method_name, base_method in base_methods.items():
|
||||
if method_name in cls.__dict__:
|
||||
continue
|
||||
|
||||
|
||||
sig = signature(base_method)
|
||||
|
||||
|
||||
def create_wrapper(method_name: str, base_method: Callable) -> Callable:
|
||||
if iscoroutinefunction(base_method):
|
||||
# Unwrap decorators to check the actual function
|
||||
unwrapped_method = base_method
|
||||
while hasattr(unwrapped_method, '__wrapped__'):
|
||||
unwrapped_method = unwrapped_method.__wrapped__
|
||||
|
||||
# Check if the unwrapped method is a coroutine function
|
||||
if iscoroutinefunction(unwrapped_method):
|
||||
async def async_method_wrapper(self, *args, **kwargs):
|
||||
return await getattr(super(cls, self), method_name)(*args, **kwargs)
|
||||
async_method_wrapper.__name__ = method_name
|
||||
|
|
@ -301,12 +307,12 @@ def auto_listen_toolkit(base_toolkit_class: Type[T]) -> Callable[[Type[T]], Type
|
|||
sync_method_wrapper.__name__ = method_name
|
||||
sync_method_wrapper.__signature__ = sig
|
||||
return sync_method_wrapper
|
||||
|
||||
|
||||
wrapper = create_wrapper(method_name, base_method)
|
||||
decorated_method = listen_toolkit(base_method)(wrapper)
|
||||
|
||||
|
||||
setattr(cls, method_name, decorated_method)
|
||||
|
||||
return cls
|
||||
|
||||
|
||||
return class_decorator
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ interface TaskCardProps {
|
|||
onUpdateTask: (taskIndex: number, content: string) => void;
|
||||
onDeleteTask: (taskIndex: number) => void;
|
||||
clickable?: boolean;
|
||||
chatId?: string;
|
||||
}
|
||||
|
||||
export function TaskCard({
|
||||
|
|
@ -47,14 +48,15 @@ export function TaskCard({
|
|||
onUpdateTask,
|
||||
onDeleteTask,
|
||||
clickable = true,
|
||||
chatId,
|
||||
}: TaskCardProps) {
|
||||
const { t } = useTranslation();
|
||||
const [isExpanded, setIsExpanded] = useState(true);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const [contentHeight, setContentHeight] = useState<number | "auto">("auto");
|
||||
|
||||
//Get Chatstore for the active project's task
|
||||
const { chatStore } = useChatStoreAdapter();
|
||||
//Get Chatstore and ProjectStore for the active project's task
|
||||
const { chatStore, projectStore } = useChatStoreAdapter();
|
||||
if (!chatStore) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
|
@ -329,6 +331,20 @@ export function TaskCard({
|
|||
<div
|
||||
onClick={() => {
|
||||
if (task.agent) {
|
||||
// Switch to the chatStore that owns this task card (for multi-turn conversations)
|
||||
if (chatId && projectStore.activeProjectId) {
|
||||
const activeChatStore = projectStore.getActiveChatStore();
|
||||
const currentChatId = activeChatStore ? Object.keys(projectStore.projects[projectStore.activeProjectId].chatStores).find(
|
||||
id => projectStore.projects[projectStore.activeProjectId].chatStores[id] === activeChatStore
|
||||
) : null;
|
||||
|
||||
// Only switch if this is a different chat
|
||||
if (currentChatId !== chatId) {
|
||||
projectStore.setActiveChatStore(projectStore.activeProjectId, chatId);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the active workspace and agent
|
||||
chatStore.setActiveWorkSpace(
|
||||
chatStore.activeTaskId as string,
|
||||
"workflow"
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@ export const UserQueryGroup: React.FC<UserQueryGroupProps> = ({
|
|||
|
||||
// Show task if this query group has a task message OR if it's the most recent user query during splitting
|
||||
// During splitting phase (no to_sub_tasks yet), show task for the most recent query only
|
||||
const isLastUserQuery = !queryGroup.taskMessage &&
|
||||
activeTaskId &&
|
||||
const isLastUserQuery = !queryGroup.taskMessage &&
|
||||
activeTaskId &&
|
||||
chatState.tasks[activeTaskId] &&
|
||||
queryGroup.userMessage &&
|
||||
queryGroup.userMessage &&
|
||||
queryGroup.userMessage.id === chatState.tasks[activeTaskId].messages.filter((m: any) => m.role === 'user').pop()?.id &&
|
||||
// Only show during active phases (not finished)
|
||||
chatState.tasks[activeTaskId].status !== 'finished';
|
||||
|
||||
|
||||
const task = (queryGroup.taskMessage || isLastUserQuery) && activeTaskId ? chatState.tasks[activeTaskId] : null;
|
||||
|
||||
// Set up intersection observer for this query group
|
||||
|
|
@ -185,6 +185,7 @@ export const UserQueryGroup: React.FC<UserQueryGroupProps> = ({
|
|||
>
|
||||
<TaskCard
|
||||
key={`task-${activeTaskId}-${queryGroup.queryId}`}
|
||||
chatId={chatId}
|
||||
taskInfo={task?.taskInfo || []}
|
||||
taskType={queryGroup.taskMessage?.taskType || 1}
|
||||
taskAssigning={task?.taskAssigning || []}
|
||||
|
|
|
|||
|
|
@ -330,9 +330,9 @@ function HeaderWin() {
|
|||
{chatStore.activeTaskId &&
|
||||
chatStore.tasks[chatStore.activeTaskId as string] &&
|
||||
(
|
||||
chatStore.tasks[chatStore.activeTaskId as string].messages.length > 0 ||
|
||||
chatStore.tasks[chatStore.activeTaskId as string].hasMessages ||
|
||||
chatStore.tasks[chatStore.activeTaskId as string].status !== 'pending'
|
||||
(chatStore.tasks[chatStore.activeTaskId as string]?.messages?.length || 0) > 0 ||
|
||||
chatStore.tasks[chatStore.activeTaskId as string]?.hasMessages ||
|
||||
chatStore.tasks[chatStore.activeTaskId as string]?.status !== 'pending'
|
||||
) && (
|
||||
<TooltipSimple content={t("layout.end-project")} side="bottom" align="end">
|
||||
<Button
|
||||
|
|
@ -392,4 +392,4 @@ function HeaderWin() {
|
|||
);
|
||||
}
|
||||
|
||||
export default HeaderWin;
|
||||
export default HeaderWin;
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ export default function Home() {
|
|||
<div className="w-full h-full flex-1 flex flex-col animate-in fade-in-0 pr-2 slide-in-from-right-2 duration-300">
|
||||
{chatStore.tasks[
|
||||
chatStore.activeTaskId as string
|
||||
]?.taskAssigning.find(
|
||||
]?.taskAssigning?.find(
|
||||
(agent) =>
|
||||
agent.agent_id ===
|
||||
chatStore.tasks[chatStore.activeTaskId as string]
|
||||
|
|
@ -231,7 +231,7 @@ export default function Home() {
|
|||
)}
|
||||
{chatStore.tasks[
|
||||
chatStore.activeTaskId as string
|
||||
]?.taskAssigning.find(
|
||||
]?.taskAssigning?.find(
|
||||
(agent) =>
|
||||
agent.agent_id ===
|
||||
chatStore.tasks[chatStore.activeTaskId as string]
|
||||
|
|
@ -256,7 +256,7 @@ export default function Home() {
|
|||
)}
|
||||
{chatStore.tasks[
|
||||
chatStore.activeTaskId as string
|
||||
]?.taskAssigning.find(
|
||||
]?.taskAssigning?.find(
|
||||
(agent) =>
|
||||
agent.agent_id ===
|
||||
chatStore.tasks[chatStore.activeTaskId as string]
|
||||
|
|
@ -270,7 +270,7 @@ export default function Home() {
|
|||
<Folder
|
||||
data={chatStore.tasks[
|
||||
chatStore.activeTaskId as string
|
||||
]?.taskAssigning.find(
|
||||
]?.taskAssigning?.find(
|
||||
(agent) =>
|
||||
agent.agent_id ===
|
||||
chatStore.tasks[chatStore.activeTaskId as string]
|
||||
|
|
|
|||
|
|
@ -551,7 +551,8 @@ const chatStore = (initial?: Partial<ChatStore>) => createStore<ChatStore>()(
|
|||
taskType: type ? 2 : 1,
|
||||
showType: "list",
|
||||
// Don't auto-confirm for multi-turn complex tasks - show workforce splitting panel
|
||||
isConfirm: shouldAutoConfirm
|
||||
isConfirm: shouldAutoConfirm,
|
||||
task_id: currentTaskId
|
||||
};
|
||||
addMessages(currentTaskId, newMessage)
|
||||
const newTaskInfo = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue