Zeilenreferenz-Hinweis (cat -n) aus System-Prompt entfernt und automatisch an User-Nachricht angehängt
- System-Prompt: 3x cat-n Hinweise entfernt (Workspace-Block, toolAny-Erinnerung, Workspace-Erinnerung) - chat.js: <hint> Tag mit cat-n Hinweis wird automatisch angehängt wenn Datei-Refs Zeilennummern haben - chat.js: Einzelne Zeilen (path:11) werden jetzt korrekt geparst und angezeigt - chat.css: hint Tag Styling, file-ref-chip Spacing angepasst
This commit is contained in:
1 parent
d88b046575
commit
07ea0fcafb
3 files changed
+29
-26
No files matched your search
+18
-8
@@ -85,11 +85,18 @@ async function sendMessage() {
|
||||
|
||||
// Refs in den Text einbauen
|
||||
if (pendingRefs.length > 0) {
|
||||
const refTags = pendingRefs.map(r => {
|
||||
if (r.from && r.to) return `[Datei: ${r.path}:${r.from}-${r.to}]`;
|
||||
const refLines = pendingRefs.map(r => {
|
||||
if (r.from && r.to && r.from !== r.to) return `[Datei: ${r.path}:${r.from}-${r.to}]`;
|
||||
if (r.from) return `[Datei: ${r.path}:${r.from}]`;
|
||||
return `[Datei: ${r.path}]`;
|
||||
});
|
||||
msgText = refTags.join('\n') + (msgText ? '\n' + msgText : '');
|
||||
msgText = refLines.join(' ') + '\n' + msgText;
|
||||
if (pendingRefs.some(r => r.from)) {
|
||||
if (pendingRefs.length > 1)
|
||||
msgText += `\n<hint>Lies referenzierte Dateien mit \`cat -n\`.</hint>`;
|
||||
else
|
||||
msgText += `\n<hint>Lies die referenzierte Datei mit \`cat -n\`.</hint>`;
|
||||
}
|
||||
clearPendingRefs();
|
||||
}
|
||||
|
||||
@@ -330,10 +337,13 @@ function removePendingFile(index) {
|
||||
// ── Workspace Refs ──
|
||||
|
||||
function addPendingRef(ref) {
|
||||
// ref = "path" oder "path:from-to"
|
||||
const match = ref.match(/^(.+?):(\d+)-(\d+)$/);
|
||||
if (match) {
|
||||
pendingRefs.push({ path: match[1], from: parseInt(match[2]), to: parseInt(match[3]) });
|
||||
// ref = "path", "path:line" oder "path:from-to"
|
||||
const rangeMatch = ref.match(/^(.+?):(\d+)-(\d+)$/);
|
||||
const lineMatch = !rangeMatch && ref.match(/^(.+?):(\d+)$/);
|
||||
if (rangeMatch) {
|
||||
pendingRefs.push({ path: rangeMatch[1], from: parseInt(rangeMatch[2]), to: parseInt(rangeMatch[3]) });
|
||||
} else if (lineMatch) {
|
||||
pendingRefs.push({ path: lineMatch[1], from: parseInt(lineMatch[2]), to: parseInt(lineMatch[2]) });
|
||||
} else {
|
||||
pendingRefs.push({ path: ref, from: null, to: null });
|
||||
}
|
||||
@@ -361,7 +371,7 @@ function renderRefPreview() {
|
||||
}
|
||||
|
||||
container.innerHTML = pendingRefs.map((r, i) => {
|
||||
const label = r.from && r.to ? `${r.path}:${r.from}-${r.to}` : r.path;
|
||||
const label = r.from && r.to && r.from !== r.to ? `${r.path}:${r.from}-${r.to}` : r.from ? `${r.path}:${r.from}` : r.path;
|
||||
return `<div class="ref-preview-item">
|
||||
<span class="ref-icon"><i class="fa fa-folder-open"></i></span>
|
||||
<span class="ref-label">${esc(label)}</span>
|
||||
|
||||
Reference in new issue
Block a user