Compare commits

...

3 Commits

Author SHA1 Message Date
f85cf254ca 更新 index.html 2023-12-10 16:51:02 +08:00
b25e598f39 添加了启动与停止脚本 2023-12-10 16:43:45 +08:00
e00a704a56 更改项目文件夹结构 2023-12-10 16:31:50 +08:00
26 changed files with 43 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/__pycache__
*.json

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
static/img/bg_boobs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
static/img/bg_circles.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
static/img/bg_cross.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
static/img/bg_diag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
static/img/bg_fuzzy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
static/img/bg_life.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
static/img/bg_yourls.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

18
stop.sh Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -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'