MaxKB/apps/local_model/views/model_apply.py
2025-11-05 19:05:26 +08:00

35 lines
1018 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: MaxKB
@Author
@file model_apply.py
@date2024/8/20 20:38
@desc:
"""
from urllib.request import Request
from rest_framework.views import APIView
from common.result import result
from local_model.serializers.model_apply_serializers import ModelApplySerializers
class LocalModelApply(APIView):
class EmbedDocuments(APIView):
def post(self, request: Request, model_id):
return result.success(
ModelApplySerializers(data={'model_id': model_id}).embed_documents(request.data))
class EmbedQuery(APIView):
def post(self, request: Request, model_id):
return result.success(
ModelApplySerializers(data={'model_id': model_id}).embed_query(request.data))
class CompressDocuments(APIView):
def post(self, request: Request, model_id):
return result.success(
ModelApplySerializers(data={'model_id': model_id}).compress_documents(request.data))