Refactor AI Agent and AI Config handling across multiple files
- Updated function signatures to accept AI Agent and AI Config as non-pointer types for better clarity and safety. - Modified instances where AI Agent and AI Config were dereferenced to improve code readability. - Removed unnecessary nil checks for AI Agent and AI Config, simplifying the logic. - Adjusted related tests and services to align with the new function signatures. - Cleaned up code in runtime, skills, and executor packages to ensure consistency in handling AI configurations.
This commit is contained in:
@@ -11,16 +11,16 @@ import (
|
||||
func TestBuildRunLogMatchedPlan(t *testing.T) {
|
||||
log := BuildRunLog(
|
||||
RuntimeContext{
|
||||
AIAgent: &models.AIAgent{ID: 22},
|
||||
AIConfig: &models.AIConfig{ID: 33},
|
||||
AIAgent: models.AIAgent{ID: 22},
|
||||
AIConfig: models.AIConfig{ID: 33},
|
||||
ConversationID: 11,
|
||||
ManualSkillCode: "manual_refund",
|
||||
IntentCode: "refund",
|
||||
UserMessage: "我要退款",
|
||||
},
|
||||
&ExecutionPlan{
|
||||
AIAgent: &models.AIAgent{ID: 22},
|
||||
AIConfig: &models.AIConfig{
|
||||
AIAgent: models.AIAgent{ID: 22},
|
||||
AIConfig: models.AIConfig{
|
||||
ID: 33,
|
||||
ModelName: "gpt-test",
|
||||
Provider: enums.AIProviderOpenAI,
|
||||
@@ -55,7 +55,7 @@ func TestBuildRunLogMatchedPlan(t *testing.T) {
|
||||
func TestBuildRunLogNotMatchedAndError(t *testing.T) {
|
||||
log := BuildRunLog(
|
||||
RuntimeContext{
|
||||
AIAgent: &models.AIAgent{ID: 22},
|
||||
AIAgent: models.AIAgent{ID: 22},
|
||||
UserMessage: "随便问问",
|
||||
},
|
||||
nil,
|
||||
@@ -74,7 +74,7 @@ func TestBuildRunLogNotMatchedAndError(t *testing.T) {
|
||||
}
|
||||
|
||||
noMatchLog := BuildRunLog(
|
||||
RuntimeContext{AIAgent: &models.AIAgent{ID: 22}, UserMessage: "随便问问"},
|
||||
RuntimeContext{AIAgent: models.AIAgent{ID: 22}, UserMessage: "随便问问"},
|
||||
&ExecutionPlan{MatchReason: ""},
|
||||
&ExecutionTrace{Status: "not_matched"},
|
||||
nil,
|
||||
|
||||
Reference in New Issue
Block a user