refactor: 重构llm包
This commit is contained in:
@@ -30,10 +30,10 @@ func TestNewClient(t *testing.T) {
|
||||
log.Printf("[INFO] client instance is non-nil, validation passed")
|
||||
|
||||
// 验证 llm 实例被成功创建(不调用,只检查非 nil)
|
||||
if client.llm == nil {
|
||||
t.Error("client.llm is nil, expected a non-nil llms.Model")
|
||||
if client.model == nil {
|
||||
t.Error("client.model is nil, expected a non-nil llms.Model")
|
||||
} else {
|
||||
log.Printf("[INFO] client.llm is non-nil, llms.Model created successfully")
|
||||
log.Printf("[INFO] client.model is non-nil, llms.Model created successfully")
|
||||
}
|
||||
|
||||
log.Printf("[INFO] TestNewClient completed successfully")
|
||||
@@ -69,7 +69,7 @@ func TestClient_Chat(t *testing.T) {
|
||||
// 3. 调用被测方法
|
||||
log.Printf("[INFO] calling client.Chat()...")
|
||||
got, err := client.Chat(context.Background(), messages)
|
||||
|
||||
|
||||
// 4. 校验结果
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Chat() returned error: %v", err)
|
||||
@@ -125,7 +125,7 @@ func TestClient_ChatWithSystemPrompt(t *testing.T) {
|
||||
// 4. 调用被测方法
|
||||
log.Printf("[INFO] calling client.ChatWithSystemPrompt()...")
|
||||
got, err := client.ChatWithSystemPrompt(context.Background(), systemPrompt, messages)
|
||||
|
||||
|
||||
// 5. 校验结果
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] ChatWithSystemPrompt() returned error: %v", err)
|
||||
@@ -147,4 +147,4 @@ func TestClient_ChatWithSystemPrompt(t *testing.T) {
|
||||
}
|
||||
|
||||
log.Printf("[INFO] TestClient_ChatWithSystemPrompt completed successfully")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user