22 lines
539 B
Python
22 lines
539 B
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
|
|
from services.openai_backend_api import OpenAIBackendAPI
|
|
|
|
|
|
def main() -> None:
|
|
ACCESS_TOKEN = ""
|
|
PROMPT = "帮我去网上搜索关于chatgpt2api的相关项目"
|
|
if not ACCESS_TOKEN.strip():
|
|
raise ValueError("ACCESS_TOKEN is empty")
|
|
print(json.dumps(OpenAIBackendAPI(ACCESS_TOKEN).search(PROMPT), ensure_ascii=False, indent=2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|