Skip to content

Commit f8cbdd5

Browse files
committed
PR feedback
Signed-off-by: Grant Linville <[email protected]>
1 parent feb0510 commit f8cbdd5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pkg/credentials/credential.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import (
88
"github.com/docker/cli/cli/config/types"
99
)
1010

11+
const ctxSeparator = "///"
12+
1113
type CredentialType string
1214

1315
const (
1416
CredentialTypeTool CredentialType = "tool"
15-
CredentialTypeModelProvider CredentialType = "modelprovider"
17+
CredentialTypeModelProvider CredentialType = "modelProvider"
1618
)
1719

1820
type Credential struct {
@@ -50,7 +52,7 @@ func credentialFromDockerAuthConfig(authCfg types.AuthConfig) (Credential, error
5052

5153
// If it's a tool credential or sys.openai, remove the http[s] prefix.
5254
address := authCfg.ServerAddress
53-
if credType == string(CredentialTypeTool) || strings.HasPrefix(address, "https://sys.openai///") {
55+
if credType == string(CredentialTypeTool) || strings.HasPrefix(address, "https://sys.openai"+ctxSeparator) {
5456
address = strings.TrimPrefix(strings.TrimPrefix(address, "https://"), "http://")
5557
}
5658

@@ -68,13 +70,13 @@ func credentialFromDockerAuthConfig(authCfg types.AuthConfig) (Credential, error
6870
}
6971

7072
func toolNameWithCtx(toolName, credCtx string) string {
71-
return toolName + "///" + credCtx
73+
return toolName + ctxSeparator + credCtx
7274
}
7375

7476
func toolNameAndCtxFromAddress(address string) (string, string, error) {
75-
parts := strings.Split(address, "///")
77+
parts := strings.Split(address, ctxSeparator)
7678
if len(parts) != 2 {
77-
return "", "", fmt.Errorf("error parsing tool name and context %q. Tool names cannot contain '///'", address)
79+
return "", "", fmt.Errorf("error parsing tool name and context %q. Tool names cannot contain '%s'", address, ctxSeparator)
7880
}
7981
return parts[0], parts[1], nil
8082
}

0 commit comments

Comments
 (0)