u
This commit is contained in:
@@ -88,8 +88,36 @@ function formatUpdated(value) {
|
||||
}
|
||||
|
||||
function conversationTitle(c) {
|
||||
const msg = (c.first_message || '').replace(/\s+/g, ' ').trim();
|
||||
return msg || '…';
|
||||
let msg = (c.first_message || '').trim();
|
||||
if (!msg) return '…';
|
||||
|
||||
const extMatch = msg.match(/\[EXTRACTION(?:\s+label="([^"]*)")?\]|<extraction(?:\s+label="([^"]*)")?>/i);
|
||||
const hasInvoiceSkill = msg.includes("Process Incoming Product and Invoices");
|
||||
|
||||
let stripped = msg
|
||||
.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(/<USERENV>[\s\S]*?<\/USERENV>/gi, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
if (extMatch || hasInvoiceSkill) {
|
||||
const label = extMatch?.[1] || extMatch?.[2] || 'parsed invoice';
|
||||
if (stripped) {
|
||||
return `${label}: ${stripped}`;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
let clean = msg
|
||||
.replace(/<USERENV>[\s\S]*?<\/USERENV>/gi, '')
|
||||
.replace(/```[\s\S]*?```/g, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
return clean || msg.slice(0, 40) || '…';
|
||||
}
|
||||
const MIN_DRAWER_WIDTH = 320;
|
||||
|
||||
@@ -566,14 +594,17 @@ export default class ChatDrawer extends PureComponent {
|
||||
const instructionText =
|
||||
uniqueInstructions.join('\n\n') || EXTRACTION_MODEL_INSTRUCTION;
|
||||
|
||||
const extMarkdown = extractions
|
||||
.map((ext) => `\`\`\`\n${ext.text.trim()}\n\`\`\``)
|
||||
const extBlocks = extractions
|
||||
.map(
|
||||
(ext) =>
|
||||
`[EXTRACTION label="${ext.label || 'parsed invoice'}"]\n\`\`\`\n${ext.text.trim()}\n\`\`\`\n[/EXTRACTION]`
|
||||
)
|
||||
.join('\n\n');
|
||||
|
||||
if (text) {
|
||||
text = `${instructionText}\n\n${text}\n\n${extMarkdown}`;
|
||||
text = `${instructionText}\n\n${text}\n\n${extBlocks}`;
|
||||
} else {
|
||||
text = `${instructionText}\n\n${extMarkdown}`;
|
||||
text = `${instructionText}\n\n${extBlocks}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1978,6 +2009,9 @@ export default class ChatDrawer extends PureComponent {
|
||||
onClose={this.handleCloseExtractionPreview}
|
||||
maxWidth="md"
|
||||
fullWidth
|
||||
sx={(theme) => ({
|
||||
zIndex: theme.zIndex.modal + 50,
|
||||
})}
|
||||
slotProps={{
|
||||
paper: {
|
||||
sx: {
|
||||
|
||||
Reference in New Issue
Block a user