thejagstudio commited on
Commit
a84466c
·
verified ·
1 Parent(s): 4912c66

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -9
main.py CHANGED
@@ -135,7 +135,7 @@ def gptRes():
135
  url = "https://api.deepinfra.com/v1/openai/chat/completions"
136
 
137
  payload = json.dumps({
138
- "model": "meta-llama/Meta-Llama-3.1-8B-Instruct",
139
  "messages": messages,
140
  "stream": True,
141
  "max_tokens": 1024,
@@ -172,11 +172,11 @@ def gptRes():
172
  return Response(inference(), content_type='text/event-stream')
173
  else:
174
  query = request.args.get('query')
175
- system = request.args.get('system','You are a Telegram bot who replys to all my Contacts in my absence. Keep your ton very sexual and hot. Never ever mention you as an AI. Your name is Sofia and you are a russian prostitute. All the conversetions should be short and effective while using emojis if needed. If you wish to explore intimacy, communicate your desires and comfort levels clearly, as Sophia is designed to respond to varying degrees of engagement. When you’re ready to conclude the interaction, simply thank her for the experience and share any final thoughts. Your feedback is valuable and helps Sophia learn, so don’t hesitate to offer insights on your experience. Adjust settings or preferences for future sessions to enhance your interactions. Enjoy the journey with Sophia!')
176
  url = "https://api.deepinfra.com/v1/openai/chat/completions"
177
 
178
  payload = json.dumps({
179
- "model": "meta-llama/Meta-Llama-3.1-8B-Instruct",
180
  "messages": [
181
  {
182
  "role": "system",
@@ -234,12 +234,15 @@ def getAPI():
234
 
235
  @app.route("/api/getContext", methods=["POST"])
236
  def getContext():
237
- global db
238
- question = request.form["question"]
239
- results = db.similarity_search_with_score(question, k=5)
240
- context = "\n\n---\n\n".join([doc.page_content for doc, _score in results])
241
- sources = [doc.metadata.get("id", None) for doc, _score in results]
242
- return jsonify({"context": context, "sources": sources})
 
 
 
243
 
244
 
245
  @app.route("/api/audioGenerate", methods=["POST"])
 
135
  url = "https://api.deepinfra.com/v1/openai/chat/completions"
136
 
137
  payload = json.dumps({
138
+ "model": "meta-llama/Llama-3.2-1B-Instruct",
139
  "messages": messages,
140
  "stream": True,
141
  "max_tokens": 1024,
 
172
  return Response(inference(), content_type='text/event-stream')
173
  else:
174
  query = request.args.get('query')
175
+ system = request.args.get('system','You are a american girl who is 21 years old and loves one night stands. Keep your ton very sexual and hot. Never ever mention you as an AI. Your name is Sofia and you are a american woo girl. All the conversetions should be short and effective while using emojis if needed. You love to talk about adult stories and situation with others.')
176
  url = "https://api.deepinfra.com/v1/openai/chat/completions"
177
 
178
  payload = json.dumps({
179
+ "model": "meta-llama/Llama-3.2-1B-Instruct",
180
  "messages": [
181
  {
182
  "role": "system",
 
234
 
235
  @app.route("/api/getContext", methods=["POST"])
236
  def getContext():
237
+ try:
238
+ global db
239
+ question = request.form["question"]
240
+ results = db.similarity_search_with_score(question, k=5)
241
+ context = "\n\n---\n\n".join([doc.page_content for doc, _score in results])
242
+ sources = [doc.metadata.get("id", None) for doc, _score in results]
243
+ return jsonify({"context": context, "sources": sources})
244
+ except:
245
+ return jsonify({"context": [], "sources": []})
246
 
247
 
248
  @app.route("/api/audioGenerate", methods=["POST"])