添加windows系统支持,修改部分配置及spark部分
This commit is contained in:
parent
3a9f6c881c
commit
d0ad0edc06
13
main.go
13
main.go
|
|
@ -58,9 +58,16 @@ func init() {
|
||||||
os.MkdirAll(proto.CID_BASE_DIR, os.ModePerm)
|
os.MkdirAll(proto.CID_BASE_DIR, os.ModePerm)
|
||||||
os.MkdirAll(proto.CID_BASE_DIR+"script", os.ModePerm)
|
os.MkdirAll(proto.CID_BASE_DIR+"script", os.ModePerm)
|
||||||
os.MkdirAll(proto.CID_BASE_DIR+"workspace", os.ModePerm)
|
os.MkdirAll(proto.CID_BASE_DIR+"workspace", os.ModePerm)
|
||||||
//读取配置文件
|
//系统是linux、macos还是windows
|
||||||
//文件地址/home/saw-ai/saw-ai.conf
|
var configPath string
|
||||||
configPath := "/home/saw/saw-ai-go/saw-ai.conf"
|
if os.Getenv("OS") == "Windows_NT" {
|
||||||
|
configPath = "E:/Code/saw-ai/saw-ai.conf"
|
||||||
|
} else if os.Getenv("OS") == "linux" {
|
||||||
|
//文件地址/home/saw-ai/saw-ai.conf
|
||||||
|
configPath = "/home/saw/saw-ai-go/saw-ai.conf"
|
||||||
|
} else {
|
||||||
|
configPath = "/home/saw/saw-ai-go/saw-ai.conf"
|
||||||
|
}
|
||||||
//读取配置文件
|
//读取配置文件
|
||||||
err := proto.ReadConfig(configPath)
|
err := proto.ReadConfig(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ func genSparkParams(question, appid string, domain string, sessionID int, system
|
||||||
Chat: ChatParameter{
|
Chat: ChatParameter{
|
||||||
Domain: domain,
|
Domain: domain,
|
||||||
Temperature: 0.8,
|
Temperature: 0.8,
|
||||||
MaxTokens: 2048,
|
MaxTokens: 4096,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Payload: SparkRequestPayload{
|
Payload: SparkRequestPayload{
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,8 @@ var (
|
||||||
func sparkImage() {
|
func sparkImage() {
|
||||||
|
|
||||||
d := websocket.Dialer{
|
d := websocket.Dialer{
|
||||||
HandshakeTimeout: 5 * time.Second,
|
HandshakeTimeout: 20 * time.Second,
|
||||||
}
|
}
|
||||||
//鎻℃墜骞跺缓绔媤ebsocket 杩炴帴
|
|
||||||
conn, resp, err := d.Dial(assembleAuthUrl(hostUrl, apiKey, apiSecret), nil)
|
conn, resp, err := d.Dial(assembleAuthUrl(hostUrl, apiKey, apiSecret), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(readResp(resp) + err.Error())
|
panic(readResp(resp) + err.Error())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue