Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/fruitbars/simple-one-api
/ functions
Functions
289 in github.com/fruitbars/simple-one-api
⨍
Functions
289
◇
Types & classes
162
↓ 32 callers
Method
Close
()
pkg/utils/custom_transport_utils.go:70
↓ 26 callers
Function
GetStringFromMap
GetStringFromMap 试图从给定的 map 中提取指定键的字符串值。
pkg/utils/map_utils.go:4
↓ 21 callers
Method
WriteString
(s string)
pkg/simple_client/simple_stream_reader.go:51
↓ 19 callers
Method
Flush
()
pkg/simple_client/simple_stream_reader.go:68
↓ 17 callers
Function
GetString
辅助函数:获取指针值
pkg/utils/pointer_utils.go:4
↓ 13 callers
Function
SetEventStreamHeaders
(c *gin.Context)
pkg/utils/gin_utils.go:10
↓ 8 callers
Function
GetInt64
(ptr *int64)
pkg/utils/pointer_utils.go:11
↓ 8 callers
Function
sendErrorResponse
(c *gin.Context, code int, msg string)
pkg/handler/openai_handler.go:352
↓ 7 callers
Method
Header
()
pkg/simple_client/simple_stream_reader.go:55
↓ 6 callers
Method
Recv
()
pkg/simple_client/simple_stream_reader.go:82
↓ 5 callers
Method
CreateChatCompletionStream
( ctx context.Context, request openai.ChatCompletionRequest, )
pkg/simple_client/simple_client.go:68
↓ 5 callers
Function
NewSimpleClient
(authToken string)
pkg/simple_client/simple_client.go:23
↓ 4 callers
Method
CreateChatCompletion
( ctx context.Context, request openai.ChatCompletionRequest, )
pkg/simple_client/simple_client.go:35
↓ 4 callers
Function
GetLBIndex
(lbStrategy string, key string, length int)
pkg/config/lb_strategy.go:53
↓ 4 callers
Method
Wait
Wait 使用QPS限流器等待直到获得令牌
pkg/mylimiter/limiter.go:110
↓ 3 callers
Function
CheckStatusCode
假设 somewhere in your code you have initialized the logger correctly. mylog.InitLog("dev") or mylog.InitLog("prod") should have been called.
pkg/mycommon/common_err_resp.go:15
↓ 3 callers
Function
ConvertSystemMessages2NoSystem
ProcessMessages 根据消息的角色处理聊天历史。
pkg/mycommon/oai_message_utils.go:72
↓ 3 callers
Function
GetLastestMessage
(oaiReqMessage []openai.ChatCompletionMessage)
pkg/mycommon/oai_message_utils.go:35
↓ 3 callers
Function
GetLimiter
GetLimiter 根据键获取或创建对应的限流器,支持线程安全操作
pkg/mylimiter/limiter.go:136
↓ 3 callers
Function
HandleOpenAIRequest
(c *gin.Context, oaiReq *openai.ChatCompletionRequest)
pkg/handler/openai_handler.go:158
↓ 3 callers
Function
SendHTTPRequest
非SSE的HTTP请求处理函数
pkg/utils/http_request.go:15
↓ 3 callers
Method
Write
(data []byte)
pkg/simple_client/simple_stream_reader.go:41
↓ 3 callers
Function
getRandomIndex
(n int)
pkg/config/lb_strategy.go:19
↓ 3 callers
Function
handleErrorResponse
(c *gin.Context, err error)
pkg/handler/openai_huoshan_handler.go:173
↓ 3 callers
Function
handleOpenAIOpenAIRequest
handleOpenAIRequest handles OpenAI requests, supporting both streaming and non-streaming modes
pkg/handler/openai_openai_handler.go:108
↓ 2 callers
Function
Cleanup
()
pkg/initializer/initializer.go:36
↓ 2 callers
Function
GetACredentials
GetACredentials 根据模型名从ModelDetails中选择合适的凭证
pkg/mycommon/common_credentials.go:10
↓ 2 callers
Function
GetAccessToken
GetAccessToken 使用 AK,SK 生成鉴权签名(Access Token)
pkg/llm/baidu-qianfan/qianfan.go:173
↓ 2 callers
Function
GetConfProxyTransport
GetConfProxyTransport 根据全局配置返回相应的 http.Transport
pkg/config/proxy_strategy.go:78
↓ 2 callers
Function
GetImageURLData
getImageURLData 分析给定的 URL 字符串,并返回其 base64 编码数据和 MIME 类型
pkg/mycommon/oai_message_utils.go:138
↓ 2 callers
Function
GetModelRedirect
GetModelRedirect 函数,根据model在ModelMap中查找对应的映射,如果找不到则返回原始model
pkg/config/config.go:379
↓ 2 callers
Function
GetModelService
* // GetAllModelService 根据模型名称获取服务和凭证信息 func GetAllModelService(modelName string) ([]ModelDetails, error) { if serviceDetails, found := ModelToServic
pkg/config/config.go:310
↓ 2 callers
Function
IsProxyEnabled
(s *ModelDetails)
pkg/config/config.go:432
↓ 2 callers
Function
LLMTranslate
(srcText string, srcLang string, targetLang string)
pkg/translation/llm_translate.go:38
↓ 2 callers
Function
LLMTranslateStream
(srcText string, srcLang string, targetLang string, cb func(string))
pkg/translation/llm_translate.go:70
↓ 2 callers
Function
ParseRFC3339NanoToUnixTime
parseToUnixTime函数接收一个符合RFC3339Nano格式的日期时间字符串,并返回其对应的Unix时间戳(int类型)。
pkg/utils/time_utils.go:6
↓ 2 callers
Function
ResolveRelativePathToAbsolute
(filename string)
pkg/utils/file_utils.go:18
↓ 2 callers
Function
SendSSERequest
SSE的HTTP请求处理函数,带回调处理每次接收的数据
pkg/utils/http_request.go:49
↓ 2 callers
Function
Setup
Setup initializes the configuration and logging system.
pkg/initializer/initializer.go:15
↓ 2 callers
Function
adjustFloatValue
(value, min, max float32)
pkg/mycommon/common_model_params.go:74
↓ 2 callers
Function
adjustGroqReq
https://console.groq.com/docs/openai
pkg/handler/openai_groq_handler.go:9
↓ 2 callers
Function
createLLMTranslationPrompt
(srcText string, srcLang string, targetLang string)
pkg/translation/llm_translate.go:29
↓ 2 callers
Function
getConfig
getConfig generates the OpenAI client configuration based on model details and request
pkg/handler/openai_openai_handler.go:76
↓ 2 callers
Function
getHttpProxyTransport
GetHttpProxyTransport 返回配置了 HTTP 代理的 http.Transport
pkg/config/proxy_strategy.go:22
↓ 2 callers
Function
getLimitDetails
通用的限流器详情获取函数
pkg/mycommon/common_modeldetails.go:9
↓ 2 callers
Function
getSocks5Transport
GetSocks5Transport 返回配置了 SOCKS5 代理的 http.Transport,并设置超时时间
pkg/config/proxy_strategy.go:40
↓ 2 callers
Function
handleClaudeEvent
handleEvent 处理事件的通用逻辑
pkg/handler/openai_claude_handler.go:181
↓ 2 callers
Function
logOpenAIChatCompletionRequest
(oaiReq *openai.ChatCompletionRequest)
pkg/handler/openai_handler.go:67
↓ 2 callers
Function
qianfanModel2Address
根据输入的服务名返回对应的字符串
pkg/llm/baidu-qianfan/qianfan_model2address.go:81
↓ 1 callers
Method
Acquire
Acquire 尝试获取并发限制的许可,如果设置了超时则可以被中断
pkg/mylimiter/limiter.go:121
↓ 1 callers
Function
AdjustChatCompletionRequestForZhiPu
(oaiReq *openai.ChatCompletionRequest)
pkg/handler/openai_zhipu_handler.go:25
↓ 1 callers
Function
AdjustOpenAIRequestParams
(oaiReq *openai.ChatCompletionRequest)
pkg/mycommon/oai_message_utils.go:180
↓ 1 callers
Function
AdjustParamsToRange
(modelName string, temperature, topP float32, maxTokens int)
pkg/mycommon/common_model_params.go:86
↓ 1 callers
Function
AgentBuilderResponseToOpenAIResponse
(abResp *baidu_agentbuilder.GetAnswerResponse)
pkg/adapter/baidu_agentbuilder_adapter/agentbuilder_openai.go:10
↓ 1 callers
Function
AgentBuilderResponseToOpenAIStreamResponse
(abStreamResp *baidu_agentbuilder.ConversationResponse)
pkg/adapter/baidu_agentbuilder_adapter/agentbuilder_openai.go:34
↓ 1 callers
Method
Allow
()
pkg/mylimiter/limiter.go:39
↓ 1 callers
Function
BaiduQianfanEmbedding
(req *oai.EmbeddingRequest, accessKey string, secretKey string, proxyTransport *http.Transport)
pkg/embedding/baiduqianfan/qianfan_embedding.go:114
↓ 1 callers
Function
CallChatMessagesNoneStreamMode
(difyReq *ChatMessageRequest, apiKey string, httpTransport *http.Transport)
pkg/llm/devplatform/dify/chat_message_request/chat_messages.go:23
↓ 1 callers
Function
CallChatMessagesStreamMode
(difyReq *ChatMessageRequest, apiKey string, callback func(data string), httpTransport *http.Transport)
pkg/llm/devplatform/dify/chat_message_request/chat_messages.go:15
↓ 1 callers
Function
Chat
(token string, chatRequest *common.ChatRequest, callback func(event, data string), httpTransport *http.Transpo
pkg/llm/devplatform/cozecn_v3/streammode/chat.go:10
↓ 1 callers
Function
Chat
(token string, chatRequest *common.ChatRequest, httpTransport *http.Transport)
pkg/llm/devplatform/cozecn_v3/nonestream/chat/chat.go:10
↓ 1 callers
Function
ChatMessageslist
发起POST请求并处理响应
pkg/llm/devplatform/cozecn_v3/nonestream/chat_message_list/chat_message_list.go:12
↓ 1 callers
Function
ChatRetrieve
发起GET请求并处理响应
pkg/llm/devplatform/cozecn_v3/nonestream/chat_retrieve/chat_retrieve.go:12
↓ 1 callers
Function
ChatWithNoneStream
(token string, chatRequest *common.ChatRequest, httpTransport *http.Transport, timeout int)
pkg/llm/devplatform/cozecn_v3/nonestream/chat_with_none_stream.go:13
↓ 1 callers
Function
CheckOpenAIStreamRespone
(respStream *openai.ChatCompletionStreamResponse)
pkg/adapter/openai_openai.go:12
↓ 1 callers
Function
ClaudeReponseToOpenAIResponse
ClaudeReponseToOpenAIResponse 将 claude.ResponseBody 转换为 myopenai.OpenAIResponse
pkg/adapter/claude_openai.go:133
↓ 1 callers
Function
Conversation
conversation 函数实现
pkg/llm/devplatform/baidu_agentbuilder/agentbuilder.go:167
↓ 1 callers
Function
CozecnReponseToOpenAIResponse
(resp *cozecn.Response)
pkg/adapter/cozecn_openai.go:59
↓ 1 callers
Function
CozecnReponseToOpenAIResponseStream
(resp *cozecn.StreamResponse)
pkg/adapter/cozecn_openai.go:103
↓ 1 callers
Function
CozecnV3ReponseToOpenAIResponse
(resp *chat_message_list.MessageListResponse)
pkg/adapter/cozecn_v3_openai.go:93
↓ 1 callers
Function
CozecnV3ReponseToOpenAIResponseStream
(resp *streammode.EventData)
pkg/adapter/cozecn_v3_openai.go:136
↓ 1 callers
Function
DeepCopyChatCompletionRequest
DeepCopyChatCompletionRequest 创建一个 ChatCompletionRequest 的深度副本
pkg/mycommon/oai_message_utils.go:197
↓ 1 callers
Function
DeepCopyGeminiRequest
(original *googlegemini.GeminiRequest)
pkg/adapter/gemini_request_openai.go:15
↓ 1 callers
Function
DifyMessageEndEventToOpenAIResponseStream
(difyResp *chunk_chat_completion_response.MessageEndEvent)
pkg/adapter/dify_openai.go:66
↓ 1 callers
Function
DifyResponseToOpenAIResponse
(difyResp *chat_completion_response.ChatCompletionResponse)
pkg/adapter/dify_openai.go:31
↓ 1 callers
Function
DifyResponseToOpenAIResponseStream
(difyResp *chunk_chat_completion_response.MessageEvent)
pkg/adapter/dify_openai.go:51
↓ 1 callers
Function
EmbeddingsHandler
(c *gin.Context)
pkg/embedding/embeddings_handler.go:19
↓ 1 callers
Function
FileExists
(filename string)
pkg/utils/file_utils.go:87
↓ 1 callers
Function
FindLineAndCharacter
(data []byte, offset int)
pkg/config/config_json_check.go:8
↓ 1 callers
Function
GeminiResponseToOpenAIResponse
(qfResp *google_gemini.GeminiResponse)
pkg/adapter/gemini_openai.go:10
↓ 1 callers
Function
GeminiResponseToOpenAIStreamResponse
(qfResp *google_gemini.GeminiResponse)
pkg/adapter/gemini_openai.go:55
↓ 1 callers
Function
GetAPIKeyFromHeader
从Authorization头部中获取API密钥
pkg/utils/gin_utils.go:24
↓ 1 callers
Function
GetAnswer
getAnswer 函数实现
pkg/llm/devplatform/baidu_agentbuilder/agentbuilder.go:106
↓ 1 callers
Function
GetCredentialLimit
(credentials map[string]interface{})
pkg/mycommon/common_credentials.go:23
↓ 1 callers
Function
GetErrorContext
getErrorContext 获取错误上下文的文本
pkg/config/config_json_check.go:26
↓ 1 callers
Function
GetFileNameAndType
(filePath string)
pkg/utils/file_utils.go:55
↓ 1 callers
Function
GetGlobalModelRedirect
GetGlobalModelRedirect 函数,根据model在ModelMap中查找对应的映射,如果找不到则返回原始model
pkg/config/config.go:389
↓ 1 callers
Function
GetModelMapping
GetModelMapping 函数,根据model在ModelMap中查找对应的映射,如果找不到则返回原始model
pkg/config/config.go:369
↓ 1 callers
Function
GetModelParams
(modelName string)
pkg/mycommon/common_model_params.go:66
↓ 1 callers
Function
GetRandomEnabledModelDetails
()
pkg/config/config.go:330
↓ 1 callers
Function
GetRandomEnabledModelDetailsV1
()
pkg/config/config.go:354
↓ 1 callers
Function
GetServiceLimiterDetailsLimit
获取服务限流器的限流详情
pkg/mycommon/common_modeldetails.go:30
↓ 1 callers
Function
GetServiceModelDetailsLimit
获取服务模型的限流详情
pkg/mycommon/common_modeldetails.go:25
↓ 1 callers
Function
GetSystemMessage
(oaiReqMessage []openai.ChatCompletionMessage)
pkg/mycommon/oai_message_utils.go:16
↓ 1 callers
Function
HunYuanResponseToOpenAIResponse
转换函数实现
pkg/adapter/hunyuan_openai.go:169
↓ 1 callers
Function
HunYuanResponseToOpenAIStreamResponse
转换函数实现
pkg/adapter/hunyuan_openai.go:138
↓ 1 callers
Function
HuoShanBotResponseToOpenAIResponse
(huoshanBotResp *model.BotChatCompletionResponse)
pkg/adapter/huoshanbot_openai.go:9
↓ 1 callers
Function
HuoShanBotResponseToOpenAIStreamResponse
HuoShanBotResponseToOpenAIStreamResponse converts a HuoShanBot stream response to an OpenAIStreamResponse
pkg/adapter/huoshanbot_openai.go:61
↓ 1 callers
Function
InitConfig
InitConfig 初始化配置
pkg/config/config.go:185
↓ 1 callers
Function
InitLog
(mode string)
pkg/mylog/logger.go:12
next →
1–100 of 289, ranked by callers