mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 12:47:28 +08:00
fix(ai-proxy): use HasSuffix instead of Contains in claude.GetApiName to prevent sub-path misidentification (#3839)
Signed-off-by: zat366 <authentic.zhao@gmail.com>
This commit is contained in:
@@ -1060,16 +1060,16 @@ func (c *claudeProvider) insertHttpContextMessage(body []byte, content string, o
|
||||
}
|
||||
|
||||
func (c *claudeProvider) GetApiName(path string) ApiName {
|
||||
if strings.Contains(path, PathAnthropicMessages) {
|
||||
if strings.HasSuffix(path, PathAnthropicMessages) {
|
||||
return ApiNameChatCompletion
|
||||
}
|
||||
if strings.Contains(path, PathAnthropicComplete) {
|
||||
if strings.HasSuffix(path, PathAnthropicComplete) {
|
||||
return ApiNameCompletion
|
||||
}
|
||||
if strings.Contains(path, PathOpenAIModels) {
|
||||
if strings.HasSuffix(path, PathOpenAIModels) {
|
||||
return ApiNameModels
|
||||
}
|
||||
if strings.Contains(path, PathOpenAIEmbeddings) {
|
||||
if strings.HasSuffix(path, PathOpenAIEmbeddings) {
|
||||
return ApiNameEmbeddings
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user