refactor(agent): simplify grep_chunks tool to a single regex query

The grep_chunks tool previously accepted an array of regex queries (1-5)
and an optional knowledge_base_ids filter and limit. In practice the LLM
either fired multiple near-duplicate calls or split synonyms across
entries instead of using POSIX alternation, and KB scoping plus result
limit are server-side concerns the model should not control.

Reshape the contract to match `grep -E -i` semantics:

- Schema accepts a single required `query` string. Combine concepts with
  `|` alternation in one regex instead of multiple calls.
- Drop `knowledge_base_ids` and `limit` from the schema; the tool now
  always searches the full agent scope and uses a fixed internal cap.
- Legacy `pattern`, `queries`, `patterns`, `max_results` keys are still
  accepted and joined into a single alternation regex so older callers
  and in-flight model outputs keep working.
- Update the agent system prompt template to document the new single
  `query` field.
- Frontend tool title now reads `query`/`queries`/`pattern`/`patterns`
  in that order so the search text is shown again under the new schema.
- Add a dedicated `grepSearch` / `grepSearchFailed` tool status (zh-CN,
  en-US, ko-KR, ru-RU) and rename the zh-CN tool label to "搜索关键词"
  so the UI no longer prefixes the call with a generic "调用 ..." label.
This commit is contained in:
wizardchen
2026-05-20 19:32:37 +08:00
committed by lyingbug
parent 31f560ecf1
commit f3c7281f47
7 changed files with 69 additions and 99 deletions
+2
View File
@@ -3952,6 +3952,8 @@ export default {
searchKbFailed: '지식베이스 검색 실패',
webSearch: '웹 검색',
webSearchFailed: '웹 검색 실패',
grepSearch: '키워드 검색',
grepSearchFailed: '키워드 검색 실패',
getDocInfo: '문서 정보 조회',
getDocInfoFailed: '문서 정보 조회 실패',
thinkingDone: '사고 완료',