refactor: remove todo tool (#35989)
This commit is contained in:
parent
d4155f2906
commit
7feefb697f
250 changed files with 237 additions and 4755 deletions
|
|
@ -719,88 +719,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.todos {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
max-width: var(--sm-tool-width);
|
||||
border: 1px solid var(--sl-color-divider);
|
||||
border-radius: 0.25rem;
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
position: relative;
|
||||
padding-left: 1.5rem;
|
||||
font-size: 0.75rem;
|
||||
padding: 0.375rem 0.625rem 0.375rem 1.75rem;
|
||||
border-bottom: 1px solid var(--sl-color-divider);
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
& > span {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: 0.5rem;
|
||||
top: calc(0.5rem + 1px);
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
border: 1px solid var(--sl-color-divider);
|
||||
border-radius: 0.15rem;
|
||||
|
||||
&::before {
|
||||
}
|
||||
}
|
||||
|
||||
&[data-status="pending"] {
|
||||
color: var(--sl-color-text);
|
||||
}
|
||||
|
||||
&[data-status="in_progress"] {
|
||||
color: var(--sl-color-text);
|
||||
|
||||
& > span {
|
||||
border-color: var(--sl-color-orange);
|
||||
}
|
||||
|
||||
& > span::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: calc(0.75rem - 2px - 4px);
|
||||
height: calc(0.75rem - 2px - 4px);
|
||||
box-shadow: inset 1rem 1rem var(--sl-color-orange-low);
|
||||
}
|
||||
}
|
||||
|
||||
&[data-status="completed"] {
|
||||
color: var(--sl-color-text-secondary);
|
||||
|
||||
& > span {
|
||||
border-color: var(--sl-color-green-low);
|
||||
}
|
||||
|
||||
& > span::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: calc(0.75rem - 2px - 4px);
|
||||
height: calc(0.75rem - 2px - 4px);
|
||||
box-shadow: inset 1rem 1rem var(--sl-color-green);
|
||||
|
||||
transform-origin: bottom left;
|
||||
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-button {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
|
|
|
|||
|
|
@ -317,88 +317,6 @@
|
|||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
[data-component="todos"] {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
max-width: var(--sm-tool-width);
|
||||
border: 1px solid var(--sl-color-divider);
|
||||
border-radius: 0.25rem;
|
||||
|
||||
[data-slot="item"] {
|
||||
margin: 0;
|
||||
position: relative;
|
||||
padding-left: 1.5rem;
|
||||
font-size: 0.75rem;
|
||||
padding: 0.375rem 0.625rem 0.375rem 1.75rem;
|
||||
border-bottom: 1px solid var(--sl-color-divider);
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
& > span {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: 0.5rem;
|
||||
top: calc(0.5rem + 1px);
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
border: 1px solid var(--sl-color-divider);
|
||||
border-radius: 0.15rem;
|
||||
|
||||
&::before {
|
||||
}
|
||||
}
|
||||
|
||||
&[data-status="pending"] {
|
||||
color: var(--sl-color-text);
|
||||
}
|
||||
|
||||
&[data-status="in_progress"] {
|
||||
color: var(--sl-color-text);
|
||||
|
||||
& > span {
|
||||
border-color: var(--sl-color-orange);
|
||||
}
|
||||
|
||||
& > span::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: calc(0.75rem - 2px - 4px);
|
||||
height: calc(0.75rem - 2px - 4px);
|
||||
box-shadow: inset 1rem 1rem var(--sl-color-orange-low);
|
||||
}
|
||||
}
|
||||
|
||||
&[data-status="completed"] {
|
||||
color: var(--sl-color-text-secondary);
|
||||
|
||||
& > span {
|
||||
border-color: var(--sl-color-green-low);
|
||||
}
|
||||
|
||||
& > span::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: calc(0.75rem - 2px - 4px);
|
||||
height: calc(0.75rem - 2px - 4px);
|
||||
box-shadow: inset 1rem 1rem var(--sl-color-green);
|
||||
|
||||
transform-origin: bottom left;
|
||||
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[data-component="tool-args"] {
|
||||
display: inline-grid;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
IconGlobeAlt,
|
||||
IconDocument,
|
||||
IconPaperClip,
|
||||
IconQueueList,
|
||||
IconUserCircle,
|
||||
IconCommandLine,
|
||||
IconCheckCircle,
|
||||
|
|
@ -87,9 +86,6 @@ export function Part(props: PartProps) {
|
|||
<Match when={props.part.type === "reasoning" && props.message.role === "assistant"}>
|
||||
<IconBrain width={18} height={18} />
|
||||
</Match>
|
||||
<Match when={props.part.type === "tool" && props.part.tool === "todowrite"}>
|
||||
<IconQueueList width={18} height={18} />
|
||||
</Match>
|
||||
<Match when={props.part.type === "tool" && props.part.tool === "bash"}>
|
||||
<IconCommandLine width={18} height={18} />
|
||||
</Match>
|
||||
|
|
@ -248,14 +244,6 @@ export function Part(props: PartProps) {
|
|||
message={props.message}
|
||||
/>
|
||||
</Match>
|
||||
<Match when={props.part.tool === "todowrite"}>
|
||||
<TodoWriteTool
|
||||
message={props.message}
|
||||
id={props.part.id}
|
||||
tool={props.part.tool}
|
||||
state={props.part.state}
|
||||
/>
|
||||
</Match>
|
||||
<Match when={props.part.tool === "webfetch"}>
|
||||
<WebFetchTool
|
||||
message={props.message}
|
||||
|
|
@ -302,13 +290,6 @@ type ToolProps = {
|
|||
isLastPart?: boolean
|
||||
}
|
||||
|
||||
interface Todo {
|
||||
id: string
|
||||
content: string
|
||||
status: "pending" | "in_progress" | "completed"
|
||||
priority: "low" | "medium" | "high"
|
||||
}
|
||||
|
||||
function stripWorkingDirectory(filePath?: string, workingDir?: string) {
|
||||
if (filePath === undefined || workingDir === undefined) return filePath
|
||||
|
||||
|
|
@ -386,45 +367,6 @@ function formatErrorString(error: string, label: string): JSX.Element {
|
|||
)
|
||||
}
|
||||
|
||||
export function TodoWriteTool(props: ToolProps) {
|
||||
const messages = useShareMessages()
|
||||
const priority: Record<Todo["status"], number> = {
|
||||
in_progress: 0,
|
||||
pending: 1,
|
||||
completed: 2,
|
||||
}
|
||||
const todos = createMemo(() =>
|
||||
((props.state.input?.todos ?? []) as Todo[]).slice().sort((a, b) => priority[a.status] - priority[b.status]),
|
||||
)
|
||||
const starting = () => todos().every((t: Todo) => t.status === "pending")
|
||||
const finished = () => todos().every((t: Todo) => t.status === "completed")
|
||||
|
||||
return (
|
||||
<>
|
||||
<div data-component="tool-title">
|
||||
<span data-slot="name">
|
||||
<Switch fallback={messages.updating_plan}>
|
||||
<Match when={starting()}>{messages.creating_plan}</Match>
|
||||
<Match when={finished()}>{messages.completing_plan}</Match>
|
||||
</Switch>
|
||||
</span>
|
||||
</div>
|
||||
<Show when={todos().length > 0}>
|
||||
<ul data-component="todos">
|
||||
<For each={todos()}>
|
||||
{(todo) => (
|
||||
<li data-slot="item" data-status={todo.status}>
|
||||
<span></span>
|
||||
{todo.content}
|
||||
</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
</Show>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function GrepTool(props: ToolProps) {
|
||||
const messages = useShareMessages()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue