feat(dingtalk): enable secure multimodal image QA
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
)
|
||||
|
||||
func TestStreamLLMToEventBusRejectsPartialContentAfterStreamError(t *testing.T) {
|
||||
model := &mockChat{responses: []mockResponse{{chunks: []types.StreamResponse{
|
||||
{ResponseType: types.ResponseTypeAnswer, Content: "unverified partial"},
|
||||
{ResponseType: types.ResponseTypeError, Content: "provider failed", Done: true},
|
||||
{ResponseType: types.ResponseTypeAnswer, Content: "must be ignored", Done: true},
|
||||
}}}}
|
||||
engine := &AgentEngine{config: &types.AgentConfig{}, chatModel: model}
|
||||
|
||||
result, err := engine.streamLLMToEventBus(context.Background(), []chat.Message{{Role: "user", Content: "inspect image"}}, nil, nil)
|
||||
if err == nil {
|
||||
t.Fatal("expected stream error after partial content")
|
||||
}
|
||||
if result == nil || result.Content != "unverified partial" {
|
||||
t.Fatalf("result = %#v; caller needs partial content identified for replacement", result)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user