mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat(service): add OpenAI completions models output probe (#97)
This commit is contained in:
@@ -254,12 +254,10 @@ func probeReachable(ctx context.Context, baseURL string) (bool, string) {
|
||||
}
|
||||
|
||||
func probeOpenAICompletions(ctx context.Context, baseURL, apiKey string) CheckResult {
|
||||
body := `{"model":"probe-test","messages":[{"role":"user","content":"hi"}],"max_tokens":1}`
|
||||
return probeEndpoint(ctx, http.MethodPost, baseURL+"/chat/completions",
|
||||
return probeEndpoint(ctx, http.MethodGet, baseURL+"/models",
|
||||
map[string]string{
|
||||
"Authorization": "Bearer " + apiKey,
|
||||
"Content-Type": "application/json",
|
||||
}, body)
|
||||
}, "")
|
||||
}
|
||||
|
||||
func probeOpenAIResponses(ctx context.Context, baseURL, apiKey string) CheckResult {
|
||||
|
||||
@@ -15,7 +15,7 @@ export const CLIENT_TYPE_META: Record<string, ClientTypeMeta> = {
|
||||
'openai-completions': {
|
||||
value: 'openai-completions',
|
||||
label: 'OpenAI Completions',
|
||||
hint: '/v1/chat/completions',
|
||||
hint: '/v1/models',
|
||||
},
|
||||
'anthropic-messages': {
|
||||
value: 'anthropic-messages',
|
||||
|
||||
Reference in New Issue
Block a user