🆕real link es #1
This commit is contained in:
parent
a0afee4161
commit
5f0e76c0bb
@ -71,4 +71,7 @@ const (
|
|||||||
|
|
||||||
// GLM 部分
|
// GLM 部分
|
||||||
ErrorsGlmClientInitFail string = "GLM Client 初始化失败"
|
ErrorsGlmClientInitFail string = "GLM Client 初始化失败"
|
||||||
|
|
||||||
|
// ES 部分
|
||||||
|
ErrorsInitConnFail string = "初始化 Elasticsearch 连接失败"
|
||||||
)
|
)
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/casbin/casbin/v2"
|
"github.com/casbin/casbin/v2"
|
||||||
|
"github.com/elastic/go-elasticsearch/v8"
|
||||||
"github.com/yankeguo/zhipu"
|
"github.com/yankeguo/zhipu"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -46,6 +46,9 @@ var (
|
|||||||
|
|
||||||
// GLM 全局客户端
|
// GLM 全局客户端
|
||||||
GlmClient *zhipu.Client
|
GlmClient *zhipu.Client
|
||||||
|
|
||||||
|
// ES 全局客户端
|
||||||
|
ElasticClient *elasticsearch.Client
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -74,7 +74,9 @@ func (e *Encounters) Create(context *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 3. ES speed
|
// 3. ES speed
|
||||||
|
if level := int(context.GetFloat64(consts.ValidatorPrefix + "level")); level > 1 {
|
||||||
// TODO
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
response.Success(context, consts.CurdStatusOkMsg, gin.H{
|
response.Success(context, consts.CurdStatusOkMsg, gin.H{
|
||||||
"encounter_id": encounter_id,
|
"encounter_id": encounter_id,
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/elastic/go-elasticsearch/v8"
|
||||||
"github.com/yankeguo/zhipu"
|
"github.com/yankeguo/zhipu"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -119,4 +120,12 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(my_errors.ErrorsGlmClientInitFail + err.Error())
|
log.Fatal(my_errors.ErrorsGlmClientInitFail + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 12. ES 客户端启动
|
||||||
|
variable.ElasticClient, err = elasticsearch.NewClient(elasticsearch.Config{
|
||||||
|
Addresses: []string{variable.ConfigYml.GetString("ElasticSearch.Addr")},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(my_errors.ErrorsInitConnFail + err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,3 +156,8 @@ Glm:
|
|||||||
ApiKey: "0cf510ebc01599dba2a593069c1bdfbc.nQBQ4skP8xBh7ijU"
|
ApiKey: "0cf510ebc01599dba2a593069c1bdfbc.nQBQ4skP8xBh7ijU"
|
||||||
DefaultModel: "glm-4-flash"
|
DefaultModel: "glm-4-flash"
|
||||||
|
|
||||||
|
ElasticSearch:
|
||||||
|
Addr: "http://localhost:9200"
|
||||||
|
UserName: "elastic"
|
||||||
|
Password: ""
|
||||||
|
|
@ -13,7 +13,7 @@ func InitElastic() {
|
|||||||
var err error
|
var err error
|
||||||
ElasticClient, err = elasticsearch.NewClient(elasticsearch.Config{
|
ElasticClient, err = elasticsearch.NewClient(elasticsearch.Config{
|
||||||
// Addresses: []string{"http://113.44.68.213:9200"},
|
// Addresses: []string{"http://113.44.68.213:9200"},
|
||||||
Addresses: []string{"http://127.0.0.1:9200"},
|
Addresses: []string{"http://localhost:9200"}, // TIP 用 localhost 可以,127.0.0.1 无效...
|
||||||
// Username: "elastic",
|
// Username: "elastic",
|
||||||
// Password: "U8n61yn*Sp4Kvbuqo_K8",
|
// Password: "U8n61yn*Sp4Kvbuqo_K8",
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user