@@ -17,12 +17,38 @@ def list_chat_engines(
1717 db_session : SessionDep ,
1818 params : Params = Depends (),
1919) -> Page [ChatEngine ]:
20- return chat_engine_repo .paginate (db_session , params , need_public = True )
20+ page = chat_engine_repo .paginate (db_session , params , need_public = True )
21+ for item in page .items :
22+ if "post_verification_token" in item .engine_options :
23+ item .engine_options ["post_verification_token" ] = "********"
24+ if "post_verification_url" in item .engine_options :
25+ item .engine_options ["post_verification_url" ] = "********"
26+ if "external_engine_config" in item .engine_options :
27+ if "stream_chat_api_url" in item .engine_options ["external_engine_config" ]:
28+ item .engine_options ["external_engine_config" ]["stream_chat_api_url" ] = (
29+ "********"
30+ )
31+ return page
2132
2233
2334@router .get ("/chat-engines/{chat_engine_id}" )
2435def get_chat_engine (
2536 db_session : SessionDep ,
2637 chat_engine_id : int ,
2738) -> ChatEngine :
28- return chat_engine_repo .must_get (db_session , chat_engine_id , need_public = True )
39+ chat_engine = chat_engine_repo .must_get (
40+ db_session , chat_engine_id , need_public = True
41+ )
42+ if "post_verification_token" in chat_engine .engine_options :
43+ chat_engine .engine_options ["post_verification_token" ] = "********"
44+ if "post_verification_url" in chat_engine .engine_options :
45+ chat_engine .engine_options ["post_verification_url" ] = "********"
46+ if "external_engine_config" in chat_engine .engine_options :
47+ if (
48+ "stream_chat_api_url"
49+ in chat_engine .engine_options ["external_engine_config" ]
50+ ):
51+ chat_engine .engine_options ["external_engine_config" ][
52+ "stream_chat_api_url"
53+ ] = "********"
54+ return chat_engine
0 commit comments