mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 18:23:45 +08:00
refactor: refactor chat_handler, add support for Azure and ChatGLM
This commit is contained in:
20
api/store/redis.go
Normal file
20
api/store/redis.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"chatplus/core/types"
|
||||
"context"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
func NewRedisClient(config *types.AppConfig) (*redis.Client, error) {
|
||||
client := redis.NewClient(&redis.Options{
|
||||
Addr: config.Redis.Url(),
|
||||
Password: config.Redis.Password,
|
||||
DB: config.Redis.DB,
|
||||
})
|
||||
_, err := client.Ping(context.Background()).Result()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
Reference in New Issue
Block a user