]> git.giacomolli.uk - onechat/blobdiff - model.go
Name the test files that hold only shared helpers
[onechat] / model.go
index bd1258b80d586aeece9bd174e8cc1baaf2e65ba6..04b15563304af5720269f7a72272a41382952c95 100644 (file)
--- a/model.go
+++ b/model.go
@@ -45,7 +45,7 @@ var errModelCallLimit = errors.New("call limit reached")
 // OPENAI_API_KEY, and there is no fallback from one to the other. All clients
 // share the authorizer, so one refresh runs at a time.
 func modelEndpoint(config Config, dir string) (string, ModelAuthorizer, error) {
-       if config.Endpoint == endpointAPI {
+       if config.Endpoint == configEndpointAPI {
                key := os.Getenv("OPENAI_API_KEY")
                if key == "" {
                        return "", nil, errors.New("endpoint api needs OPENAI_API_KEY")
@@ -54,7 +54,7 @@ func modelEndpoint(config Config, dir string) (string, ModelAuthorizer, error) {
                return modelAPIURL, ModelAPIKey(key), nil
        }
 
-       return modelChatGPTURL, newChatGPTAuth(filepath.Join(dir, tokenFileName), authIssuer), nil
+       return modelChatGPTURL, newChatGPTAuth(filepath.Join(dir, chatgptTokenFileName), chatgptIssuer), nil
 }
 
 // newModelClient returns a client for the Responses endpoint at url. It records
@@ -202,7 +202,7 @@ func (c *ModelClient) Create(ctx context.Context, request ModelRequest) (ModelRe
                return ModelResponse{}, fmt.Errorf("authorize model call: %w", err)
        }
 
-       _, chatgpt := c.auth.(*chatgptAuth)
+       _, chatgpt := c.auth.(*ChatGPTAuth)
        if chatgpt {
                httpRequest.Header.Set("session_id", c.cacheKey)
        }
@@ -310,7 +310,7 @@ type ModelRequest struct {
        Instructions string
        Tools        []ModelTool
        Input        []any
-       Node         *nodeKey
+       Node         *NodeKey
        Turn         string
 }