diff --git a/Dockerfile b/Dockerfile index 5d3888c7..b4396980 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,6 @@ ENV VIRTUAL_ENV=/app/.venv \ RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 WORKDIR /app -COPY . . COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} +COPY . . CMD ["pai_rag", "run"] diff --git a/Dockerfile_gpu b/Dockerfile_gpu index 0cc8f42e..481968ab 100644 --- a/Dockerfile_gpu +++ b/Dockerfile_gpu @@ -24,6 +24,6 @@ ENV VIRTUAL_ENV=/app/.venv \ RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 WORKDIR /app -COPY . . COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} +COPY . . CMD ["pai_rag", "run"] diff --git a/Dockerfile_ui b/Dockerfile_ui index db828dbb..0e5d30e5 100644 --- a/Dockerfile_ui +++ b/Dockerfile_ui @@ -22,6 +22,6 @@ ENV VIRTUAL_ENV=/app/.venv \ RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 WORKDIR /app -COPY . . COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} +COPY . . CMD ["pai_rag", "ui"] diff --git a/src/pai_rag/app/web/tabs/settings_tab.py b/src/pai_rag/app/web/tabs/settings_tab.py index 1f87f164..37cb579a 100644 --- a/src/pai_rag/app/web/tabs/settings_tab.py +++ b/src/pai_rag/app/web/tabs/settings_tab.py @@ -92,25 +92,23 @@ def change_emb_model(source, model): elem_id="llm", interactive=DEFAULT_IS_INTERACTIVE.lower() != "false", ) - with gr.Column(visible=(llm == "PaiEas")) as eas_col: - llm_eas_url = gr.Textbox( - label="EAS Url", - elem_id="llm_eas_url", - ) - llm_eas_token = gr.Textbox( - label="EAS Token", - elem_id="llm_eas_token", - type="password", - ) - llm_eas_model_name = gr.Textbox( - label="EAS Model name", - elem_id="llm_eas_model_name", - ) - with gr.Column(visible=(llm != "PaiEas")) as api_llm_col: - llm_api_model_name = gr.Dropdown( - label="LLM Model Name", - elem_id="llm_api_model_name", - ) + llm_eas_url = gr.Textbox( + label="EAS Url", + elem_id="llm_eas_url", + ) + llm_eas_token = gr.Textbox( + label="EAS Token", + elem_id="llm_eas_token", + type="password", + ) + llm_eas_model_name = gr.Textbox( + label="EAS Model name", + elem_id="llm_eas_model_name", + ) + llm_api_model_name = gr.Dropdown( + label="LLM Model Name", + elem_id="llm_api_model_name", + ) components.extend( [ @@ -128,17 +126,23 @@ def change_llm(value): model_options = LLM_MODEL_KEY_DICT.get(value, []) cur_model = model_options[0] if model_options else "" return { - eas_col: gr.update(visible=eas_visible), - api_llm_col: gr.update(visible=api_visible), + llm_eas_url: gr.update(visible=eas_visible), + llm_eas_token: gr.update(visible=eas_visible), + llm_eas_model_name: gr.update(visible=eas_visible), llm_api_model_name: gr.update( - choices=model_options, value=cur_model + choices=model_options, value=cur_model, visible=api_visible ), } llm.input( fn=change_llm, inputs=llm, - outputs=[eas_col, api_llm_col, llm_api_model_name], + outputs=[ + llm_eas_url, + llm_eas_token, + llm_eas_model_name, + llm_api_model_name, + ], ) """ with gr.Column(): diff --git a/src/pai_rag/app/web/view_model.py b/src/pai_rag/app/web/view_model.py index 0700f0f1..7ef88bd7 100644 --- a/src/pai_rag/app/web/view_model.py +++ b/src/pai_rag/app/web/view_model.py @@ -587,9 +587,18 @@ def to_component_settings(self) -> Dict[str, Dict[str, Any]]: settings["embed_batch_size"] = {"value": self.embed_batch_size} settings["llm"] = {"value": self.llm} - settings["llm_eas_url"] = {"value": self.llm_eas_url} - settings["llm_eas_token"] = {"value": self.llm_eas_token} - settings["llm_eas_model_name"] = {"value": self.llm_eas_model_name} + settings["llm_eas_url"] = { + "value": self.llm_eas_url, + "visible": self.llm.lower() == "paieas", + } + settings["llm_eas_token"] = { + "value": self.llm_eas_token, + "visible": self.llm.lower() == "paieas", + } + settings["llm_eas_model_name"] = { + "value": self.llm_eas_model_name, + "visible": self.llm.lower() == "paieas", + } settings["llm_api_model_name"] = { "value": self.llm_api_model_name, "choices": LLM_MODEL_KEY_DICT.get(self.llm, []),