fix(chat): persist attachment content and fix fallback multi-turn context
Persist resolved temporary-attachment content onto the stored user message so later turns can replay it in history. Close the retrieval progress spinner on early pipeline exits, and reshape model-fallback messages with a proper system role plus trailing user question.
This commit is contained in:
@@ -44,6 +44,21 @@ func TestLastConsolidatedRetrievalStage(t *testing.T) {
|
||||
assert.Equal(t, types.FILTER_TOP_K, LastConsolidatedRetrievalStage(pipeline, cm))
|
||||
}
|
||||
|
||||
func TestShouldCloseRetrievalProgress(t *testing.T) {
|
||||
last := types.FILTER_TOP_K
|
||||
|
||||
// Normal completion: only the last retrieval stage closes the window.
|
||||
assert.True(t, ShouldCloseRetrievalProgress(types.FILTER_TOP_K, last, nil))
|
||||
assert.False(t, ShouldCloseRetrievalProgress(types.CHUNK_SEARCH_PARALLEL, last, nil))
|
||||
|
||||
// ErrSearchNothing at an earlier retrieval stage must still close the
|
||||
// window so the frontend stops spinning before the fallback answer streams.
|
||||
assert.True(t, ShouldCloseRetrievalProgress(types.CHUNK_SEARCH_PARALLEL, last, ErrSearchNothing))
|
||||
|
||||
// A hard error at any retrieval stage must also close the window.
|
||||
assert.True(t, ShouldCloseRetrievalProgress(types.CHUNK_RERANK, last, &PluginError{}))
|
||||
}
|
||||
|
||||
func TestShouldEmitQueryUnderstandProgress(t *testing.T) {
|
||||
cm := &types.ChatManage{PipelineRequest: types.PipelineRequest{EnableRewrite: true}}
|
||||
assert.True(t, ShouldEmitQueryUnderstandProgress(cm))
|
||||
|
||||
Reference in New Issue
Block a user