use int64 timestamps everywhere (#59)

This commit is contained in:
sashabaranov
2023-01-28 23:18:59 +04:00
committed by GitHub
parent 8dac9408c1
commit 3695eb3ade
6 changed files with 9 additions and 9 deletions

View File

@@ -236,7 +236,7 @@ func handleEditEndpoint(w http.ResponseWriter, r *http.Request) {
// create a response
res := EditsResponse{
Object: "test-object",
Created: uint64(time.Now().Unix()),
Created: time.Now().Unix(),
}
// edit and calculate token usage
editString := "edited by mocked OpenAI server :)"
@@ -275,7 +275,7 @@ func handleCompletionEndpoint(w http.ResponseWriter, r *http.Request) {
res := CompletionResponse{
ID: strconv.Itoa(int(time.Now().Unix())),
Object: "test-object",
Created: uint64(time.Now().Unix()),
Created: time.Now().Unix(),
// would be nice to validate Model during testing, but
// this may not be possible with how much upkeep
// would be required / wouldn't make much sense
@@ -334,7 +334,7 @@ func handleImageEndpoint(w http.ResponseWriter, r *http.Request) {
return
}
res := ImageResponse{
Created: uint64(time.Now().Unix()),
Created: time.Now().Unix(),
}
for i := 0; i < imageReq.N; i++ {
imageData := ImageResponseDataInner{}

View File

@@ -75,7 +75,7 @@ type LogprobResult struct {
type CompletionResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created uint64 `json:"created"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []CompletionChoice `json:"choices"`
Usage Usage `json:"usage"`

View File

@@ -26,7 +26,7 @@ type EditsChoice struct {
// EditsResponse represents a response structure for Edits API.
type EditsResponse struct {
Object string `json:"object"`
Created uint64 `json:"created"`
Created int64 `json:"created"`
Usage Usage `json:"usage"`
Choices []EditsChoice `json:"choices"`
}

View File

@@ -21,7 +21,7 @@ type FileRequest struct {
// File struct represents an OpenAPI file.
type File struct {
Bytes int `json:"bytes"`
CreatedAt int `json:"created_at"`
CreatedAt int64 `json:"created_at"`
ID string `json:"id"`
FileName string `json:"filename"`
Object string `json:"object"`

View File

@@ -30,7 +30,7 @@ type ImageRequest struct {
// ImageResponse represents a response structure for image API.
type ImageResponse struct {
Created uint64 `json:"created,omitempty"`
Created int64 `json:"created,omitempty"`
Data []ImageResponseDataInner `json:"data,omitempty"`
}

View File

@@ -7,7 +7,7 @@ import (
// Model struct represents an OpenAPI model.
type Model struct {
CreatedAt int `json:"created_at"`
CreatedAt int64 `json:"created_at"`
ID string `json:"id"`
Object string `json:"object"`
OwnedBy string `json:"owned_by"`
@@ -18,7 +18,7 @@ type Model struct {
// Permission struct represents an OpenAPI permission.
type Permission struct {
CreatedAt int `json:"created_at"`
CreatedAt int64 `json:"created_at"`
ID string `json:"id"`
Object string `json:"object"`
AllowCreateEngine bool `json:"allow_create_engine"`