Compare commits
3 Commits
8d9bd619c4
...
f85cf254ca
Author | SHA1 | Date | |
---|---|---|---|
f85cf254ca | |||
b25e598f39 | |||
e00a704a56 |
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
|
||||
/__pycache__
|
||||
*.json
|
||||
|
BIN
apiModule/__pycache__/chatglmTurbo.cpython-311.pyc
Normal file
BIN
apiModule/__pycache__/gpt35Turbo.cpython-311.pyc
Normal file
BIN
apiModule/__pycache__/gpt4Turbo.cpython-311.pyc
Normal file
BIN
apiModule/__pycache__/qwenTurbo.cpython-311.pyc
Normal file
@ -1,9 +1,7 @@
|
||||
import flask , requests , json
|
||||
import flask
|
||||
from flask_cors import CORS
|
||||
import db , qwenTurbo , chatglmTurbo , gpt35Turbo , gpt4Turbo
|
||||
|
||||
|
||||
|
||||
import db , config
|
||||
from apiModule import qwenTurbo , chatglmTurbo , gpt35Turbo , gpt4Turbo
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
CORS(app,origins="*")
|
||||
@ -48,13 +46,13 @@ def post_data():
|
||||
elif userRequest["context"] == 0:
|
||||
code , output , tokenUsed = gpt4Turbo.service(userRequest['prompt'])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
db.reduce_value(userRequest['userkey'], tokenUsed)
|
||||
return {"code":code,"output":output,"surplus":surplusToken}
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return flask.render_template('index.html')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True,host='0.0.0.0',port=5000)
|
||||
app.run(debug=bool(config.readConf()["appconf"]["debug"]),host=config.readConf()["appconf"]["host"],port=config.readConf()["appconf"]["port"])
|
12
start.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 定义要运行的Python文件
|
||||
PYTHON_APP="main.py"
|
||||
|
||||
# 使用nohup命令启动Python程序,并将其输出重定向到日志文件
|
||||
nohup python3 $PYTHON_APP > output.log 2>&1 &
|
||||
|
||||
# 打印消息,通知用户程序已启动
|
||||
echo "Python application started!"
|
||||
|
||||
# 可以添加任何其他需要的启动逻辑
|
BIN
static/img/bg_ants.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
static/img/bg_boobs.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
static/img/bg_circles.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
static/img/bg_cross.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
static/img/bg_diag.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
static/img/bg_fuzzy.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
static/img/bg_fuzzy_bits.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
static/img/bg_life.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
static/img/bg_yourls.png
Normal file
After Width: | Height: | Size: 13 KiB |
18
stop.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 定义要停止的Python文件
|
||||
PYTHON_APP="main.py"
|
||||
|
||||
# 使用ps命令查找Python进程,并使用grep过滤出要停止的进程
|
||||
PID=$(ps -ef | grep $PYTHON_APP | grep -v grep | awk '{print $2}')
|
||||
|
||||
# 检查是否找到了进程
|
||||
if [ -z "$PID" ]; then
|
||||
echo "Python application is not running!"
|
||||
else
|
||||
# 使用kill命令停止进程
|
||||
kill $PID
|
||||
echo "Python application stopped!"
|
||||
fi
|
||||
|
||||
# 可以添加任何其他需要的停止逻辑
|
BIN
templates/favicon.ico
Normal file
After Width: | Height: | Size: 9.4 KiB |
@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>KakuAI</title>
|
||||
<link rel="stylesheet" type="text/css" href="popup.css">
|
||||
<link rel="stylesheet" type="text/css" href="../static/popup.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
@ -15,7 +15,7 @@
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background-image: url("img/bg_circles.png");
|
||||
background-image: url("../static/img/bg_circles.png");
|
||||
background-repeat: repeat;
|
||||
}
|
||||
#chat-container {
|
||||
@ -215,7 +215,7 @@
|
||||
function checkCookie() {
|
||||
var user = getCookie("userkey");
|
||||
if (user != "") {
|
||||
alert("欢迎回来 UserKey:" + user);
|
||||
alert("欢迎回来 UserKey:" + user +"\n当前选择模型:" + getCookie("modelSet"));
|
||||
document.getElementById("showUserKey").innerHTML = user;
|
||||
document.getElementById('setUpDropdown').value = getCookie("modelSet");
|
||||
}
|
||||
@ -257,7 +257,7 @@
|
||||
};
|
||||
|
||||
|
||||
fetch("http://chat.kakuweb.top:5000/api/user", {
|
||||
fetch("api/user", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|