refactor: Relay text controller improvements

- Add client-side UI for Relaytext.
This commit is contained in:
Laisky.Cai 2023-12-27 02:51:30 +00:00
parent 9a94b41684
commit 75cbfd7bb6

View File

@ -261,6 +261,8 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
} else { } else {
requestBody = c.Request.Body requestBody = c.Request.Body
} }
common.LogInfo(c.Request.Context(), fmt.Sprintf("convert to apitype %d", apiType))
switch apiType { switch apiType {
case APITypeClaude: case APITypeClaude:
claudeRequest := requestOpenAI2Claude(textRequest) claudeRequest := requestOpenAI2Claude(textRequest)
@ -358,6 +360,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
} }
apiKey := c.Request.Header.Get("Authorization") apiKey := c.Request.Header.Get("Authorization")
apiKey = strings.TrimPrefix(apiKey, "Bearer ") apiKey = strings.TrimPrefix(apiKey, "Bearer ")
switch apiType { switch apiType {
case APITypeOpenAI: case APITypeOpenAI:
if channelType == common.ChannelTypeAzure { if channelType == common.ChannelTypeAzure {