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:
Meleki committed 2026-03-04 11:59:19 +01:00
1 parent d88b046575
commit 07ea0fcafb
3 files changed
+29 -26

No files matched your search

+8 -2
View File
@@ -88,6 +88,11 @@
word-break: break-word;
}
.msg hint {
opacity: var(--semi-transparent);
font-size: var(--font-size);
}
.msg:not(.markdown) {
white-space: pre-wrap;
}
@@ -610,8 +615,9 @@
.file-ref-chip {
display: inline-flex;
align-items: center;
gap: .3em;
padding: .15em .5em;
gap: var(--badge-spacing);
margin: 0 2px 3px 0;
padding: var(--badge-padding);
background: var(--f2-bg);
border: var(--border-width) solid var(--f2-border);
border-radius: var(--border-radius);
+18 -8
View File
@@ -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>