Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以增加https://meta.law/ #3

Open
yuanjie-ai opened this issue Apr 15, 2024 · 3 comments
Open

可以增加https://meta.law/ #3

yuanjie-ai opened this issue Apr 15, 2024 · 3 comments

Comments

@yuanjie-ai
Copy link

https://meta.law/

@yuanjie-ai
Copy link
Author

逆向逻辑差不多


def func_o(query: str, stream: bool):
    url_o = "https://meta.law/api"
    session = '8463032724927483904'
    currentKey = get(f'{url_o}/case-session/{session}').json().get('data').get('store').get('currentKey')
    sessionID = get(f'{url_o}/case-session/{session}').json().get('data').get('store').get('sessionId')
    url_cases = "https://meta.law/api/case-search-beta"
    payload_cases = {'baseFacts': '',
         'baseFocus': query,
         'pageIndex': 1,
         'pageSize': 50,
         'level': 'root',
         'sessionId': sessionID,
         'overwrite': False,
         'filter': {'timeRange': [],
                    'courtLevels': [],
                    'effectiveness': [],
                    'advanced': {'courtNames': [],
                                 'keywords': [],
                                 'instrumentTypes': [],
                                 'caseTypes': [],
                                 'causes': []},
                    'lawFilter': {'lawId': '', 'name': '', 'legalBasis': ''}},
         'debug': False}
    result_cases = post(url_cases, json=payload_cases)

    resultId = caseSearchBeta(**result_cases.json()).data.resultId
    url_analyze = 'https://meta.law/api/stream/generate/analyze'
    # 获取分析结果
    p = {
        'resultId': resultId,
        'key': currentKey
    }
    result_analyze = post(url_analyze, json=p)

    # cookies = {
    #     "sid": os.getenv('sid', "ada62ab7f8df4336a7083e6e79ad604b"),
    #     "uid": os.getenv('uid', "65d5b187c83352985741cbff"),
    # }
    # payload = {'question': query, 'mode': "detail"}
    # temp = requests.post('https://metaso.cn/api/session', headers=headers, cookies=cookies, json=payload).json()
    # payload.setdefault('sessionId', temp['data']['id'])
    #
    # # httpx
    # x = requests.post('https://metaso.cn/api/search', headers=headers, cookies=cookies, json=payload, stream=stream)
    if stream:
        timetime = int(time.time())
        for line in result_analyze.iter_lines():
            if line and line != b'data: [DONE]':
                d = json.loads(line.decode()[6:]) ################
                temp = MyChatCompletionChunk(**d)
                choice = Choice(delta=ChoiceDelta(content=temp.choices[0].delta.content, role='assistant'), index=0)
                ccc = ChatCompletionChunk(choices=[choice], id='xxxx', created=timetime, model='metalaw',
                                          object="chat.completion.chunk")
                # logger.debug(f'{ccc.model_dump()}')
                yield ccc.model_dump_json()

        yield '[DONE]'
    else:
        text = ''
        for line in result_analyze.iter_lines():
            if line and line != b'data: [DONE]':
                d = json.loads(line.decode()[6:])
                temp = MyChatCompletionChunk(**d)
                text += temp.choices[0].delta.content

        return text

@Vinlic
Copy link
Member

Vinlic commented Apr 15, 2024

@yuanjie-ai
这个是法律案例检索为主,law全网检索的部分和现有的秘塔搜索几乎没有差异,增加这个逆向有什么应用的价值吗?

@yuanjie-ai
Copy link
Author

@yuanjie-ai 这个是法律案例检索为主,law全网检索的部分和现有的秘塔搜索几乎没有差异,增加这个逆向有什么应用的价值吗?

垂类检索吧,哈哈 更完备点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants