Fix: close #1
This commit is contained in:
		
							
								
								
									
										1
									
								
								app/credentials.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/credentials.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"installed":{"client_id":"19011937557-bi5nh4afvg4tuqr87v6dp55qj9a9o1h2.apps.googleusercontent.com","project_id":"oc-aassistent","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}} | ||||||
							
								
								
									
										1
									
								
								app/credentials_2.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/credentials_2.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"installed":{"client_id":"629922809906-pl9l1ipout6d5hh19ku50sfvnqgu8ir2.apps.googleusercontent.com","project_id":"calendar-424503","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}} | ||||||
| @@ -29,7 +29,7 @@ from dotenv import load_dotenv | |||||||
|  |  | ||||||
| load_dotenv() | load_dotenv() | ||||||
|  |  | ||||||
| fa_app = FastAPI() | app = FastAPI() | ||||||
| llm = ChatOpenAI( | llm = ChatOpenAI( | ||||||
|     model="gpt-4o-mini", |     model="gpt-4o-mini", | ||||||
|     temperature=0.9 |     temperature=0.9 | ||||||
| @@ -119,20 +119,20 @@ graph = create_react_agent( | |||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| @fa_app.get("/") | @app.get("/") | ||||||
| async def redirect_root_to_docs(): | async def redirect_root_to_docs(): | ||||||
|     return RedirectResponse("/docs") |     return RedirectResponse("/docs") | ||||||
|  |  | ||||||
|  |  | ||||||
| # # Edit this to add the chain you want to add | # # Edit this to add the chain you want to add | ||||||
| add_routes( | add_routes( | ||||||
|     fa_app, |     app, | ||||||
|     llm, |     llm, | ||||||
|     path="/openai" |     path="/openai" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| @fa_app.post("/process_text") | @app.post("/process_text") | ||||||
| async def process_text(request: Request): | async def process_text(request: Request): | ||||||
|     data = await request.json() |     data = await request.json() | ||||||
|     user_input = data.get("text") |     user_input = data.get("text") | ||||||
| @@ -157,4 +157,4 @@ async def process_text(request: Request): | |||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     import uvicorn |     import uvicorn | ||||||
|  |  | ||||||
|     uvicorn.run(fa_app, host="0.0.0.0", port=8000) |     uvicorn.run(app, host="0.0.0.0", port=8000) | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| #!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||||
| from fastapi.testclient import TestClient | from fastapi.testclient import TestClient | ||||||
| from app.server import fa_app | from app.server import app | ||||||
| 
 | 
 | ||||||
| client = TestClient(fa_app) | client = TestClient(app) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_process_text(mocker): | def test_process_text(mocker): | ||||||
							
								
								
									
										1
									
								
								app/token.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/token.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"token": "ya29.a0AeDClZCwppzEBj1JXTYUVQz2C4XdMhwXUJ_5QFMjwccd4xsXl3HhHuio_OouTtnY2uH64MNEfuT-IK0xD6gX_W6_snvPMzq1JELtIzVvqb4eSCNrAVTp0qy4sQwPKKWnEi2HTOV6ZNyy3vOj4VmywjLpW53b5wyuYDC9hoU41waCgYKAQISARASFQHGX2MiAU9Ploii4o7cTRKSiRUyzg0177", "refresh_token": "1//05Hc2PufwLWe2CgYIARAAGAUSNwF-L9IrU2s--kkp6Q2fCzN5uf2vLBvEcYHyJOFZjCQAUpBSC0FWiCUg9wgm8cCMccEGe4Q7MPg", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "19011937557-bi5nh4afvg4tuqr87v6dp55qj9a9o1h2.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://mail.google.com/"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-11-07T22:33:09.497974Z"} | ||||||
							
								
								
									
										1
									
								
								app/token_2.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/token_2.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"token": "ya29.a0AeDClZC30_gM1YE3u8XHKpmLqIcABYBZzJOVQfrNyUJrFuOPxNpt96IbTeCIM266Es--v34aMA70oZG1GIELbcuExSSQ25_pzdHd9yS18vDOgdz8OtuG24_2DGnaCy7FOQBZzFr5GxgLJ_657Zal3RF8lreEFLyVLKdGf6TiaCgYKATMSARASFQHGX2MiirXKmKxKPjAWuSG0af_xmw0175", "refresh_token": "1//05akITlwASya5CgYIARAAGAUSNwF-L9IryPh1Y647Eim5KZZhD3DKCuUtkAp28N30ed1TALtax5TkflyKGxDtBmayKowuMZkaT9k", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "629922809906-pl9l1ipout6d5hh19ku50sfvnqgu8ir2.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-11-02T23:47:30.521929Z"} | ||||||
| @@ -1 +1 @@ | |||||||
| {"token": "ya29.a0AeDClZCdMN1pUVQq1VZ-JAmvsbbFB4DrG0quqUv_872wH26j4FzaqAjWAcEzMDuOYr-3IEe9iMHq7NASw9YxhFDbr55jRPQulkJNo2xYomFZtUyfFfRMkA61b-A6HRZKY29cAY4p7yqOfKlY83Vs38fwkDdrNRPGsIHOGP-C-QaCgYKAV8SARASFQHGX2MivlXIMkOipbeCpzWZtT90Ow0177", "refresh_token": "1//05Hc2PufwLWe2CgYIARAAGAUSNwF-L9IrU2s--kkp6Q2fCzN5uf2vLBvEcYHyJOFZjCQAUpBSC0FWiCUg9wgm8cCMccEGe4Q7MPg", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "19011937557-bi5nh4afvg4tuqr87v6dp55qj9a9o1h2.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://mail.google.com/"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-11-07T16:31:54.151130Z"} | {"token": "ya29.a0AeDClZCwppzEBj1JXTYUVQz2C4XdMhwXUJ_5QFMjwccd4xsXl3HhHuio_OouTtnY2uH64MNEfuT-IK0xD6gX_W6_snvPMzq1JELtIzVvqb4eSCNrAVTp0qy4sQwPKKWnEi2HTOV6ZNyy3vOj4VmywjLpW53b5wyuYDC9hoU41waCgYKAQISARASFQHGX2MiAU9Ploii4o7cTRKSiRUyzg0177", "refresh_token": "1//05Hc2PufwLWe2CgYIARAAGAUSNwF-L9IrU2s--kkp6Q2fCzN5uf2vLBvEcYHyJOFZjCQAUpBSC0FWiCUg9wgm8cCMccEGe4Q7MPg", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "19011937557-bi5nh4afvg4tuqr87v6dp55qj9a9o1h2.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://mail.google.com/"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-11-07T22:33:09.497974Z"} | ||||||
		Reference in New Issue
	
	Block a user