fix(frontend): 修复 read_file 搜索结果显示"行??"的问题
后端 search_text 返回 line_start/line_end,前端错误地读取了不存在的 line_number 字段。 改为正确读取 line_start 和 line_end,且当上下文窗口合并时显示完整行范围。
This commit is contained in:
parent
76e4c5144e
commit
04128fac14
@ -527,7 +527,8 @@ function renderReadFile(result: any, args: any): string {
|
||||
matches.forEach((match: any, idx: number) => {
|
||||
if (idx > 0) html += '<div class="search-match-separator">⋯</div>';
|
||||
html += '<div class="search-match-item">';
|
||||
html += `<div class="search-match-line">行 ${match.line_number || '?'}</div>`;
|
||||
const lineLabel = match.line_start === match.line_end ? `${match.line_start}` : `${match.line_start}-${match.line_end}`;
|
||||
html += `<div class="search-match-line">行 ${lineLabel}</div>`;
|
||||
html += `<pre>${escapeHtml(match.snippet || match.content || '')}</pre>`;
|
||||
html += '</div>';
|
||||
});
|
||||
|
||||
@ -479,7 +479,8 @@ function renderReadFile(result: any, args: any): string {
|
||||
matches.forEach((match: any, idx: number) => {
|
||||
if (idx > 0) html += '<div class="search-match-separator">⋯</div>';
|
||||
html += '<div class="search-match-item">';
|
||||
html += `<div class="search-match-line">行 ${match.line_number || '?'}</div>`;
|
||||
const lineLabel = match.line_start === match.line_end ? `${match.line_start}` : `${match.line_start}-${match.line_end}`;
|
||||
html += `<div class="search-match-line">行 ${lineLabel}</div>`;
|
||||
html += `<pre>${escapeHtml(match.snippet || match.content || '')}</pre>`;
|
||||
html += '</div>';
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user