diff --git a/README.md b/README.md index a474105..8cd1113 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ pip install -r requirements.txt Setup FastAPI Server. ```bash -python -m mindsearch.app --lang en --model_format internlm_server --search_engine DuckDuckGoSearch +python -m mindsearch.app --lang en --model_format sensenova --search_engine DuckDuckGoSearch ``` - `--lang`: language of the model, `en` for English and `cn` for Chinese. diff --git a/frontend/React/vite.config.ts b/frontend/React/vite.config.ts index 5457d7c..f828930 100644 --- a/frontend/React/vite.config.ts +++ b/frontend/React/vite.config.ts @@ -53,10 +53,11 @@ export default defineConfig({ server: { port: 8080, proxy: { - // "/solve": { - // target: "https://mindsearch.openxlab.org.cn", - // changeOrigin: true, - // }, + "/solve": { + target: "http://127.0.0.1:8002", + changeOrigin: true, + rewrite: (path) => path.replace(/^\/solve/, '/solve'), + }, }, }, }); diff --git a/frontend/mindsearch_streamlit.py b/frontend/mindsearch_streamlit.py index 2cc133f..d7798b1 100644 --- a/frontend/mindsearch_streamlit.py +++ b/frontend/mindsearch_streamlit.py @@ -317,3 +317,6 @@ def main(): if __name__ == '__main__': main() + +# 指定端口为7860的运行方法 +# streamlit run frontend/mindsearch_streamlit.py --server.port=7860 \ No newline at end of file diff --git a/mindsearch/agent/models.py b/mindsearch/agent/models.py index f1cb731..f756d72 100644 --- a/mindsearch/agent/models.py +++ b/mindsearch/agent/models.py @@ -1,6 +1,6 @@ import os -from lagent.llms import (GPTAPI, INTERNLM2_META, HFTransformerCasualLM, +from lagent.llms import (SENSENOVA_API, GPTAPI, INTERNLM2_META, HFTransformerCasualLM, LMDeployClient, LMDeployServer) internlm_server = dict(type=LMDeployServer, @@ -36,9 +36,24 @@ stop_words=['<|im_end|>']) # openai_api_base needs to fill in the complete chat api address, such as: https://api.openai.com/v1/chat/completions gpt4 = dict(type=GPTAPI, - model_type='gpt-4-turbo', + model_type='gpt-4o-mini', key=os.environ.get('OPENAI_API_KEY', 'YOUR OPENAI API KEY'), openai_api_base=os.environ.get('OPENAI_API_BASE', 'https://api.openai.com/v1/chat/completions'), + max_new_tokens=24576, + ) + +# First, apply for SenseNova's ak and sk from SenseTime staff +# Then, generated SENSENOVA_API_KEY using lagent.utils.gen_key.auto_gen_jwt_token(ak, sk) here +# https://github.com/InternLM/lagent/blob/ffc4ca71b4bcdbfb3a69bc0dccfa2dcc584a474d/lagent/utils/gen_key.py#L23 + +# If you want to switch to the locally deployed SenseNova model, you need to add the model name and context-window-length here +# https://github.com/winer632/lagent/blob/a5284a9af4c373a3ac666c51d6cef6de1e1de509/lagent/llms/sensenova.py#L21 +# You also need to change the SENSENOVA_API_BASE environment variable to the API address of the local inference framework +sensenova = dict(type=SENSENOVA_API, + model_type='SenseChat-5', + key=os.environ.get('SENSENOVA_API_KEY', 'YOUR SENSENOVA API KEY'), + sensenova_api_base=os.environ.get('SENSENOVA_API_BASE', 'https://api.sensenova.cn/v1/llm/chat-completions'), + max_new_tokens=24576, ) url = 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation' diff --git a/requirements.txt b/requirements.txt index 3e9d4ac..d7da184 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ duckduckgo_search==5.3.1b1 einops fastapi -git+https://github.com/InternLM/lagent.git +xlagent==0.2.1 gradio janus -lmdeploy +git+https://github.com/InternLM/lmdeploy.git pyvis sse-starlette termcolor