mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
refactor(coderd/x/chatd/chattool): simplify goal ID validation
This commit is contained in:
@@ -80,9 +80,7 @@ func CompleteGoal(db database.Store, options GoalToolOptions) fantasy.AgentTool
|
||||
}
|
||||
goalID, err := uuid.Parse(goalIDStr)
|
||||
if err != nil {
|
||||
return fantasy.NewTextErrorResponse(
|
||||
xerrors.Errorf("invalid goal_id: %w", err).Error(),
|
||||
), nil
|
||||
return fantasy.NewTextErrorResponse("invalid goal_id"), nil
|
||||
}
|
||||
summary := strings.TrimSpace(args.Summary)
|
||||
if summary == "" {
|
||||
|
||||
@@ -89,7 +89,6 @@ func TestCompleteGoalSchemaUsesStringGoalID(t *testing.T) {
|
||||
goalIDParam, ok := info.Parameters["goal_id"].(map[string]any)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, "string", goalIDParam["type"])
|
||||
require.NotEqual(t, "array", goalIDParam["type"])
|
||||
}
|
||||
|
||||
func TestGetGoalReturnsNullWithoutCurrentGoal(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user