Skip to content

Commit 0122019

Browse files
committed
chore(util): replace util package with convert package
- Replace `util` package with `convert` package in gemini.go - Remove `Float32Ptr` and `Int32Ptr` utility functions from util.go Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 4e27d4c commit 0122019

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

provider/gemini/gemini.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77

88
"github.com/appleboy/CodeGPT/core"
9-
"github.com/appleboy/CodeGPT/util"
9+
"github.com/appleboy/com/convert"
1010

1111
"github.com/google/generative-ai-go/genai"
1212
"google.golang.org/api/option"
@@ -106,9 +106,9 @@ func New(ctx context.Context, opts ...Option) (c *Client, err error) {
106106
}
107107

108108
engine.client = client.GenerativeModel(engine.model)
109-
engine.client.MaxOutputTokens = util.Int32Ptr(engine.maxTokens)
110-
engine.client.Temperature = util.Float32Ptr(engine.temperature)
111-
engine.client.TopP = util.Float32Ptr(engine.topP)
109+
engine.client.MaxOutputTokens = convert.ToPtr(engine.maxTokens)
110+
engine.client.Temperature = convert.ToPtr(engine.temperature)
111+
engine.client.TopP = convert.ToPtr(engine.topP)
112112

113113
return engine, nil
114114
}

util/util.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,3 @@ func ConvertToMap(args []string) Data {
3535
}
3636
return m
3737
}
38-
39-
// Float32Ptr takes a float32 value and returns a pointer to that value.
40-
// This can be useful for passing float32 values to functions that require a pointer.
41-
func Float32Ptr(v float32) *float32 {
42-
return &v
43-
}
44-
45-
// Int32Ptr takes an int32 value and returns a pointer to that value.
46-
// This can be useful for passing int32 values to functions that require a pointer.
47-
func Int32Ptr(v int32) *int32 {
48-
return &v
49-
}

0 commit comments

Comments
 (0)