mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
jump to file for edit request
This commit is contained in:
parent
d6327f2b03
commit
9a8814cc50
3 changed files with 24 additions and 16 deletions
|
|
@ -102,6 +102,23 @@ const CopyButton = ({ codeStr }: { codeStr: string }) => {
|
|||
const applyingURIOfApplyBoxIdRef: { current: { [applyBoxId: string]: URI | undefined } } = { current: {} }
|
||||
|
||||
|
||||
|
||||
|
||||
export const JumpToFileButton = ({ uri }: { uri: URI | 'current' }) => {
|
||||
const accessor = useAccessor()
|
||||
const commandService = accessor.get('ICommandService')
|
||||
|
||||
const jumpToFileButton = uri !== 'current' && (
|
||||
<IconShell1
|
||||
Icon={FileSymlink}
|
||||
onClick={() => { commandService.executeCommand('vscode.open', uri, { preview: true }) }}
|
||||
title="Reject changes"
|
||||
/>
|
||||
)
|
||||
|
||||
return jumpToFileButton
|
||||
}
|
||||
|
||||
export const useApplyButtonHTML = ({ codeStr, applyBoxId, uri }: { codeStr: string, applyBoxId: string, uri: URI | 'current' }) => {
|
||||
|
||||
const settingsState = useSettingsState()
|
||||
|
|
@ -110,7 +127,6 @@ export const useApplyButtonHTML = ({ codeStr, applyBoxId, uri }: { codeStr: stri
|
|||
const accessor = useAccessor()
|
||||
const editCodeService = accessor.get('IEditCodeService')
|
||||
const metricsService = accessor.get('IMetricsService')
|
||||
const commandService = accessor.get('ICommandService')
|
||||
|
||||
const [_, rerender] = useState(0)
|
||||
|
||||
|
|
@ -220,27 +236,20 @@ export const useApplyButtonHTML = ({ codeStr, applyBoxId, uri }: { codeStr: stri
|
|||
/>
|
||||
)
|
||||
|
||||
const jumpToFileHTML = uri !== 'current' && (
|
||||
<IconShell1
|
||||
Icon={FileSymlink}
|
||||
onClick={() => { commandService.executeCommand('vscode.open', uri, { preview: true }) }}
|
||||
title="Reject changes"
|
||||
/>
|
||||
)
|
||||
|
||||
|
||||
let buttonsHTML = <></>
|
||||
|
||||
if (currStreamState === 'streaming') {
|
||||
buttonsHTML = <>
|
||||
{jumpToFileHTML}
|
||||
<JumpToFileButton uri={uri} />
|
||||
{stopButton}
|
||||
</>
|
||||
}
|
||||
|
||||
if (currStreamState === 'idle') {
|
||||
buttonsHTML = <>
|
||||
{jumpToFileHTML}
|
||||
<JumpToFileButton uri={uri} />
|
||||
{copyButton}
|
||||
{playButton}
|
||||
</>
|
||||
|
|
@ -248,7 +257,7 @@ export const useApplyButtonHTML = ({ codeStr, applyBoxId, uri }: { codeStr: stri
|
|||
|
||||
if (currStreamState === 'acceptRejectAll') {
|
||||
buttonsHTML = <>
|
||||
{jumpToFileHTML}
|
||||
<JumpToFileButton uri={uri} />
|
||||
{reapplyButton}
|
||||
{rejectButton}
|
||||
{acceptButton}
|
||||
|
|
@ -290,7 +299,7 @@ export const BlockCodeApplyWrapper = ({
|
|||
children: React.ReactNode;
|
||||
applyBoxId: string;
|
||||
canApply: boolean;
|
||||
language:string;
|
||||
language: string;
|
||||
uri: URI | 'current',
|
||||
}) => {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import { getModelSelectionState, getModelCapabilities } from '../../../../common
|
|||
import { AlertTriangle, Ban, ChevronRight, Dot, Pencil, X } from 'lucide-react';
|
||||
import { ChatMessage, StagingSelectionItem, ToolMessage, ToolRequestApproval } from '../../../../common/chatThreadServiceTypes.js';
|
||||
import { ResolveReason, ToolCallParams, ToolName, ToolNameWithApproval } from '../../../../common/toolsServiceTypes.js';
|
||||
import { useApplyButtonHTML } from '../markdown/ApplyBlockHoverButtons.js';
|
||||
import { JumpToFileButton, useApplyButtonHTML } from '../markdown/ApplyBlockHoverButtons.js';
|
||||
import { DiffZone } from '../../../editCodeService.js';
|
||||
import { ScrollType } from '../../../../../../../editor/common/editorCommon.js';
|
||||
|
||||
|
|
@ -1546,6 +1546,8 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
changeDescription={params.changeDescription}
|
||||
/>
|
||||
|
||||
componentParams.desc2 = <JumpToFileButton uri={params.uri} />
|
||||
|
||||
return <ToolHeaderWrapper {...componentParams} />
|
||||
},
|
||||
resultWrapper: ({ toolMessage, messageIdx }) => {
|
||||
|
|
@ -1944,8 +1946,6 @@ export const SidebarChat = () => {
|
|||
// send message to LLM
|
||||
const userMessage = textAreaRef.current?.value ?? ''
|
||||
|
||||
// getModelCapabilities() // TODO!!! check if can go into agent mode
|
||||
|
||||
try {
|
||||
await chatThreadsService.addUserMessageAndStreamResponse({ userMessage, threadId })
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@ export const prepareMessages = ({
|
|||
const { messages: messages4 } = prepareMessages_tools({ messages: messages3, supportsTools })
|
||||
const { messages: messages5 } = prepareMessages_noEmptyMessage({ messages: messages4 })
|
||||
|
||||
console.log('MESSAGES!!!', JSON.stringify(messages, null, 2))
|
||||
return {
|
||||
messages: messages5 as any,
|
||||
separateSystemMessageStr
|
||||
|
|
|
|||
Loading…
Reference in a new issue