mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-16 23:43:03 +00:00
fix: steer models to replace_range in the replace_note_content tool description (#30048)
Asked to add a section or change a few lines, models answer with a whole-note replace_note_content call and the rest of the note is gone, with nothing to undo because the editor only records versions on chat inserts. The tool already supports replace_range operations with an expected guard, but its description never said when to use them or how the offsets work, so models defaulted to sending the whole note back. The docstring, which is the description every model receives for this tool in note chats and normal chats alike, now states the preference for range edits and the offset, overlap and expected rules the handler enforces. Verified the text lands in the generated tool spec unchanged and that range edits, the expected mismatch rejection and whole-note replace behave as described against a sqlite data dir.
This commit is contained in:
parent
06d9d2e7c7
commit
3d6598fccb
1 changed files with 8 additions and 0 deletions
|
|
@ -1342,6 +1342,14 @@ async def replace_note_content(
|
|||
"""
|
||||
Update an existing note by replacing the whole markdown content or applying range operations.
|
||||
|
||||
Prefer "replace_range" when only part of the note changes.
|
||||
A "replace" operation must be the only operation in the request.
|
||||
start and end are 0-indexed character offsets into the markdown content from view_note.
|
||||
end is exclusive.
|
||||
Offsets never shift as operations are applied.
|
||||
Ranges must not overlap.
|
||||
expected is optional. When set, the request is rejected if the range's current text does not match it.
|
||||
|
||||
:param note_id: The ID of the note to update
|
||||
:param content: The new markdown content for a whole-note update
|
||||
:param operations: Optional note operations:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue