2023-09-24 21:45:30 -06:00
|
|
|
from flask import jsonify
|
|
|
|
|
|
|
|
from . import openai_bp
|
2023-09-28 18:40:24 -06:00
|
|
|
from llm_server.custom_redis import ONE_MONTH_SECONDS, flask_cache
|
2023-09-26 22:09:11 -06:00
|
|
|
from ...llm.openai.transform import generate_oai_string
|
2023-09-24 21:45:30 -06:00
|
|
|
from ..stats import server_start_time
|
|
|
|
|
|
|
|
|
|
|
|
@openai_bp.route('/organizations', methods=['GET'])
|
2023-09-26 22:09:11 -06:00
|
|
|
@flask_cache.cached(timeout=ONE_MONTH_SECONDS, query_string=True)
|
2023-09-24 21:45:30 -06:00
|
|
|
def openai_organizations():
|
|
|
|
return jsonify({
|
|
|
|
"object": "list",
|
|
|
|
"data": [
|
|
|
|
{
|
|
|
|
"object": "organization",
|
2023-09-25 12:30:40 -06:00
|
|
|
"id": f"org-{generate_oai_string(24)}",
|
2023-09-24 21:45:30 -06:00
|
|
|
"created": int(server_start_time.timestamp()),
|
|
|
|
"title": "Personal",
|
2023-10-01 14:15:01 -06:00
|
|
|
"name": f"user-{generate_oai_string(24)}",
|
2023-09-24 21:45:30 -06:00
|
|
|
"description": "Personal org for bobjoe@0.0.0.0",
|
|
|
|
"personal": True,
|
|
|
|
"is_default": True,
|
|
|
|
"role": "owner"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|