Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move found instructions to action history #142

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions src/common/CustomKnowledgeBase/MatchedNotes.tsx

This file was deleted.

42 changes: 42 additions & 0 deletions src/common/TaskHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {
Alert,
AlertIcon,
AlertDescription,
VStack,
HStack,
Box,
Expand All @@ -15,6 +18,44 @@ import {
import { TaskHistoryEntry } from "../state/currentTask";
import { useAppState } from "../state/store";
import CopyButton from "./CopyButton";
import Notes from "./CustomKnowledgeBase/Notes";

function MatchedNotes() {
const knowledge = useAppState((state) => state.currentTask.knowledgeInUse);
const notes = knowledge?.notes;
if (!notes || notes.length === 0) {
return null;
}

return (
<AccordionItem>
<Heading as="h3" size="sm">
<AccordionButton>
<Box mr="4" fontWeight="bold">
0.
</Box>
<Box as="span" textAlign="left" flex="1">
Found {notes.length} instructions.
</Box>
<AccordionIcon />
</AccordionButton>
</Heading>
<AccordionPanel backgroundColor="gray.100" p="2">
<Accordion allowMultiple w="full" defaultIndex={1}>
<Box pl={2}>
<Notes notes={notes} />
</Box>
<Alert status="info" borderRadius="sm" mt="1">
<AlertIcon />
<AlertDescription fontSize="0.8rem" lineHeight="4">
You can customize instructions in the settings menu.
</AlertDescription>
</Alert>
</Accordion>
</AccordionPanel>
</AccordionItem>
);
}

type TaskHistoryItemProps = {
index: number;
Expand Down Expand Up @@ -127,6 +168,7 @@ export default function TaskHistory() {
<CopyButton text={JSON.stringify(taskHistory, null, 2)} />
</HStack>
<Accordion allowMultiple w="full" pb="4">
<MatchedNotes />
{taskHistory.map((entry, index) => (
<TaskHistoryItem key={index} index={index} entry={entry} />
))}
Expand Down
4 changes: 1 addition & 3 deletions src/common/TaskUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import TaskHistory from "./TaskHistory";
import TaskStatus from "./TaskStatus";
import RecommendedTasks from "./RecommendedTasks";
import AutosizeTextarea from "./AutosizeTextarea";
import MatchedNotes from "./CustomKnowledgeBase/MatchedNotes";

function ActionExecutor() {
const state = useAppState((state) => ({
Expand Down Expand Up @@ -127,7 +126,7 @@ const TaskUI = () => {
{state.voiceMode && (
<Alert status="info" borderRadius="lg">
<AlertIcon />
<AlertDescription fontSize="sm">
<AlertDescription fontSize="sm" lineHeight="5">
In Voice Mode, you can press Space to start speaking and Space again
to stop. WebWand will run the task when you stop speaking. To turn
off Voice Mode, click the Setting icon in the top right corner.
Expand All @@ -138,7 +137,6 @@ const TaskUI = () => {
<RecommendedTasks runTask={runTaskWithNewInstructions} />
)}
{debugMode && <ActionExecutor />}
<MatchedNotes />
<TaskStatus />
<TaskHistory />
</>
Expand Down
Loading