Compare commits
No commits in common. "f85cf254cac357cf1f28311458362372055dde0f" and "8d9bd619c499c399537feeba4a06229783839f50" have entirely different histories.
f85cf254ca
...
8d9bd619c4
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
/__pycache__
|
|
||||||
*.json
|
*.json
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import flask
|
import flask , requests , json
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
import db , config
|
import db , qwenTurbo , chatglmTurbo , gpt35Turbo , gpt4Turbo
|
||||||
from apiModule import qwenTurbo , chatglmTurbo , gpt35Turbo , gpt4Turbo
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
CORS(app,origins="*")
|
CORS(app,origins="*")
|
||||||
@ -46,13 +48,13 @@ def post_data():
|
|||||||
elif userRequest["context"] == 0:
|
elif userRequest["context"] == 0:
|
||||||
code , output , tokenUsed = gpt4Turbo.service(userRequest['prompt'])
|
code , output , tokenUsed = gpt4Turbo.service(userRequest['prompt'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
db.reduce_value(userRequest['userkey'], tokenUsed)
|
db.reduce_value(userRequest['userkey'], tokenUsed)
|
||||||
return {"code":code,"output":output,"surplus":surplusToken}
|
return {"code":code,"output":output,"surplus":surplusToken}
|
||||||
|
|
||||||
@app.route('/')
|
|
||||||
def index():
|
|
||||||
return flask.render_template('index.html')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=bool(config.readConf()["appconf"]["debug"]),host=config.readConf()["appconf"]["host"],port=config.readConf()["appconf"]["port"])
|
app.run(debug=True,host='0.0.0.0',port=5000)
|
@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>KakuAI</title>
|
<title>KakuAI</title>
|
||||||
<link rel="stylesheet" type="text/css" href="../static/popup.css">
|
<link rel="stylesheet" type="text/css" href="popup.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
@ -15,7 +15,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-image: url("../static/img/bg_circles.png");
|
background-image: url("img/bg_circles.png");
|
||||||
background-repeat: repeat;
|
background-repeat: repeat;
|
||||||
}
|
}
|
||||||
#chat-container {
|
#chat-container {
|
||||||
@ -215,7 +215,7 @@
|
|||||||
function checkCookie() {
|
function checkCookie() {
|
||||||
var user = getCookie("userkey");
|
var user = getCookie("userkey");
|
||||||
if (user != "") {
|
if (user != "") {
|
||||||
alert("欢迎回来 UserKey:" + user +"\n当前选择模型:" + getCookie("modelSet"));
|
alert("欢迎回来 UserKey:" + user);
|
||||||
document.getElementById("showUserKey").innerHTML = user;
|
document.getElementById("showUserKey").innerHTML = user;
|
||||||
document.getElementById('setUpDropdown').value = getCookie("modelSet");
|
document.getElementById('setUpDropdown').value = getCookie("modelSet");
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
fetch("api/user", {
|
fetch("http://chat.kakuweb.top:5000/api/user", {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
12
start.sh
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 定义要运行的Python文件
|
|
||||||
PYTHON_APP="main.py"
|
|
||||||
|
|
||||||
# 使用nohup命令启动Python程序,并将其输出重定向到日志文件
|
|
||||||
nohup python3 $PYTHON_APP > output.log 2>&1 &
|
|
||||||
|
|
||||||
# 打印消息,通知用户程序已启动
|
|
||||||
echo "Python application started!"
|
|
||||||
|
|
||||||
# 可以添加任何其他需要的启动逻辑
|
|
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 13 KiB |
18
stop.sh
@ -1,18 +0,0 @@
|
|||||||
#!/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
|
|
||||||
|
|
||||||
# 可以添加任何其他需要的停止逻辑
|
|
Before Width: | Height: | Size: 9.4 KiB |