mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Fixes
This commit is contained in:
@@ -278,6 +278,7 @@ npm test
|
||||
When using tools to accomplish tasks, follow these guidelines for effective and informed decision-making:
|
||||
|
||||
- Treat each task as a multi-step process. Begin by planning the necessary steps within <thinking></thinking> tags.
|
||||
- At each step of the task, assess if you have the necessary information to proceed; if not, use the appropriate tool to gather it.
|
||||
- You must only make one tool use at a time, ensuring each tool's output is considered before proceeding to the next.
|
||||
- Do not assume the outcome of any tool use. Each step must be informed by the previous step's result.
|
||||
- After receiving the result of a tool use, analyze the result and decide the next step based on this information.
|
||||
|
||||
36
webview-ui/package-lock.json
generated
36
webview-ui/package-lock.json
generated
@@ -4458,6 +4458,15 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/hast": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
|
||||
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/html-minifier-terser": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz",
|
||||
@@ -9960,15 +9969,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/hast-util-is-element/node_modules/@types/hast": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
|
||||
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/hast-util-to-text": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz",
|
||||
@@ -9985,15 +9985,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/hast-util-to-text/node_modules/@types/hast": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
|
||||
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/hast-util-to-text/node_modules/@types/unist": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
|
||||
@@ -17169,15 +17160,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/rehype-highlight/node_modules/@types/hast": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
|
||||
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/rehype-highlight/node_modules/highlight.js": {
|
||||
"version": "11.9.0",
|
||||
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz",
|
||||
|
||||
@@ -764,10 +764,25 @@ const ProgressIndicator = () => (
|
||||
)
|
||||
|
||||
const Markdown = memo(({ markdown }: { markdown?: string }) => {
|
||||
// worth noting that remark parses out <thinking> tags
|
||||
const withoutThinkingTags = useMemo(() => {
|
||||
if (!markdown) return ""
|
||||
|
||||
let processed = markdown
|
||||
|
||||
// Remove end substrings of <thinking or </thinking
|
||||
processed = processed.replace(/<\/?t(?:h(?:i(?:n(?:k(?:i(?:n(?:g)?)?)?)?)?)?)?$/, "")
|
||||
|
||||
// Remove all instances of <thinking> (with optional line break after) and </thinking> (with optional line break before)
|
||||
// Needs to be separate since we dont want to remove the line break before the first tag
|
||||
processed = processed.replace(/<thinking>\s?/g, "")
|
||||
processed = processed.replace(/\s?<\/thinking>/g, "")
|
||||
|
||||
return processed
|
||||
}, [markdown])
|
||||
|
||||
return (
|
||||
<div style={{ wordBreak: "break-word", overflowWrap: "anywhere", marginBottom: -15, marginTop: -15 }}>
|
||||
<MarkdownBlock markdown={markdown} />
|
||||
<MarkdownBlock markdown={withoutThinkingTags} />
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -49,7 +49,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
const virtuosoRef = useRef<VirtuosoHandle>(null)
|
||||
const [expandedRows, setExpandedRows] = useState<Record<number, boolean>>({})
|
||||
const [isAtBottom, setIsAtBottom] = useState(false)
|
||||
const [didScrollFromApiReqTs, setDidScrollFromApiReqTs] = useState<number | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
// if last message is an ask, show user ask UI
|
||||
@@ -405,6 +404,8 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
})
|
||||
}, [modifiedMessages])
|
||||
|
||||
// scrolling
|
||||
|
||||
const toggleRowExpansion = useCallback(
|
||||
(ts: number) => {
|
||||
const isCollapsing = expandedRows[ts] ?? false
|
||||
@@ -452,8 +453,26 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
)
|
||||
|
||||
const [lastScrollMessageCount, setLastScrollMessageCount] = useState<number>(0)
|
||||
const [didScrollFromApiReqTs, setDidScrollFromApiReqTs] = useState<number | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
/*
|
||||
chatgpt scroll animation
|
||||
- theres 1 lines worth padding below the text, so when it starts adding text to that next line, it smoothly animates down. theres some debounce, its not exactly when the new line is added.
|
||||
|
||||
|
||||
// since we have scroll to bottom button we should respect if they scroll up,
|
||||
so our scrolling logic will be:
|
||||
- if at bottom, and last chatrow is partial (streaming), then listen to last chatrow height. if it increases, then animate scroll to bottom
|
||||
- if at bottom, then new complete chatrow will cause normal scroll animation (i.e. inspect site screenshot)
|
||||
- so we have to track this height and reset for new chat row
|
||||
- also need to add a bit more padding at the bottom to let the new text have some extra space before we animate to it
|
||||
|
||||
Notes:
|
||||
- show scroll to bottom button even if a little bit scrolled up so user knows that they wont see stream animation if the button shows. the button could act as a lock in to streamed content
|
||||
- dont show scroll to bottom if no overflow
|
||||
*/
|
||||
|
||||
const lastMessage = visibleMessages.at(-1)
|
||||
if (lastMessage?.partial && isAtBottom) {
|
||||
virtuosoRef.current?.scrollTo({ top: Number.MAX_SAFE_INTEGER, behavior: "auto" })
|
||||
@@ -476,6 +495,13 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
}
|
||||
}, [visibleMessages, didScrollFromApiReqTs])
|
||||
|
||||
const scrollToBottom = useCallback((smooth: boolean) => {
|
||||
virtuosoRef.current?.scrollTo({
|
||||
top: Number.MAX_SAFE_INTEGER,
|
||||
behavior: smooth ? "smooth" : "auto", // instant causes crash
|
||||
})
|
||||
}, [])
|
||||
|
||||
const placeholderText = useMemo(() => {
|
||||
const text = task ? "Type a message (@ to add context)..." : "Type your task here (@ to add context)..."
|
||||
return text
|
||||
@@ -501,7 +527,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
const scrollHeight = scroller.scrollHeight
|
||||
const clientHeight = scroller.clientHeight
|
||||
const scrollToBottomThreshold = 600
|
||||
setShowScrollToBottom(scrollHeight - scrollTop - clientHeight > scrollToBottomThreshold)
|
||||
// setShowScrollToBottom(scrollHeight - scrollTop - clientHeight > scrollToBottomThreshold)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
@@ -67,6 +67,12 @@ const StyledMarkdown = styled.div`
|
||||
ul {
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 2.5em;
|
||||
margin-left: 0;
|
||||
}
|
||||
`
|
||||
|
||||
const StyledPre = styled.pre<{ theme: any }>`
|
||||
|
||||
Reference in New Issue
Block a user