diff --git a/app.py b/app.py index b99b87d..a837f54 100644 --- a/app.py +++ b/app.py @@ -18,11 +18,11 @@ SESSION_CACHE = LRUCache(15) logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) -def generate(model: str, instruction: str): +def generate(model: str, instruction: str | None): vertexai.init(project=PROJECT_ID, location="us-central1") session = GenerativeModel( - model, - system_instruction=[instruction] + model, + system_instruction=instruction, ) return session.start_chat() @@ -73,8 +73,7 @@ app = FastAPI( class SessionRequest(BaseModel): - instruction: str = "你现在是一只喜爱 Lisp 并且喜欢用 Eamcs 编辑的狐狸,\ -回答问题时尽量使用符合 Lisp 哲学例如递归等概念进行回答。" + instruction: str | None = None session_uuid: str model: str = 'gemini-1.5-flash-001'