Skip to content

Commit

Permalink
refactor: use enum and remove useless structures
Browse files Browse the repository at this point in the history
  • Loading branch information
northes committed Sep 4, 2024
1 parent 185b412 commit 38b725c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions api_chat_completions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,6 @@ func TestUseTools(t *testing.T) {
// IP地址`15.202.141.157`的定位结果显示,该IP地址位于美国华盛顿州,属于Amazon.com。具体的城市信息没有提供,但经纬度坐标为(-95.71289, 37.090245)。这些信息来源于高德地图,最后更新时间为2024年6月6日。
}

type IPLocateInfo struct {
IP string `json:"ip"`
Country string `json:"country"`
Province string `json:"province"`
City string `json:"city"`
District string `json:"district"`
ISP string `json:"isp"`
Location string `json:"location"`
Source string `json:"source"`
CacheTime string `json:"cache_time"`
}
type IPLocateInfoResponse struct {
Data *IPLocateInfo `json:"data"`
}

func IPLocate(ip string) (string, error) {
response, err := httpx.NewClient(fmt.Sprintf("https://apihut.co/ip/%s", ip)).Get(context.Background())
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api_context_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestContextCache(t *testing.T) {
// Create
var createResponse *moonshot.ContextCacheCreateResponse
createResponse, err = cli.ContextCache().Create(ctx, &moonshot.ContextCacheCreateRequest{
Model: "moonshot-v1",
Model: moonshot.ModelFamilyMoonshotV1,
Messages: []moonshot.ChatCompletionsMessage{
{
Role: moonshot.RoleSystem,
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestContextCache_Create(t *testing.T) {
ctx := context.Background()

response, err := cli.ContextCache().Create(ctx, &moonshot.ContextCacheCreateRequest{
Model: "moonshot-v1",
Model: moonshot.ModelFamilyMoonshotV1,
Messages: []moonshot.ChatCompletionsMessage{
{
Role: moonshot.RoleSystem,
Expand Down

0 comments on commit 38b725c

Please sign in to comment.