diff --git a/docker/Dockerfile b/docker/Dockerfile index e15b4547..b23a44db 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,4 +41,4 @@ EXPOSE 8000 #ENV MYSQL_DB "" ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["bash", "-c", "/opt/Yearning install && /opt/Yearning run"] +CMD ["bash", "-c", "/opt/Yearning run"] diff --git a/src/handler/fetch/ai.go b/src/handler/fetch/ai.go index 8fffda47..9735d908 100644 --- a/src/handler/fetch/ai.go +++ b/src/handler/fetch/ai.go @@ -36,7 +36,8 @@ func NewAIAgent() (*AIAssistant, error) { FrequencyPenalty: model.GloAI.FrequencyPenalty, TopP: model.GloAI.TopP, } - config := openai.DefaultAzureConfig(model.GloAI.APIKey, model.GloAI.BaseUrl) + config := openai.DefaultConfig(model.GloAI.APIKey) + config.BaseURL = model.GloAI.BaseUrl if model.GloAI.ProxyURL != "" { proxyUrl, err := url.Parse(model.GloAI.ProxyURL) if err != nil { diff --git a/src/handler/fetch/chat.go b/src/handler/fetch/chat.go index c4292eaf..3b72f13e 100644 --- a/src/handler/fetch/chat.go +++ b/src/handler/fetch/chat.go @@ -35,7 +35,7 @@ func AiChat(c yee.Context) error { } stream, err := cc.Messages(chat).StreamChatCompletion() if err != nil { - fmt.Printf("ChatCompletionStream error: %v\n", err) + c.Logger().Criticalf("ChatCompletionStream error: %v\n", err) return nil } defer stream.Close() @@ -52,7 +52,7 @@ func AiChat(c yee.Context) error { return nil } - fmt.Fprintln(c.Response(), response.Choices[0].Delta.Content) + fmt.Fprintf(c.Response(), "data:%s", response.Choices[0].Delta.Content) c.Response().Flush() } } diff --git a/src/handler/personal/impl.go b/src/handler/personal/impl.go index e7b983eb..f3426feb 100644 --- a/src/handler/personal/impl.go +++ b/src/handler/personal/impl.go @@ -9,6 +9,7 @@ import ( "errors" "fmt" "github.com/cookieY/sqlx" + "strconv" "strings" ) @@ -109,6 +110,13 @@ func (m *MultiSQLRunner) Run(db *sqlx.DB, schema string) (*Query, error) { results[key] = i18n.DefaultLang.Load(i18n.INFO_SENSITIVE_FIELD) } } + case int64: + if m.excludeFieldContext(key) { + results[key] = i18n.DefaultLang.Load(i18n.INFO_SENSITIVE_FIELD) + } else { + results[key] = strconv.FormatInt(r, 10) + } + } } query.Data = append(query.Data, results) diff --git a/src/lib/var.go b/src/lib/var.go index 70f7a7b2..b0d45a53 100644 --- a/src/lib/var.go +++ b/src/lib/var.go @@ -1,3 +1,3 @@ package lib -const Version = "3.1.8.1 Uranus" +const Version = "3.1.9 Uranus" diff --git a/src/service/migrate.go b/src/service/migrate.go index e4861504..21c98c56 100644 --- a/src/service/migrate.go +++ b/src/service/migrate.go @@ -262,14 +262,14 @@ func Migrate() { QuerySource: []string{}, } ai := model.AI{ - BaseUrl: "https://api.openai.com", + BaseUrl: "https://api.openai.com/v1", APIKey: "", FrequencyPenalty: 0.0, MaxTokens: 2500, PresencePenalty: 0.0, Temperature: 0.0, TopP: 0.0, - Model: "gpt-3-turbo", + Model: "gpt-3.5-turbo", AdvisorPrompt: SQLPrompt, SQLGenPrompt: SQLGenPrompt, SQLAgentPrompt: SQLAgentPrompt,