Skip to content

Commit

Permalink
feat: support plugin for ali channel (close songquanpeng#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Dec 10, 2023
1 parent 01f7b01 commit 379074f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller/relay-text.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
if textRequest.Stream {
req.Header.Set("X-DashScope-SSE", "enable")
}
if c.GetString("plugin") != "" {
req.Header.Set("X-DashScope-Plugin", c.GetString("plugin"))
}
case APITypeTencent:
req.Header.Set("Authorization", apiKey)
case APITypePaLM:
Expand Down
2 changes: 2 additions & 0 deletions middleware/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ func Distribute() func(c *gin.Context) {
c.Set("api_version", channel.Other)
case common.ChannelTypeAIProxyLibrary:
c.Set("library_id", channel.Other)
case common.ChannelTypeAli:
c.Set("plugin", channel.Other)
}
c.Next()
}
Expand Down
14 changes: 14 additions & 0 deletions web/src/pages/Channel/EditChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,20 @@ const EditChannel = () => {
</Form.Field>
)
}
{
inputs.type === 17 && (
<Form.Field>
<Form.Input
label='插件参数'
name='other'
placeholder={'请输入插件参数,即 X-DashScope-Plugin 请求头的取值'}
onChange={handleInputChange}
value={inputs.other}
autoComplete='new-password'
/>
</Form.Field>
)
}
<Form.Field>
<Form.Dropdown
label='模型'
Expand Down

0 comments on commit 379074f

Please sign in to comment.