forked from React-Group/interstellar_ai
		
	main #19
					 4 changed files with 28 additions and 43 deletions
				
			
		|  | @ -3,13 +3,14 @@ | ||||||
|   * { |   * { | ||||||
|     margin: 0; |     margin: 0; | ||||||
|     padding: 0; |     padding: 0; | ||||||
|  |     border-radius: none; | ||||||
|   } |   } | ||||||
|    |    | ||||||
|   /* Header styles */ |   /* Header styles */ | ||||||
|   header { |   header { | ||||||
|     flex-direction: column; |     flex-direction: column; | ||||||
|     align-items: center; |     align-items: center; | ||||||
|     position: relative; |     position: fixed; | ||||||
|     top: 0; |     top: 0; | ||||||
|     left: 0; |     left: 0; | ||||||
|     margin-top: 0px; |     margin-top: 0px; | ||||||
|  | @ -25,7 +26,7 @@ | ||||||
|     width: 100vw; |     width: 100vw; | ||||||
|     overflow: scroll; |     overflow: scroll; | ||||||
|     margin: 0; |     margin: 0; | ||||||
|     padding: 0; |     padding: 7em 0 0 0 ; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   header li { |   header li { | ||||||
|  | @ -48,8 +49,8 @@ | ||||||
| 
 | 
 | ||||||
|   /* Left panel styles */ |   /* Left panel styles */ | ||||||
|   .left-panel { |   .left-panel { | ||||||
|     display: none; /* Initially hidden */ |     display: hidden; /* Initially hidden */ | ||||||
|     min-width: 90%; /* Takes full width when visible */ |     min-width: 100%; /* Takes full width when visible */ | ||||||
|     margin: 0; |     margin: 0; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | @ -59,8 +60,9 @@ | ||||||
| 
 | 
 | ||||||
|   /* Conversation container styles */ |   /* Conversation container styles */ | ||||||
|   .conversation-container { |   .conversation-container { | ||||||
|     width: 90%; |     min-width: 100%; | ||||||
|     height: 90%; |     height: 100%; | ||||||
|  |     border-radius: 0; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   .conversation-container.collapsed { |   .conversation-container.collapsed { | ||||||
|  | @ -68,10 +70,13 @@ | ||||||
|     padding: 0; |     padding: 0; | ||||||
|     border: none; |     border: none; | ||||||
|     overflow: hidden; |     overflow: hidden; | ||||||
|  |     display: hidden; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   .conversation-container.expanded { |   .conversation-container.expanded { | ||||||
|     width: 100%; |     min-width: 100%; | ||||||
|  |     margin-left: 0; | ||||||
|  |     border-radius: none; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /* Grid styles */ |   /* Grid styles */ | ||||||
|  |  | ||||||
							
								
								
									
										35
									
								
								py/api.py
									
										
									
									
									
								
							
							
						
						
									
										35
									
								
								py/api.py
									
										
									
									
									
								
							|  | @ -4,7 +4,6 @@ import secrets | ||||||
| import threading | import threading | ||||||
| from ai import AI | from ai import AI | ||||||
| from db import DB | from db import DB | ||||||
| from OpenSSL import crypto |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class API: | class API: | ||||||
|  | @ -86,40 +85,6 @@ class API: | ||||||
|             elif action == "check_credentials": |             elif action == "check_credentials": | ||||||
|                 self.db.check_credentials(data) |                 self.db.check_credentials(data) | ||||||
| 
 | 
 | ||||||
|         email_address = "emailAddress" |  | ||||||
|         common_name = "commonName" |  | ||||||
|         country_name = "NT" |  | ||||||
|         locality_name = "localityName" |  | ||||||
|         state_or_province_name = "stateOrProvinceName" |  | ||||||
|         organization_name = "organizationName" |  | ||||||
|         organization_unit_name = "organizationUnitName" |  | ||||||
|         serial_number = 0 |  | ||||||
|         validity_start_in_seconds = 0 |  | ||||||
|         validity_end_in_seconds = 10 * 365 * 24 * 60 * 60 |  | ||||||
|         k = crypto.PKey() |  | ||||||
|         k.generate_key(crypto.TYPE_RSA, 4096) |  | ||||||
|         cert = crypto.X509() |  | ||||||
|         cert.get_subject().C = country_name |  | ||||||
|         cert.get_subject().ST = state_or_province_name |  | ||||||
|         cert.get_subject().L = locality_name |  | ||||||
|         cert.get_subject().O = organization_name |  | ||||||
|         cert.get_subject().OU = organization_unit_name |  | ||||||
|         cert.get_subject().CN = common_name |  | ||||||
|         cert.get_subject().emailAddress = email_address |  | ||||||
|         cert.set_serial_number(serial_number) |  | ||||||
|         cert.gmtime_adj_notBefore(validity_start_in_seconds) |  | ||||||
|         cert.gmtime_adj_notAfter(validity_end_in_seconds) |  | ||||||
|         cert.set_issuer(cert.get_subject()) |  | ||||||
|         cert.set_pubkey(k) |  | ||||||
|         cert.sign(k, 'sha512') |  | ||||||
| 
 |  | ||||||
|         with open("cert.pem", "wt") as f: |  | ||||||
|             f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode("utf-8")) |  | ||||||
| 
 |  | ||||||
|         with open("key.pem", "wt") as f: |  | ||||||
|             f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, k).decode("utf-8")) |  | ||||||
| 
 |  | ||||||
|         ssl_context = ("cert.pem", "key.pem") |  | ||||||
|         self.app.run(debug=True, host='0.0.0.0', port=5000) |         self.app.run(debug=True, host='0.0.0.0', port=5000) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,3 +5,7 @@ mistralai | ||||||
| openai | openai | ||||||
| anthropic | anthropic | ||||||
| pyOpenSSL | pyOpenSSL | ||||||
|  | SpeechRecognition | ||||||
|  | PocketSphinx | ||||||
|  | google-cloud-speech | ||||||
|  | google-generativeai | ||||||
							
								
								
									
										11
									
								
								py/voice.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								py/voice.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | import speech_recognition as sr | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class VoiceRecognition: | ||||||
|  |     @staticmethod | ||||||
|  |     def basic_recognition(audio, option): | ||||||
|  |         r = sr.Recognizer() | ||||||
|  |         if option == "online": | ||||||
|  |             return r.recognize_google_cloud(audio) | ||||||
|  |         if option == "offline": | ||||||
|  |             return r.recognize_sphinx(audio) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue