Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta77 #76

Merged
merged 78 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
ea4bcc6
beta1
Hoshinonyaruko Jan 21, 2024
5002a28
beta2
Hoshinonyaruko Jan 21, 2024
969841e
beta3
Hoshinonyaruko Jan 21, 2024
a2989c2
beta4
Hoshinonyaruko Jan 21, 2024
611cd8b
beta5
Hoshinonyaruko Jan 21, 2024
dbad42b
beta6
Hoshinonyaruko Jan 21, 2024
4f8895e
beta7
Hoshinonyaruko Jan 21, 2024
30a9cab
beta8
Hoshinonyaruko Jan 21, 2024
461d879
beta9
Hoshinonyaruko Jan 21, 2024
c90c2ee
beta10
Hoshinonyaruko Jan 21, 2024
5227c32
beta11
Hoshinonyaruko Jan 21, 2024
8e14e56
beta12
Hoshinonyaruko Jan 21, 2024
6adfb7f
beta13
Hoshinonyaruko Jan 21, 2024
b04f6c0
beta14
Hoshinonyaruko Jan 21, 2024
649e740
beta15
Hoshinonyaruko Jan 21, 2024
d55cf29
beta16
Hoshinonyaruko Jan 21, 2024
1cc351e
beta16
Hoshinonyaruko Jan 21, 2024
f1a373e
beta19
Hoshinonyaruko Jan 21, 2024
cbf2fe1
beta20
Hoshinonyaruko Jan 21, 2024
3485bfc
beta21
Hoshinonyaruko Jan 21, 2024
3e3bb1a
beta22
Hoshinonyaruko Jan 21, 2024
2e4f3fa
beta23
Hoshinonyaruko Mar 29, 2024
f74075d
beta24
Hoshinonyaruko Mar 29, 2024
f3913cf
beta25
Hoshinonyaruko Mar 29, 2024
4cfb51a
beta27
Hoshinonyaruko Mar 30, 2024
d9b26c0
beta28
Hoshinonyaruko Mar 31, 2024
19da709
beta29
Hoshinonyaruko Mar 31, 2024
e06dcbf
merge
Hoshinonyaruko Mar 31, 2024
c76923e
beta30
Hoshinonyaruko Mar 31, 2024
9ae21da
beta31
Hoshinonyaruko Apr 1, 2024
4f333bc
merge
Hoshinonyaruko Apr 1, 2024
5acba8f
beta33
Hoshinonyaruko Apr 1, 2024
c637fcd
beta34
Hoshinonyaruko Apr 1, 2024
4e85b37
beta35
Hoshinonyaruko Apr 1, 2024
970948e
beta36
Hoshinonyaruko Apr 1, 2024
14271c3
beta37
Hoshinonyaruko Apr 1, 2024
6154d1a
beta38
Hoshinonyaruko Apr 1, 2024
d5be5e6
beta39
Hoshinonyaruko Apr 3, 2024
54afe18
beta40
Hoshinonyaruko Apr 3, 2024
0b71855
beta41
Hoshinonyaruko Apr 3, 2024
8c5f9a3
merge
Hoshinonyaruko Apr 3, 2024
cf752d4
beta42
Hoshinonyaruko Apr 3, 2024
3698824
beta43
Hoshinonyaruko Apr 3, 2024
1e9c189
beta44
Hoshinonyaruko Apr 3, 2024
2adb4ac
beta45
Hoshinonyaruko Apr 4, 2024
79eb713
beta45
Hoshinonyaruko Apr 4, 2024
064f0d0
beta45
Hoshinonyaruko Apr 4, 2024
5a4a59e
beta46
Hoshinonyaruko Apr 5, 2024
df30a32
beta46
Hoshinonyaruko Apr 5, 2024
c920893
beat48
Hoshinonyaruko Apr 7, 2024
3491d5d
beta49
Hoshinonyaruko Apr 8, 2024
575b2ca
beta50
Hoshinonyaruko Apr 8, 2024
4c4bbaa
beta51
Hoshinonyaruko Apr 8, 2024
2ea728b
beta52
Hoshinonyaruko Apr 8, 2024
82bf952
beta53
Hoshinonyaruko Apr 8, 2024
869685c
beta54
Hoshinonyaruko Apr 9, 2024
1f3646e
beta55
Hoshinonyaruko Apr 9, 2024
d6bbadf
beta57
Hoshinonyaruko Apr 10, 2024
fc5086c
beta58
Hoshinonyaruko Apr 10, 2024
602ff65
beta59
Hoshinonyaruko Apr 10, 2024
a82538d
Merge branch 'main' of https://github.com/Hoshinonyaruko/Gensokyo-llm…
Hoshinonyaruko Apr 10, 2024
6433600
beta61
Hoshinonyaruko Apr 10, 2024
9ce88b3
beta62
Hoshinonyaruko Apr 12, 2024
b53617b
beta63
Hoshinonyaruko Apr 12, 2024
ff64c69
beta63
Hoshinonyaruko Apr 12, 2024
b34885f
beta64
Hoshinonyaruko Apr 13, 2024
3658648
beta65
Hoshinonyaruko Apr 13, 2024
3307439
beta66
Hoshinonyaruko Apr 15, 2024
f15c422
beta67
Hoshinonyaruko Apr 17, 2024
518de35
beta70
Hoshinonyaruko Apr 18, 2024
a65f07d
beta71
Hoshinonyaruko Apr 18, 2024
59d07c7
beta72
Hoshinonyaruko Apr 18, 2024
a16ea64
beta72
Hoshinonyaruko Apr 18, 2024
08d5864
beta74
Hoshinonyaruko Apr 19, 2024
9b09401
beta75
Hoshinonyaruko Apr 19, 2024
b51e185
beta76
Hoshinonyaruko Apr 20, 2024
c978654
beta77
Hoshinonyaruko Apr 21, 2024
ca2aa7f
Merge branch 'main' into beta77
Hoshinonyaruko Apr 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions applogic/gensokyo.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,20 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
fmt.Printf("收到prompt参数: %s\n", promptstr)
}

// 读取URL参数 "prompt"
// 读取URL参数 "selfid"
selfid := r.URL.Query().Get("selfid")
if selfid != "" {
// 使用 prompt 变量进行后续处理
fmt.Printf("收到selfid参数: %s\n", selfid)
}

// 读取URL参数 "api"
api := r.URL.Query().Get("api")
if selfid != "" {
// 使用 prompt 变量进行后续处理
fmt.Printf("收到api参数: %s\n", selfid)
}

// 打印日志信息,包括prompt参数
fmtf.Printf("收到onebotv11信息: %+v\n", string(body))

Expand Down Expand Up @@ -358,10 +365,15 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 构建并发送请求到conversation接口
port := config.GetPort()
portStr := fmtf.Sprintf(":%d", port)
portStr := fmt.Sprintf(":%d", port)

// 初始化URL
baseURL := "http://127.0.0.1" + portStr + "/conversation"
// 初始化URL,根据api参数动态调整路径
basePath := "/conversation"
if api != "" {
fmtf.Printf("收到api参数: %s\n", api)
basePath = "/" + api // 动态替换conversation部分为api参数值
}
baseURL := "http://127.0.0.1" + portStr + basePath

// 使用net/url包来构建和编码URL
urlParams := url.Values{}
Expand All @@ -375,7 +387,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
fullURL += "?" + urlParams.Encode()
}

fmtf.Printf("Generated URL:%v", fullURL)
fmtf.Printf("Generated URL:%v\n", fullURL)

// 请求模型还是使用原文请求
requestmsg := message.Message.(string)
Expand Down
10 changes: 10 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,3 +1142,13 @@ func GetPathToken() string {
}
return ""
}

// 获取开启全部api
func GetAllApi() bool {
mu.Lock()
defer mu.Unlock()
if instance != nil {
return instance.Settings.AllApi
}
return false
}
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ func main() {
log.Printf("Unknown API type: %d", apiType)
}

if config.GetAllApi() {
http.HandleFunc("/conversation_gpt", app.ChatHandlerChatgpt)
http.HandleFunc("/conversation_hunyuan", app.ChatHandlerHunyuan)
http.HandleFunc("/conversation_ernie", app.ChatHandlerErnie)
http.HandleFunc("/conversation_rwkv", app.ChatHandlerRwkv)
}

exePath, err := os.Executable()
if err != nil {
log.Fatal(err)
Expand Down
1 change: 1 addition & 0 deletions structs/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ type WXFunctionCall struct {
}

type Settings struct {
AllApi bool `yaml:"allApi"`
SecretId string `yaml:"secretId"`
SecretKey string `yaml:"secretKey"`
Region string `yaml:"region"`
Expand Down
3 changes: 2 additions & 1 deletion template/config_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ version: 1
settings:

#通用配置项
useSse : false #智能体场景开启,其他场景,比如普通onebotv11不开启
allApi : false #以conversation_ernie conversation_hunyuan形式同时开启全部api,请设置好iPWhiteList避免被盗用.
useSse : false #智能体场景开启,其他场景,比如普通onebotv11不开启
port : 46233 #本程序监听端口,支持gensokyo http上报, 请在gensokyo的反向http配置加入 post_url: ["http://127.0.0.1:port/gensokyo"]
path : "http://123.123.123.123:11111" #调用gensokyo api的地址,填入 gensokyo 的 正向http地址 http_address: "0.0.0.0:46231" 对应填入 "http://127.0.0.1:46231"
apiType : 0 #0=混元 1=文心(文心平台包含了N种模型...) 2=gpt
Expand Down
Loading