Skip to content

Commit

Permalink
ignore type check warning
Browse files Browse the repository at this point in the history
  • Loading branch information
isthaison committed Nov 25, 2024
1 parent f4e8e08 commit f4c292a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
22 changes: 11 additions & 11 deletions api/apps/conversation_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from graphrag.mind_map_extractor import MindMapExtractor


@manager.route('/set', methods=['POST'])
@manager.route('/set', methods=['POST']) # type: ignore
@login_required
def set_conversation():
req = request.json
Expand Down Expand Up @@ -72,7 +72,7 @@ def set_conversation():
return server_error_response(e)


@manager.route('/get', methods=['GET'])
@manager.route('/get', methods=['GET']) # type: ignore
@login_required
def get():
conv_id = request.args["conversation_id"]
Expand All @@ -94,7 +94,7 @@ def get():
return server_error_response(e)


@manager.route('/rm', methods=['POST'])
@manager.route('/rm', methods=['POST'])# type: ignore
@login_required
def rm():
conv_ids = request.json["conversation_ids"]
Expand All @@ -117,7 +117,7 @@ def rm():
return server_error_response(e)


@manager.route('/list', methods=['GET'])
@manager.route('/list', methods=['GET'])# type: ignore
@login_required
def list_convsersation():
dialog_id = request.args["dialog_id"]
Expand All @@ -136,7 +136,7 @@ def list_convsersation():
return server_error_response(e)


@manager.route('/completion', methods=['POST'])
@manager.route('/completion', methods=['POST'])# type: ignore
@login_required
@validate_request("conversation_id", "messages")
def completion():
Expand Down Expand Up @@ -209,7 +209,7 @@ def stream():
return server_error_response(e)


@manager.route('/tts', methods=['POST'])
@manager.route('/tts', methods=['POST'])# type: ignore
@login_required
def tts():
req = request.json
Expand Down Expand Up @@ -243,7 +243,7 @@ def stream_audio():
return resp


@manager.route('/delete_msg', methods=['POST'])
@manager.route('/delete_msg', methods=['POST'])# type: ignore
@login_required
@validate_request("conversation_id", "message_id")
def delete_msg():
Expand All @@ -266,7 +266,7 @@ def delete_msg():
return get_json_result(data=conv)


@manager.route('/thumbup', methods=['POST'])
@manager.route('/thumbup', methods=['POST'])# type: ignore
@login_required
@validate_request("conversation_id", "message_id")
def thumbup():
Expand All @@ -291,7 +291,7 @@ def thumbup():
return get_json_result(data=conv)


@manager.route('/ask', methods=['POST'])
@manager.route('/ask', methods=['POST'])# type: ignore
@login_required
@validate_request("question", "kb_ids")
def ask_about():
Expand All @@ -317,7 +317,7 @@ def stream():
return resp


@manager.route('/mindmap', methods=['POST'])
@manager.route('/mindmap', methods=['POST'])# type: ignore
@login_required
@validate_request("question", "kb_ids")
def mindmap():
Expand All @@ -339,7 +339,7 @@ def mindmap():
return get_json_result(data=mind_map)


@manager.route('/related_questions', methods=['POST'])
@manager.route('/related_questions', methods=['POST'])# type: ignore
@login_required
@validate_request("question")
def related_questions():
Expand Down
6 changes: 3 additions & 3 deletions api/apps/sdk/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@



@manager.route('/chats', methods=['POST'])
@manager.route('/chats', methods=['POST']) # type: ignore
@token_required
def create(tenant_id):
req=request.json
Expand Down Expand Up @@ -235,7 +235,7 @@ def update(tenant_id,chat_id):
return get_result()


@manager.route('/chats', methods=['DELETE'])
@manager.route('/chats', methods=['DELETE']) # type: ignore
@token_required
def delete(tenant_id):
req = request.json
Expand All @@ -257,7 +257,7 @@ def delete(tenant_id):
DialogService.update_by_id(id, temp_dict)
return get_result()

@manager.route('/chats', methods=['GET'])
@manager.route('/chats', methods=['GET']) # type: ignore
@token_required
def list_chat(tenant_id):
id = request.args.get("id")
Expand Down
4 changes: 2 additions & 2 deletions api/apps/sdk/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)


@manager.route("/datasets", methods=["POST"])
@manager.route("/datasets", methods=["POST"]) # type: ignore
@token_required
def create(tenant_id):
"""
Expand Down Expand Up @@ -190,7 +190,7 @@ def create(tenant_id):
return get_result(data=renamed_data)


@manager.route("/datasets", methods=["DELETE"])
@manager.route("/datasets", methods=["DELETE"]) # type: ignore
@token_required
def delete(tenant_id):
"""
Expand Down
25 changes: 15 additions & 10 deletions api/apps/sdk/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging
import re
import json
from functools import partial
Expand All @@ -33,7 +34,7 @@
from api.db.services.llm_service import LLMBundle


@manager.route('/chats/<chat_id>/sessions', methods=['POST'])
@manager.route('/chats/<chat_id>/sessions', methods=['POST'])# type: ignore
@token_required
def create(tenant_id,chat_id):
req = request.json
Expand All @@ -60,7 +61,7 @@ def create(tenant_id,chat_id):
return get_result(data=conv)


@manager.route('/agents/<agent_id>/sessions', methods=['POST'])
@manager.route('/agents/<agent_id>/sessions', methods=['POST']) # type: ignore
@token_required
def create_agent_session(tenant_id, agent_id):
req = request.json
Expand All @@ -86,10 +87,14 @@ def create_agent_session(tenant_id, agent_id):
return get_result(data=conv)


@manager.route('/chats/<chat_id>/sessions/<session_id>', methods=['PUT'])
@manager.route('/chats/<chat_id>/sessions/<session_id>', methods=['PUT']) # type: ignore
@token_required
def update(tenant_id,chat_id,session_id):
req = request.json
logging.info(tenant_id)
logging.info(session_id)
logging.info(chat_id)
logging.info("json %s",req["name"])
req["dialog_id"] = chat_id
conv_id = session_id
conv = ConversationService.query(id=conv_id,dialog_id=chat_id)
Expand All @@ -108,7 +113,7 @@ def update(tenant_id,chat_id,session_id):
return get_result()


@manager.route('/chats/<chat_id>/completions', methods=['POST'])
@manager.route('/chats/<chat_id>/completions', methods=['POST']) # type: ignore
@token_required
def completion(tenant_id, chat_id):
req = request.json
Expand All @@ -117,7 +122,7 @@ def completion(tenant_id, chat_id):
"id": get_uuid(),
"dialog_id": chat_id,
"name": req.get("name", "New session"),
"message": [{"role": "assistant", "content": "Hi! I am your assistantcan I help you?"}]
"message": [{"role": "assistant", "content": "Hi! I am your assistant, can I help you?"}]
}
if not conv.get("name"):
return get_error_data_result(message="`name` can not be empty.")
Expand Down Expand Up @@ -215,7 +220,7 @@ def stream():
return get_result(data=answer)


@manager.route('/agents/<agent_id>/completions', methods=['POST'])
@manager.route('/agents/<agent_id>/completions', methods=['POST']) # type: ignore
@token_required
def agent_completion(tenant_id, agent_id):
req = request.json
Expand Down Expand Up @@ -373,7 +378,7 @@ def sse():
return get_result(data=result)


@manager.route('/chats/<chat_id>/sessions', methods=['GET'])
@manager.route('/chats/<chat_id>/sessions', methods=['GET']) # type: ignore
@token_required
def list_session(chat_id,tenant_id):
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
Expand Down Expand Up @@ -427,7 +432,7 @@ def list_session(chat_id,tenant_id):
return get_result(data=convs)


@manager.route('/chats/<chat_id>/sessions', methods=["DELETE"])
@manager.route('/chats/<chat_id>/sessions', methods=["DELETE"]) # type: ignore
@token_required
def delete(tenant_id,chat_id):
if not DialogService.query(id=chat_id, tenant_id=tenant_id, status=StatusEnum.VALID.value):
Expand All @@ -452,7 +457,7 @@ def delete(tenant_id,chat_id):
ConversationService.delete_by_id(id)
return get_result()

@manager.route('/sessions/ask', methods=['POST'])
@manager.route('/sessions/ask', methods=['POST']) # type: ignore
@token_required
def ask_about(tenant_id):
req = request.json
Expand Down Expand Up @@ -490,7 +495,7 @@ def stream():
return resp


@manager.route('/sessions/related_questions', methods=['POST'])
@manager.route('/sessions/related_questions', methods=['POST']) # type: ignore
@token_required
def related_questions(tenant_id):
req = request.json
Expand Down

0 comments on commit f4c292a

Please sign in to comment.