mirror of
https://github.com/voideditor/void
synced 2026-05-24 01:48:25 +00:00
Merge pull request #504 from voideditor/model-selection
do not show X / Check while streaming
This commit is contained in:
commit
eeb6167c12
2 changed files with 16 additions and 23 deletions
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------*/
|
||||
|
||||
import { useState, useEffect, useCallback, useRef, Fragment } from 'react'
|
||||
import { useAccessor, useCommandBarState, useCommandBarURIListener, useSettingsState } from '../util/services.js'
|
||||
import { useAccessor, useChatThreadsState, useChatThreadsStreamState, useCommandBarState, useCommandBarURIListener, useSettingsState } from '../util/services.js'
|
||||
import { usePromise, useRefState } from '../util/helpers.js'
|
||||
import { isFeatureNameDisabled } from '../../../../common/voidSettingsTypes.js'
|
||||
import { URI } from '../../../../../../../base/common/uri.js'
|
||||
|
|
@ -348,17 +348,19 @@ export const ApplyButtonsHTML = ({
|
|||
|
||||
|
||||
|
||||
export const EditToolButtonsHTML = ({
|
||||
export const EditToolAcceptRejectButtonsHTML = ({
|
||||
codeStr,
|
||||
applyBoxId,
|
||||
uri,
|
||||
type,
|
||||
threadId,
|
||||
}: {
|
||||
codeStr: string,
|
||||
applyBoxId: string,
|
||||
} & ({
|
||||
uri: URI,
|
||||
type: 'edit_file' | 'rewrite_file'
|
||||
type: 'edit_file' | 'rewrite_file',
|
||||
threadId: string,
|
||||
})
|
||||
) => {
|
||||
const accessor = useAccessor()
|
||||
|
|
@ -368,17 +370,10 @@ export const EditToolButtonsHTML = ({
|
|||
const { streamState } = useEditToolStreamState({ applyBoxId, uri })
|
||||
const settingsState = useSettingsState()
|
||||
|
||||
const isDisabled = !!isFeatureNameDisabled('Chat', settingsState) || !applyBoxId
|
||||
const chatThreadsStreamState = useChatThreadsStreamState(threadId)
|
||||
const isRunning = chatThreadsStreamState?.isRunning
|
||||
|
||||
const onClickSubmit = useCallback(async () => {
|
||||
await editCodeService.callBeforeApplyOrEdit(uri)
|
||||
if (type === 'edit_file') {
|
||||
editCodeService.instantlyApplySearchReplaceBlocks({ uri, searchReplaceBlocks: codeStr })
|
||||
}
|
||||
else if (type === 'rewrite_file') {
|
||||
editCodeService.instantlyRewriteFile({ uri, newContent: codeStr })
|
||||
}
|
||||
}, [type, editCodeService, codeStr, uri, applyBoxId, metricsService])
|
||||
const isDisabled = !!isFeatureNameDisabled('Chat', settingsState) || !applyBoxId
|
||||
|
||||
const onAccept = useCallback(() => {
|
||||
editCodeService.acceptOrRejectAllDiffAreas({ uri, behavior: 'accept', removeCtrlKs: false })
|
||||
|
|
@ -392,14 +387,11 @@ export const EditToolButtonsHTML = ({
|
|||
|
||||
if (streamState === 'idle-no-changes') {
|
||||
return null
|
||||
// return <IconShell1
|
||||
// Icon={RotateCw}
|
||||
// onClick={onClickSubmit}
|
||||
// {...tooltipPropsForApplyBlock({ tooltipName: 'Reapply' })}
|
||||
// />
|
||||
}
|
||||
|
||||
if (streamState === 'idle-has-changes') {
|
||||
if (isRunning === 'LLM' || isRunning === 'tool') return null
|
||||
|
||||
return <>
|
||||
<IconShell1
|
||||
Icon={X}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { getModelCapabilities, getIsReasoningEnabledState } from '../../../../co
|
|||
import { AlertTriangle, File, Ban, Check, ChevronRight, Dot, FileIcon, Pencil, Undo, Undo2, X, Flag, Copy as CopyIcon, Info, CirclePlus, Ellipsis, CircleEllipsis, Folder, ALargeSmall, TypeOutline, Text } from 'lucide-react';
|
||||
import { ChatMessage, CheckpointEntry, StagingSelectionItem, ToolMessage } from '../../../../common/chatThreadServiceTypes.js';
|
||||
import { approvalTypeOfToolName, LintErrorItem, ToolApprovalType, toolApprovalTypes, ToolCallParams } from '../../../../common/toolsServiceTypes.js';
|
||||
import { CopyButton, EditToolButtonsHTML, IconShell1, JumpToFileButton, JumpToTerminalButton, StatusIndicator, StatusIndicatorForApplyButton, useApplyStreamState, useEditToolStreamState } from '../markdown/ApplyBlockHoverButtons.js';
|
||||
import { CopyButton, EditToolAcceptRejectButtonsHTML, IconShell1, JumpToFileButton, JumpToTerminalButton, StatusIndicator, StatusIndicatorForApplyButton, useApplyStreamState, useEditToolStreamState } from '../markdown/ApplyBlockHoverButtons.js';
|
||||
import { IsRunningType } from '../../../chatThreadService.js';
|
||||
import { acceptAllBg, acceptBorder, buttonFontSize, buttonTextColor, rejectAllBg, rejectBg, rejectBorder } from '../../../../common/helpers/colors.js';
|
||||
import { MAX_FILE_CHARS_PAGE, MAX_TERMINAL_INACTIVE_TIME, ToolName, toolNames } from '../../../../common/prompt/prompts.js';
|
||||
|
|
@ -928,6 +928,7 @@ const EditTool = ({ toolMessage, threadId, messageIdx, content }: Parameters<Res
|
|||
uri={params.uri}
|
||||
codeStr={content}
|
||||
toolName={name}
|
||||
threadId={threadId}
|
||||
/>
|
||||
|
||||
// add children
|
||||
|
|
@ -1676,13 +1677,13 @@ const BottomChildren = ({ children, title }: { children: React.ReactNode, title:
|
|||
}
|
||||
|
||||
|
||||
const EditToolHeaderButtons = ({ applyBoxId, uri, codeStr, toolName }: { applyBoxId: string, uri: URI, codeStr: string, toolName: 'edit_file' | 'rewrite_file' }) => {
|
||||
const EditToolHeaderButtons = ({ applyBoxId, uri, codeStr, toolName, threadId }: { threadId: string, applyBoxId: string, uri: URI, codeStr: string, toolName: 'edit_file' | 'rewrite_file' }) => {
|
||||
const { streamState } = useEditToolStreamState({ applyBoxId, uri })
|
||||
return <div className='flex items-center gap-1'>
|
||||
<StatusIndicatorForApplyButton applyBoxId={applyBoxId} uri={uri} />
|
||||
<JumpToFileButton uri={uri} />
|
||||
{/* <StatusIndicatorForApplyButton applyBoxId={applyBoxId} uri={uri} /> */}
|
||||
{/* <JumpToFileButton uri={uri} /> */}
|
||||
{streamState === 'idle-no-changes' && <CopyButton codeStr={codeStr} toolTipName='Copy' />}
|
||||
<EditToolButtonsHTML type={toolName} codeStr={codeStr} applyBoxId={applyBoxId} uri={uri} />
|
||||
<EditToolAcceptRejectButtonsHTML type={toolName} codeStr={codeStr} applyBoxId={applyBoxId} uri={uri} threadId={threadId} />
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue