Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,11 @@ import requests
|
|
| 6 |
import json
|
| 7 |
import openai
|
| 8 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
class Text(BaseModel):
|
|
@@ -197,15 +202,19 @@ def create_image_ep(content: Text = None):
|
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
-
from fastapi import FastAPI, Request, Response
|
| 201 |
-
from fastapi.responses import PlainTextResponse
|
| 202 |
-
from hashlib import sha1
|
| 203 |
-
from time import time
|
| 204 |
-
from xml.etree.ElementTree import Element, tostring
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
def chat_gpt_response(prompt):
|
| 210 |
# Replace with your GPT-3.5 implementation
|
| 211 |
return "你好呀,小哥哥"
|
|
@@ -256,11 +265,5 @@ def process_message(request: Request):
|
|
| 256 |
return Response(content=response_xml, media_type='application/xml')
|
| 257 |
|
| 258 |
|
| 259 |
-
def check_signature(token, signature, timestamp, nonce):
|
| 260 |
-
tmp_list = [token, timestamp, nonce]
|
| 261 |
-
tmp_list.sort()
|
| 262 |
-
tmp_str = ''.join(tmp_list)
|
| 263 |
-
tmp_str = sha1(tmp_str.encode('utf-8')).hexdigest()
|
| 264 |
|
| 265 |
-
return tmp_str == signature
|
| 266 |
|
|
|
|
| 6 |
import json
|
| 7 |
import openai
|
| 8 |
import time
|
| 9 |
+
from fastapi import FastAPI, Request, Response
|
| 10 |
+
from fastapi.responses import PlainTextResponse
|
| 11 |
+
from hashlib import sha1
|
| 12 |
+
from time import time
|
| 13 |
+
from xml.etree.ElementTree import Element, tostring
|
| 14 |
|
| 15 |
|
| 16 |
class Text(BaseModel):
|
|
|
|
| 202 |
|
| 203 |
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
+
|
| 210 |
+
def check_signature(token, signature, timestamp, nonce):
|
| 211 |
+
tmp_list = [token, timestamp, nonce]
|
| 212 |
+
tmp_list.sort()
|
| 213 |
+
tmp_str = ''.join(tmp_list)
|
| 214 |
+
tmp_str = sha1(tmp_str.encode('utf-8')).hexdigest()
|
| 215 |
+
|
| 216 |
+
return tmp_str == signature
|
| 217 |
+
|
| 218 |
def chat_gpt_response(prompt):
|
| 219 |
# Replace with your GPT-3.5 implementation
|
| 220 |
return "你好呀,小哥哥"
|
|
|
|
| 265 |
return Response(content=response_xml, media_type='application/xml')
|
| 266 |
|
| 267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
|
|
|
| 269 |
|