@@ -8,11 +8,13 @@ import (
8
8
"github.com/docker/cli/cli/config/types"
9
9
)
10
10
11
+ const ctxSeparator = "///"
12
+
11
13
type CredentialType string
12
14
13
15
const (
14
16
CredentialTypeTool CredentialType = "tool"
15
- CredentialTypeModelProvider CredentialType = "modelprovider "
17
+ CredentialTypeModelProvider CredentialType = "modelProvider "
16
18
)
17
19
18
20
type Credential struct {
@@ -50,7 +52,7 @@ func credentialFromDockerAuthConfig(authCfg types.AuthConfig) (Credential, error
50
52
51
53
// If it's a tool credential or sys.openai, remove the http[s] prefix.
52
54
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 ) {
54
56
address = strings .TrimPrefix (strings .TrimPrefix (address , "https://" ), "http://" )
55
57
}
56
58
@@ -68,13 +70,13 @@ func credentialFromDockerAuthConfig(authCfg types.AuthConfig) (Credential, error
68
70
}
69
71
70
72
func toolNameWithCtx (toolName , credCtx string ) string {
71
- return toolName + "///" + credCtx
73
+ return toolName + ctxSeparator + credCtx
72
74
}
73
75
74
76
func toolNameAndCtxFromAddress (address string ) (string , string , error ) {
75
- parts := strings .Split (address , "///" )
77
+ parts := strings .Split (address , ctxSeparator )
76
78
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 )
78
80
}
79
81
return parts [0 ], parts [1 ], nil
80
82
}
0 commit comments