Update lang names (#6922)
* add endpoints for other languages * added more languages * update names * rename langs
This commit is contained in:
Родитель
1d90c40a6d
Коммит
9e3e1ddbb0
|
@ -1,5 +1,16 @@
|
|||
from flask import Flask, request, jsonify
|
||||
from src import review_python, review_java, review_cpp, review_go, review_js, review_net, review_c, review_swift, review_typespec
|
||||
from src import (
|
||||
review_python,
|
||||
review_java,
|
||||
review_cpp,
|
||||
review_golang,
|
||||
review_typescript,
|
||||
review_dotnet,
|
||||
review_clang,
|
||||
review_ios,
|
||||
review_rest,
|
||||
review_android,
|
||||
)
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
@ -17,18 +28,18 @@ def java_api_reviewer():
|
|||
result = review_java(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/js', methods=['POST'])
|
||||
def js_api_reviewer():
|
||||
@app.route('/typescript', methods=['POST'])
|
||||
def typescript_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_js(content)
|
||||
result = review_typescript(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/net', methods=['POST'])
|
||||
def net_api_reviewer():
|
||||
@app.route('/dotnet', methods=['POST'])
|
||||
def dotnet_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_net(content)
|
||||
result = review_dotnet(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/cpp', methods=['POST'])
|
||||
|
@ -38,30 +49,37 @@ def cpp_api_reviewer():
|
|||
result = review_cpp(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/go', methods=['POST'])
|
||||
def go_api_reviewer():
|
||||
@app.route('/golang', methods=['POST'])
|
||||
def golang_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_go(content)
|
||||
result = review_golang(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/c', methods=['POST'])
|
||||
def c_api_reviewer():
|
||||
@app.route('/clang', methods=['POST'])
|
||||
def clang_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_c(content)
|
||||
result = review_clang(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/swift', methods=['POST'])
|
||||
def swift_api_reviewer():
|
||||
@app.route('/ios', methods=['POST'])
|
||||
def ios_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_swift(content)
|
||||
result = review_ios(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/typespec', methods=['POST'])
|
||||
def typespec_api_reviewer():
|
||||
@app.route('/rest', methods=['POST'])
|
||||
def rest_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_typespec(content)
|
||||
result = review_rest(content)
|
||||
return jsonify(result)
|
||||
|
||||
@app.route('/android', methods=['POST'])
|
||||
def android_api_reviewer():
|
||||
data = request.get_json()
|
||||
content = data['content']
|
||||
result = review_android(content)
|
||||
return jsonify(result)
|
||||
|
|
|
@ -5,13 +5,14 @@ from ._version import VERSION
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
from ._python_api import review_python
|
||||
from ._java_api import review_java
|
||||
from ._js_api import review_js
|
||||
from ._net_api import review_net
|
||||
from ._typescript_api import review_typescript
|
||||
from ._dotnet_api import review_dotnet
|
||||
from ._cpp_api import review_cpp
|
||||
from ._go_api import review_go
|
||||
from ._c_api import review_c
|
||||
from ._swift_api import review_swift
|
||||
from ._typespec_api import review_typespec
|
||||
from ._golang_api import review_golang
|
||||
from ._clang_api import review_clang
|
||||
from ._ios_api import review_ios
|
||||
from ._rest_api import review_rest
|
||||
from ._android_api import review_android
|
||||
from ._vector_db import VectorDB
|
||||
from ._models import GuidelinesResult, Violation, VectorDocument, VectorSearchResult
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_android(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "android")
|
||||
return result.json()
|
|
@ -1,6 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_js(code):
|
||||
def review_clang(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "js")
|
||||
result = reviewer.get_response(code, "clang")
|
||||
return result.json()
|
|
@ -1,6 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_net(code):
|
||||
def review_dotnet(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "c#")
|
||||
result = reviewer.get_response(code, "dotnet")
|
||||
return result.json()
|
|
@ -0,0 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_golang(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "golang")
|
||||
return result.json()
|
|
@ -1,6 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_c(code):
|
||||
def review_ios(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "c")
|
||||
result = reviewer.get_response(code, "ios")
|
||||
return result.json()
|
|
@ -1,6 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_go(code):
|
||||
def review_rest(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "go")
|
||||
result = reviewer.get_response(code, "rest")
|
||||
return result.json()
|
|
@ -1,6 +0,0 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_swift(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "swift")
|
||||
return result.json()
|
|
@ -0,0 +1,6 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_typescript(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "typescript")
|
||||
return result.json()
|
|
@ -1,6 +0,0 @@
|
|||
from ._gpt_reviewer import GptReviewer
|
||||
|
||||
def review_typespec(code):
|
||||
reviewer = GptReviewer()
|
||||
result = reviewer.get_response(code, "typespec")
|
||||
return result.json()
|
Загрузка…
Ссылка в новой задаче