diff --git a/packages/python-packages/apiview-gpt/app.py b/packages/python-packages/apiview-gpt/app.py index e67930b0c..6ff08f545 100644 --- a/packages/python-packages/apiview-gpt/app.py +++ b/packages/python-packages/apiview-gpt/app.py @@ -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) diff --git a/packages/python-packages/apiview-gpt/src/__init__.py b/packages/python-packages/apiview-gpt/src/__init__.py index caf953736..312f8591f 100644 --- a/packages/python-packages/apiview-gpt/src/__init__.py +++ b/packages/python-packages/apiview-gpt/src/__init__.py @@ -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 diff --git a/packages/python-packages/apiview-gpt/src/_android_api.py b/packages/python-packages/apiview-gpt/src/_android_api.py new file mode 100644 index 000000000..49b5e64ac --- /dev/null +++ b/packages/python-packages/apiview-gpt/src/_android_api.py @@ -0,0 +1,6 @@ +from ._gpt_reviewer import GptReviewer + +def review_android(code): + reviewer = GptReviewer() + result = reviewer.get_response(code, "android") + return result.json() diff --git a/packages/python-packages/apiview-gpt/src/_js_api.py b/packages/python-packages/apiview-gpt/src/_clang_api.py similarity index 55% rename from packages/python-packages/apiview-gpt/src/_js_api.py rename to packages/python-packages/apiview-gpt/src/_clang_api.py index cb7e88b92..11652d4bd 100644 --- a/packages/python-packages/apiview-gpt/src/_js_api.py +++ b/packages/python-packages/apiview-gpt/src/_clang_api.py @@ -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() diff --git a/packages/python-packages/apiview-gpt/src/_net_api.py b/packages/python-packages/apiview-gpt/src/_dotnet_api.py similarity index 54% rename from packages/python-packages/apiview-gpt/src/_net_api.py rename to packages/python-packages/apiview-gpt/src/_dotnet_api.py index 68a5108f4..0ef8b63fb 100644 --- a/packages/python-packages/apiview-gpt/src/_net_api.py +++ b/packages/python-packages/apiview-gpt/src/_dotnet_api.py @@ -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() diff --git a/packages/python-packages/apiview-gpt/src/_golang_api.py b/packages/python-packages/apiview-gpt/src/_golang_api.py new file mode 100644 index 000000000..ee0bbeae2 --- /dev/null +++ b/packages/python-packages/apiview-gpt/src/_golang_api.py @@ -0,0 +1,6 @@ +from ._gpt_reviewer import GptReviewer + +def review_golang(code): + reviewer = GptReviewer() + result = reviewer.get_response(code, "golang") + return result.json() diff --git a/packages/python-packages/apiview-gpt/src/_c_api.py b/packages/python-packages/apiview-gpt/src/_ios_api.py similarity index 56% rename from packages/python-packages/apiview-gpt/src/_c_api.py rename to packages/python-packages/apiview-gpt/src/_ios_api.py index 5f84a12b2..2faf59472 100644 --- a/packages/python-packages/apiview-gpt/src/_c_api.py +++ b/packages/python-packages/apiview-gpt/src/_ios_api.py @@ -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() diff --git a/packages/python-packages/apiview-gpt/src/_go_api.py b/packages/python-packages/apiview-gpt/src/_rest_api.py similarity index 56% rename from packages/python-packages/apiview-gpt/src/_go_api.py rename to packages/python-packages/apiview-gpt/src/_rest_api.py index 85aa1e645..caf7471a8 100644 --- a/packages/python-packages/apiview-gpt/src/_go_api.py +++ b/packages/python-packages/apiview-gpt/src/_rest_api.py @@ -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() diff --git a/packages/python-packages/apiview-gpt/src/_swift_api.py b/packages/python-packages/apiview-gpt/src/_swift_api.py deleted file mode 100644 index aa2ecb156..000000000 --- a/packages/python-packages/apiview-gpt/src/_swift_api.py +++ /dev/null @@ -1,6 +0,0 @@ -from ._gpt_reviewer import GptReviewer - -def review_swift(code): - reviewer = GptReviewer() - result = reviewer.get_response(code, "swift") - return result.json() diff --git a/packages/python-packages/apiview-gpt/src/_typescript_api.py b/packages/python-packages/apiview-gpt/src/_typescript_api.py new file mode 100644 index 000000000..8f6941f25 --- /dev/null +++ b/packages/python-packages/apiview-gpt/src/_typescript_api.py @@ -0,0 +1,6 @@ +from ._gpt_reviewer import GptReviewer + +def review_typescript(code): + reviewer = GptReviewer() + result = reviewer.get_response(code, "typescript") + return result.json() diff --git a/packages/python-packages/apiview-gpt/src/_typespec_api.py b/packages/python-packages/apiview-gpt/src/_typespec_api.py deleted file mode 100644 index 19630c4c3..000000000 --- a/packages/python-packages/apiview-gpt/src/_typespec_api.py +++ /dev/null @@ -1,6 +0,0 @@ -from ._gpt_reviewer import GptReviewer - -def review_typespec(code): - reviewer = GptReviewer() - result = reviewer.get_response(code, "typespec") - return result.json()