Compare commits

...

4 Commits

Author SHA1 Message Date
Sakurasan c135d1c022 update azure model 2023-07-01 17:05:45 +08:00
Sakurasan bf373c79ae Merge pull request #22 from chinyajie/main
#21 支持为 user 指定 token
2023-07-01 15:38:35 +08:00
chinyajie c9b763b9ed #21 支持为 user 指定 token 2023-06-30 21:36:48 +08:00
Sakurasan ec31eba72f update doc 2023-06-20 18:19:01 +08:00
5 changed files with 15 additions and 11 deletions
+2 -2
View File
@@ -69,8 +69,8 @@ wget https://github.com/mirrors2/opencatd-open/raw/main/docker/docker-compose.ym
使用Nginx + Docker部署 使用Nginx + Docker部署
- [使用Nginx + Docker部署](./doc/deploy.md) - [使用Nginx + Docker部署](./doc/deploy.md)
pandola for team pandora for team
- [pandola for team](./doc/pandola.md) - [pandora for team](./doc/pandora.md)
# License # License
[GNU General Public License v3.0](License) [GNU General Public License v3.0](License)
+2 -1
View File
@@ -115,8 +115,9 @@ Resp:
### 重置用户 Token ### 重置用户 Token
- URL: `/1/users/:id/reset` - URL: `/1/users/:id/reset`
- URL: `/1/users/:id/reset?token={new user token}`
- Method: `POST` - Method: `POST`
- Description: 重置用户 Token - Description: 重置用户 Token 默认生成新 Token 也可以指定
- Headers: - Headers:
- Authorization: Bearer {token} - Authorization: Bearer {token}
+1
View File
@@ -8,6 +8,7 @@
| model name | deployment name | | model name | deployment name |
| --- | --- | | --- | --- |
|gpt-35-turbo | gpt-35-turbo | |gpt-35-turbo | gpt-35-turbo |
|gpt-35-turbo-16k | gpt-35-turbo-16k |
| gpt-4 | gpt-4 | | gpt-4 | gpt-4 |
## How to use ## How to use
+2 -2
View File
@@ -1,6 +1,6 @@
# pandola for team # pandora for team
pandola是一个把ChatGPT(web/App)接口化的项目,可以看做是第三方 OpenAI API 提供方(接口和OpenAI一致) [pandora](https://github.com/pengzhile/pandora)是一个把ChatGPT(web/App)接口化的项目,可以看做是第三方 OpenAI API 提供方(接口和OpenAI一致)
## 准备 ## 准备
- https://ai.fakeopen.com/auth1 获取accesstoken - https://ai.fakeopen.com/auth1 获取accesstoken
+8 -6
View File
@@ -378,8 +378,12 @@ func HandleDelUser(c *gin.Context) {
func HandleResetUserToken(c *gin.Context) { func HandleResetUserToken(c *gin.Context) {
id := to.Int(c.Param("id")) id := to.Int(c.Param("id"))
newtoken := c.Query("token")
if newtoken == "" {
newtoken = uuid.NewString()
}
if err := store.UpdateUser(uint(id), uuid.NewString()); err != nil { if err := store.UpdateUser(uint(id), newtoken); err != nil {
c.JSON(http.StatusForbidden, gin.H{"error": err.Error()}) c.JSON(http.StatusForbidden, gin.H{"error": err.Error()})
return return
} }
@@ -768,11 +772,9 @@ func NumTokensFromStr(messages string, model string) (num_tokens int) {
} }
func modelmap(in string) string { func modelmap(in string) string {
switch in { // gpt-3.5-turbo -> gpt-35-turbo
case "gpt-3.5-turbo": if strings.HasSuffix(in, ".") {
return "gpt-35-turbo" return strings.ReplaceAll(in, ".", "")
case "gpt-4":
return "gpt-4"
} }
return in return in
} }