This commit is contained in:
seb
2026-10-16 16:36:43 +02:00
parent 99d95ee234
commit 7a4d452109
11 changed files with 13 additions and 498 deletions

View File

@@ -39,15 +39,12 @@ import CycloneRoundedIcon from '@mui/icons-material/CycloneRounded';
import { setting as settingApi } from '../../api';
import chatAutomat, {
selectPendingAskUser,
selectPendingDraftRead,
} from '../../automats/chatAutomat';
import { getActiveDraftContent } from '../../automats/draftSync';
import userSettingsAutomat from '../../automats/userSettingsAutomat';
import vfsAutomat from '../../automats/vfsAutomat';
import { VfsEditorPanel, VfsFileIcon } from '../vfs';
import ChatFlowList from './ChatFlowList';
import AskUserPrompt from './AskUserPrompt';
import DraftRequestPrompt from './DraftRequestPrompt';
import { ACCEPT_STRING, readFileAttachment } from './chatAttachments';
import { ChatStagedAttachmentsTray } from './ChatAttachmentItems';
import {
@@ -57,7 +54,7 @@ import {
} from '../../colors';
const DEFAULT_DRAWER_WIDTH = 460;
const EXTRACTION_MODEL_INSTRUCTION = "use 'Process Incoming Product and Invoices' SKILL to fill drafts/delivery vfs file";
const EXTRACTION_MODEL_INSTRUCTION = "use 'Process Incoming Product and Invoices' SKILL";
/** Sort by updated_at desc; subagents (started_by set) directly below their parent. */
function sortConversations(list) {
@@ -103,7 +100,7 @@ function conversationTitle(c) {
.replace(/\[EXTRACTION(?:\s+label="[^"]*")?\][\s\S]*?\[\/EXTRACTION\]/gi, '')
.replace(/<extraction(?:\s+label="[^"]*")?>[\s\S]*?<\/extraction>/gi, '')
.replace(/```[\s\S]*?```/g, '')
.replace(/use 'Process Incoming Product and Invoices' SKILL to fill drafts\/delivery vfs file/gi, '')
.replace(/use 'Process Incoming Product and Invoices' SKILL.*/gi, '')
.replace(/<USERENV>[\s\S]*?<\/USERENV>/gi, '')
.replace(/\s+/g, ' ')
.trim();
@@ -841,33 +838,7 @@ export default class ChatDrawer extends PureComponent {
};
getPendingAskUser = () => selectPendingAskUser(this.state);
getPendingDraftRead = () => selectPendingDraftRead(this.state);
handleProvideDraft = async ({ toolCallId, draftKey, empty = false }) => {
try {
let content;
if (empty) {
content = { error: 'Draft not open or empty' };
} else {
const manifest = getActiveDraftContent(draftKey);
content = {
manifest: manifest || {
kind: draftKey,
mode: 'create',
lines: [],
},
};
}
await chatAutomat.actions.sendToolResponse({
tool_call_id: toolCallId,
name: 'read_file',
content,
});
} catch (err) {
console.error('[ChatDrawer] Failed to provide draft response:', err);
}
};
renderHeader() {
const {
@@ -1364,7 +1335,6 @@ export default class ChatDrawer extends PureComponent {
}
const pendingAsk = this.getPendingAskUser();
const pendingDraftRead = this.getPendingDraftRead();
return (
<Box sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' }}>
@@ -1399,14 +1369,6 @@ export default class ChatDrawer extends PureComponent {
disabled={this.state.isSending}
/>
)}
{pendingDraftRead && (
<DraftRequestPrompt
draftData={pendingDraftRead}
onProvideDraft={this.handleProvideDraft}
disabled={this.state.isSending}
/>
)}
</Box>
);
}
@@ -1429,13 +1391,11 @@ export default class ChatDrawer extends PureComponent {
} = this.state;
const pendingAsk = this.getPendingAskUser();
const pendingDraftRead = this.getPendingDraftRead();
const isBusy = conversationState === 'busy';
const isWorking = isBusy || isSending;
const canChat =
(Boolean(selectedConversationId) || draftConversation) &&
!pendingAsk &&
!pendingDraftRead;
!pendingAsk;
const canSend =
!isWorking &&
canChat &&