Space-Face commited on
Commit
271c54a
1 Parent(s): 4ce9873

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -3
main.py CHANGED
@@ -1,6 +1,12 @@
1
  import SpaceFace as sf
2
- class GreetingEndpoint:
 
3
  def receivedMessage(self, message, user: sf.User, responder: sf.Responder):
4
- responder.respond(f"Hello {user.name}, you told me \"{message}\"")
 
 
 
 
 
5
  responder.close()
6
- sf.start_server([GreetingEndpoint()])
 
1
  import SpaceFace as sf
2
+ import GPTSimple as ai
3
+ class AIEndpoint:
4
  def receivedMessage(self, message, user: sf.User, responder: sf.Responder):
5
+ if hasattr(user, 'chat'):
6
+
7
+ responder.respond(user.chat.ask(message))
8
+ else:
9
+ chat = ai.conversation(base_url="deepinfra", model="meta-llama/Llama-3.2-90B-Vision-Instruct")
10
+ responder.respond(user.chat.ask(message))
11
  responder.close()
12
+ sf.start_server([AIEndpoint()])