Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Fail the Save on an Empty Completion, Not a Green Toast

说明与用途

问题:空的 LLM 完成被视为成功保存,导致误导性的绿色提示。解决方案:验证完成文本,拒绝空/截断结果,返回‘failed’状态及原因,并在 UI 中显示该原因。

问题

An empty completion from an LLM provider is treated as a successful save, leading to a green toast in the UI even though no text was stored.

结果

Implemented a contract that treats empty completions as failures, preventing misleading success indicators and ensuring data integrity.

工作流

  • Receive save request from UI
  • Call LLM provider for completion
  • Check completion text and finish_reason
  • If empty or truncated, mark invoice as failed and return status 'failed' with reason
  • If valid, persist notes and return status 'saved'
  • UI reads JSON status and shows draft or success accordingly

证据

An empty completion is a failed user action, even when the free server stayed up and the model call did not throw.

来源

The UI may render a spinner, the API may speak JSON, and the provider may speak a schema you do not own.

来源

I keep the draft visible and show the reason beside the notes field, so the clicker can see that nothing was stored.

来源

  • 记录日期: 2026-10-09T12:41:04.112Z