extensions/openai: include all available models in Model.list (#2368)

Co-authored-by: Matthew Ashton <mashton-gitlab@zhero.org>
This commit is contained in:
matatonic 2023-05-30 21:13:37 -04:00 committed by GitHub
parent e5b756ecfe
commit a6d3f010a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import requests
import yaml
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from threading import Thread
from modules.utils import get_available_models
import numpy as np
@ -184,6 +185,8 @@ class Handler(BaseHTTPRequestHandler):
"permission": []
}]
models.extend([{ "id": id, "object": "model", "owned_by": "user", "permission": [] } for id in get_available_models() ])
response = ''
if self.path == '/v1/models':
response = json.dumps({