Skip to content

Commit 8061d16

Browse files
authored
Merge pull request #72 from dlimeng/dev
model python web_utils
2 parents fbec1ae + a37e3db commit 8061d16

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

solidui-dao/src/main/java/com/cloudorc/solidui/dao/entity/DataSourceTypeKey.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public enum Scope {
7979
@TableId(value = "id", type = IdType.AUTO)
8080
private Long id;
8181

82+
@TableId(value = "datasource_type_id")
83+
private Long dataSourceTypeId;
84+
8285
/** Key name */
8386
private String key;
8487

@@ -92,7 +95,6 @@ public enum Scope {
9295

9396
private String nameEn;
9497

95-
9698
/** Default value */
9799
private String defaultValue;
98100

@@ -105,8 +107,6 @@ public enum Scope {
105107
/** Value regex */
106108
private String valueRegex;
107109

108-
109-
110110
public Long getId() {
111111
return id;
112112
}
@@ -195,6 +195,14 @@ public void setNameEn(String nameEn) {
195195
this.nameEn = nameEn;
196196
}
197197

198+
public Long getDataSourceTypeId() {
199+
return dataSourceTypeId;
200+
}
201+
202+
public void setDataSourceTypeId(Long dataSourceTypeId) {
203+
this.dataSourceTypeId = dataSourceTypeId;
204+
}
205+
198206
@Override
199207
public boolean equals(Object o) {
200208
if (this == o) {

soliduimodelui/kernelprogram/main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
cli.show_server_banner = lambda *x: None
6161

6262
app = Flask(__name__)
63-
app.register_blueprint(base_blueprint)
63+
6464
CORS(app)
6565

6666
def start_kernel_manager():
@@ -153,6 +153,8 @@ def handle_restart():
153153
return jsonify({"result": "success"})
154154

155155

156+
app.register_blueprint(base_blueprint)
157+
156158
async def main():
157159
start_kernel_manager()
158160

@@ -170,6 +172,3 @@ def run_flask_app():
170172
if __name__ == "__main__":
171173
asyncio.run(main())
172174

173-
174-
175-

soliduimodelui/kernelprogram/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ def init_snakemq(ident, init_type="listen"):
4040
link.add_connector(("localhost", config.SNAKEMQ_PORT))
4141
else:
4242
raise Exception("Unsupported init type.")
43-
return messaging, link
43+
return messaging, link
44+

soliduimodelui/webapp/main.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
from flask_cors import CORS
2727
from flask import Flask, request, jsonify, send_from_directory, Response, Blueprint
2828
from dotenv import load_dotenv
29-
29+
import soliduimodelui.webapp.web_utils as web_utils
30+
# from langchain.prompts import PromptTemplate
31+
# from langchain.llms import OpenAI
32+
# from langchain.chains import LLMChain
3033

3134
load_dotenv('.env')
3235

@@ -42,10 +45,21 @@
4245
cli.show_server_banner = lambda *x: None
4346

4447
app = Flask(__name__)
45-
app.register_blueprint(base_blueprint)
4648
CORS(app)
4749

4850

51+
async def get_code(user_prompt, user_key=None, model="gpt-3.5-turbo", type=0):
52+
return 0
53+
54+
@base_blueprint.route('/api/<path:path>', methods=["GET", "POST"])
55+
def proxy_kernel_manager(path):
56+
return web_utils.response_format()
57+
58+
@base_blueprint.route('/generate', methods=['POST'])
59+
def generate_code():
60+
return web_utils.response_format()
61+
62+
app.register_blueprint(base_blueprint)
4963

5064
if __name__ == '__main__':
5165
app.run(host="0.0.0.0", port=APP_PORT, debug=True, use_reloader=False)

soliduimodelui/webapp/web_utils.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
def response_format(code=0,msg="success",data={},success=True,failed=False):
16+
return {
17+
"code": code,
18+
"msg": msg,
19+
"data": data,
20+
"success": success,
21+
"failed": failed
22+
}

0 commit comments

Comments
 (0)