1
0

初始化提交

This commit is contained in:
2025-02-09 22:58:24 +08:00
commit 745a433842
15 changed files with 3122 additions and 0 deletions

26
ai-server.py Normal file
View File

@@ -0,0 +1,26 @@
from flask import Flask, request
from zhipuai import ZhipuAI
app = Flask(__name__)
client = ZhipuAI(api_key="d1e97306540d12bb2f834be961fcacb1.SNBShlCxWYJCx0qZ")
@app.route('/ai_text', methods=['POST'])
def ai_text():
input = request.get_data(as_text=True)
# 如果input值为空则返回空字符串
if not input:
return ''
completion = client.chat.completions.create(
model="glm-4-flash",
messages=[
{"role": "user", "content": input},
],
)
return completion.choices[0].message.content
# app.run(host='0.0.0.0', port=6721)
from waitress import serve
serve(app, host='0.0.0.0', port=6721)