chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,40 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"academy/internal/config"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
type proseReplyChat struct{}
|
||||
|
||||
func (proseReplyChat) Chat(context.Context, []chat.Message, *chat.ChatOptions) (*types.ChatResponse, error) {
|
||||
return &types.ChatResponse{Content: "抱歉,这段文本没有可抽取的实体和关系。", FinishReason: "stop"}, nil
|
||||
}
|
||||
|
||||
func (proseReplyChat) ChatStream(
|
||||
context.Context, []chat.Message, *chat.ChatOptions,
|
||||
) (<-chan types.StreamResponse, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
func (proseReplyChat) GetModelName() string { return "prose" }
|
||||
func (proseReplyChat) GetModelID() string { return "prose" }
|
||||
|
||||
// The graph-settings "try extract" button must report a prose refusal as a
|
||||
// failure. Returning an empty graph would make the UI clear the user's
|
||||
// few-shot nodes/relations and show "success" (#3606 review).
|
||||
func TestExtractRelationsFromTextReportsModelRefusal(t *testing.T) {
|
||||
h := &InitializationHandler{config: &config.Config{
|
||||
ExtractManager: &config.ExtractManagerConfig{
|
||||
ExtractGraph: &types.PromptTemplateStructured{Description: "extract"},
|
||||
},
|
||||
}}
|
||||
res, err := h.extractRelationsFromText(context.Background(), "目录", nil, proseReplyChat{})
|
||||
if err == nil {
|
||||
t.Fatalf("expected an error for a prose refusal, got %+v", res)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user