[fix] tests

This commit is contained in:
Max 2023-04-26 19:39:15 +08:00
parent 4e37119714
commit 4ee38de7e7

View file

@ -3,6 +3,7 @@ package openai
import ( import (
"testing" "testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/yaoapp/yao/config" "github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/connector" "github.com/yaoapp/yao/connector"
@ -94,13 +95,13 @@ func TestEdits(t *testing.T) {
defer test.Clean() defer test.Clean()
openai := prepare(t, "text-davinci-edit-001") openai := prepare(t, "text-davinci-edit-001")
data, err := openai.Edits("Fix the spelling mistakes", nil) data, err := openai.Edits("Hello world"+uuid.NewString(), nil)
if err != nil { if err != nil {
t.Fatal(err.Message) t.Fatal(err.Message)
} }
assert.NotNil(t, data.(map[string]interface{})["created"]) assert.NotNil(t, data.(map[string]interface{})["created"])
data, err = openai.Edits("Fix the spelling mistakes 2nd", map[string]interface{}{"input": "What day of the wek is it?"}) data, err = openai.Edits("Fix the spelling mistakes 2nd"+uuid.NewString(), map[string]interface{}{"input": "What day of the wek is it?"})
if err != nil { if err != nil {
t.Fatal(err.Message) t.Fatal(err.Message)
} }