Skip to content

Commit

Permalink
1. 优化AI助手流式消息回复格式
Browse files Browse the repository at this point in the history
2. 修复创建数据源时列表不刷新的问题
3. 修复bigint类型数据精度丢失的问题 #1104
4. 修复不支持ssl连接执行SQL的问题 #1120
5. 新增**DMLWhereExprValueIsNull** 审核参数: 是否检查dml语句where条件值为null
6. 新增审核按钮 #1032
  • Loading branch information
cookieY committed Nov 1, 2024
1 parent 0f14046 commit 13fe153
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
3 changes: 2 additions & 1 deletion src/handler/fetch/ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/handler/fetch/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
}
}
8 changes: 8 additions & 0 deletions src/handler/personal/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"github.com/cookieY/sqlx"
"strconv"
"strings"
)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/var.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package lib

const Version = "3.1.8.1 Uranus"
const Version = "3.1.9 Uranus"
4 changes: 2 additions & 2 deletions src/service/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 13fe153

Please sign in to comment.