diff --git a/.github/workflows/typos_check.yml b/.github/workflows/typos_check.yml new file mode 100644 index 000000000..099b219d3 --- /dev/null +++ b/.github/workflows/typos_check.yml @@ -0,0 +1,13 @@ +name: Typos Check +on: [push, pull_request] + +jobs: + run: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v2 + + - name: Check spelling + uses: crate-ci/typos@master diff --git a/.gitignore b/.gitignore index 7e6be9bfb..c6d277f80 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,7 @@ share/python-wheels/ MANIFEST # PyInstaller -# Usually these files are written by a python script froms a template +# Usually these files are written by a python script forms a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec diff --git a/README.md b/README.md index 2cde66c3b..f4fa0d621 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ docker run -d --name=maxkb -p 8080:8080 -v ~/.maxkb:/var/lib/postgresql/data 1pa - 前端:[Vue.js](https://cn.vuejs.org/) - 后端:[Python / Django](https://www.djangoproject.com/) -- Langchain:[Langchain](https://www.langchain.com/) +- LangChain:[LangChain](https://www.langchain.com/) - 向量数据库:[PostgreSQL / pgvector](https://www.postgresql.org/) - 大模型:Azure OpenAI、百度千帆大模型、[Ollama](https://github.com/ollama/ollama) diff --git a/apps/application/serializers/application_serializers.py b/apps/application/serializers/application_serializers.py index 44ecce1f9..6ae7cc463 100644 --- a/apps/application/serializers/application_serializers.py +++ b/apps/application/serializers/application_serializers.py @@ -257,7 +257,7 @@ class ApplicationSerializer(serializers.Serializer): application_model = ApplicationSerializer.Create.to_application_model(user_id, application) dataset_id_list = application.get('dataset_id_list', []) application_dataset_mapping_model_list = [ - ApplicationSerializer.Create.to_application_dateset_mapping(application_model.id, dataset_id) for + ApplicationSerializer.Create.to_application_dataset_mapping(application_model.id, dataset_id) for dataset_id in dataset_id_list] # 插入应用 application_model.save() @@ -280,7 +280,7 @@ class ApplicationSerializer(serializers.Serializer): ) @staticmethod - def to_application_dateset_mapping(application_id: str, dataset_id: str): + def to_application_dataset_mapping(application_id: str, dataset_id: str): return ApplicationDatasetMapping(id=uuid.uuid1(), application_id=application_id, dataset_id=dataset_id) class HitTest(serializers.Serializer): diff --git a/apps/application/serializers/chat_message_serializers.py b/apps/application/serializers/chat_message_serializers.py index 3f0cf01cf..dbbffb2a2 100644 --- a/apps/application/serializers/chat_message_serializers.py +++ b/apps/application/serializers/chat_message_serializers.py @@ -178,12 +178,12 @@ class ChatMessageSerializer(serializers.Serializer): client_id = self.data.get('client_id') client_type = self.data.get('client_type') chat_info = self.is_valid(raise_exception=True) - pipline_manage_builder = PipelineManage.builder() + pipeline_manage_builder = PipelineManage.builder() # 如果开启了问题优化,则添加上问题优化步骤 if chat_info.application.problem_optimization: - pipline_manage_builder.append_step(BaseResetProblemStep) + pipeline_manage_builder.append_step(BaseResetProblemStep) # 构建流水线管理器 - pipline_message = (pipline_manage_builder.append_step(BaseSearchDatasetStep) + pipeline_message = (pipeline_manage_builder.append_step(BaseSearchDatasetStep) .append_step(BaseGenerateHumanMessageStep) .append_step(BaseChatStep) .build()) @@ -198,8 +198,8 @@ class ChatMessageSerializer(serializers.Serializer): params = chat_info.to_pipeline_manage_params(message, get_post_handler(chat_info), exclude_paragraph_id_list, client_id, client_type, stream) # 运行流水线作业 - pipline_message.run(params) - return pipline_message.context['chat_result'] + pipeline_message.run(params) + return pipeline_message.context['chat_result'] @staticmethod def re_open_chat(chat_id: str): diff --git a/apps/common/event/listener_manage.py b/apps/common/event/listener_manage.py index 93613a02a..98e22c821 100644 --- a/apps/common/event/listener_manage.py +++ b/apps/common/event/listener_manage.py @@ -215,7 +215,7 @@ class ListenerManagement: @staticmethod @poxy - def init_embedding_model(ags): + def init_embedding_model(ages): EmbeddingModel.get_embedding_model() def run(self): diff --git a/apps/common/froms/__init__.py b/apps/common/forms/__init__.py similarity index 100% rename from apps/common/froms/__init__.py rename to apps/common/forms/__init__.py diff --git a/apps/common/froms/array_object_card.py b/apps/common/forms/array_object_card.py similarity index 94% rename from apps/common/froms/array_object_card.py rename to apps/common/forms/array_object_card.py index 9cf8c9bf8..2dc71aaaf 100644 --- a/apps/common/froms/array_object_card.py +++ b/apps/common/forms/array_object_card.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class ArrayCard(BaseExecField): diff --git a/apps/common/froms/base_field.py b/apps/common/forms/base_field.py similarity index 100% rename from apps/common/froms/base_field.py rename to apps/common/forms/base_field.py diff --git a/apps/common/froms/base_form.py b/apps/common/forms/base_form.py similarity index 92% rename from apps/common/froms/base_form.py rename to apps/common/forms/base_form.py index 49e4556fa..93984b8c6 100644 --- a/apps/common/froms/base_form.py +++ b/apps/common/forms/base_form.py @@ -6,7 +6,7 @@ @date:2023/11/1 16:04 @desc: """ -from common.froms import BaseField +from common.forms import BaseField class BaseForm: diff --git a/apps/common/froms/multi_select.py b/apps/common/forms/multi_select.py similarity index 95% rename from apps/common/froms/multi_select.py rename to apps/common/forms/multi_select.py index f3c854224..791c8e974 100644 --- a/apps/common/froms/multi_select.py +++ b/apps/common/forms/multi_select.py @@ -8,7 +8,7 @@ """ from typing import List, Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class MultiSelect(BaseExecField): diff --git a/apps/common/froms/object_card.py b/apps/common/forms/object_card.py similarity index 94% rename from apps/common/froms/object_card.py rename to apps/common/forms/object_card.py index 0245ba296..ddb192ef9 100644 --- a/apps/common/froms/object_card.py +++ b/apps/common/forms/object_card.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class ObjectCard(BaseExecField): diff --git a/apps/common/froms/password_input.py b/apps/common/forms/password_input.py similarity index 93% rename from apps/common/froms/password_input.py rename to apps/common/forms/password_input.py index 87a97e24d..e7c7923bb 100644 --- a/apps/common/froms/password_input.py +++ b/apps/common/forms/password_input.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms import BaseField, TriggerType +from common.forms import BaseField, TriggerType class PasswordInputField(BaseField): diff --git a/apps/common/froms/radio_button_field.py b/apps/common/forms/radio_button_field.py similarity index 94% rename from apps/common/froms/radio_button_field.py rename to apps/common/forms/radio_button_field.py index 5c7f2cf9a..aa6952303 100644 --- a/apps/common/froms/radio_button_field.py +++ b/apps/common/forms/radio_button_field.py @@ -8,7 +8,7 @@ """ from typing import List, Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class Radio(BaseExecField): diff --git a/apps/common/froms/radio_card_field.py b/apps/common/forms/radio_card_field.py similarity index 94% rename from apps/common/froms/radio_card_field.py rename to apps/common/forms/radio_card_field.py index 07c57dcd9..b3579b84d 100644 --- a/apps/common/froms/radio_card_field.py +++ b/apps/common/forms/radio_card_field.py @@ -8,7 +8,7 @@ """ from typing import List, Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class Radio(BaseExecField): diff --git a/apps/common/froms/radio_field.py b/apps/common/forms/radio_field.py similarity index 94% rename from apps/common/froms/radio_field.py rename to apps/common/forms/radio_field.py index b8fcbd9b1..94a016d9d 100644 --- a/apps/common/froms/radio_field.py +++ b/apps/common/forms/radio_field.py @@ -8,7 +8,7 @@ """ from typing import List, Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class Radio(BaseExecField): diff --git a/apps/common/froms/single_select_field.py b/apps/common/forms/single_select_field.py similarity index 95% rename from apps/common/froms/single_select_field.py rename to apps/common/forms/single_select_field.py index f0d359d90..cf3d50409 100644 --- a/apps/common/froms/single_select_field.py +++ b/apps/common/forms/single_select_field.py @@ -8,7 +8,7 @@ """ from typing import List, Dict -from common.froms.base_field import TriggerType, BaseExecField +from common.forms.base_field import TriggerType, BaseExecField class SingleSelect(BaseExecField): diff --git a/apps/common/froms/tab_card.py b/apps/common/forms/tab_card.py similarity index 94% rename from apps/common/froms/tab_card.py rename to apps/common/forms/tab_card.py index f73999431..7907714bd 100644 --- a/apps/common/froms/tab_card.py +++ b/apps/common/forms/tab_card.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import BaseExecField, TriggerType +from common.forms.base_field import BaseExecField, TriggerType class TabCard(BaseExecField): diff --git a/apps/common/froms/table_checkbox.py b/apps/common/forms/table_checkbox.py similarity index 94% rename from apps/common/froms/table_checkbox.py rename to apps/common/forms/table_checkbox.py index 16d61ddb2..e01f14d31 100644 --- a/apps/common/froms/table_checkbox.py +++ b/apps/common/forms/table_checkbox.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import TriggerType, BaseExecField +from common.forms.base_field import TriggerType, BaseExecField class TableRadio(BaseExecField): diff --git a/apps/common/froms/table_radio.py b/apps/common/forms/table_radio.py similarity index 94% rename from apps/common/froms/table_radio.py rename to apps/common/forms/table_radio.py index 0c2ef2fc6..3b4c2bfb0 100644 --- a/apps/common/froms/table_radio.py +++ b/apps/common/forms/table_radio.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import TriggerType, BaseExecField +from common.forms.base_field import TriggerType, BaseExecField class TableRadio(BaseExecField): diff --git a/apps/common/froms/text_input_field.py b/apps/common/forms/text_input_field.py similarity index 91% rename from apps/common/froms/text_input_field.py rename to apps/common/forms/text_input_field.py index eeb16782b..28a821e15 100644 --- a/apps/common/froms/text_input_field.py +++ b/apps/common/forms/text_input_field.py @@ -8,7 +8,7 @@ """ from typing import Dict -from common.froms.base_field import BaseField, TriggerType +from common.forms.base_field import BaseField, TriggerType class TextInputField(BaseField): diff --git a/apps/common/util/file_util.py b/apps/common/util/file_util.py index f46c460a7..447b007bc 100644 --- a/apps/common/util/file_util.py +++ b/apps/common/util/file_util.py @@ -9,8 +9,6 @@ def get_file_content(path): - file = open(path, "r", - encoding='utf-8') - content = file.read() - file.close() + with open(path, "r", encoding='utf-8') as file: + content = file.read() return content diff --git a/apps/setting/models_provider/impl/azure_model_provider/azure_model_provider.py b/apps/setting/models_provider/impl/azure_model_provider/azure_model_provider.py index 35775d866..f58f8744c 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/azure_model_provider.py +++ b/apps/setting/models_provider/impl/azure_model_provider/azure_model_provider.py @@ -12,9 +12,9 @@ from typing import Dict from langchain.schema import HumanMessage from langchain_community.chat_models.azure_openai import AzureChatOpenAI -from common import froms +from common import forms from common.exception.app_exception import AppApiException -from common.froms import BaseForm +from common.forms import BaseForm from common.util.file_util import get_file_content from setting.models_provider.base_model_provider import IModelProvider, ModelProvideInfo, BaseModelCredential, \ ModelInfo, \ @@ -51,11 +51,11 @@ class AzureLLMModelCredential(BaseForm, BaseModelCredential): def encryption_dict(self, model: Dict[str, object]): return {**model, 'api_key': super().encryption(model.get('api_key', ''))} - api_base = froms.TextInputField('API 域名', required=True) + api_base = forms.TextInputField('API 域名', required=True) - api_key = froms.PasswordInputField("API Key", required=True) + api_key = forms.PasswordInputField("API Key", required=True) - deployment_name = froms.TextInputField("部署名", required=True) + deployment_name = forms.TextInputField("部署名", required=True) class DefaultAzureLLMModelCredential(BaseForm, BaseModelCredential): @@ -87,13 +87,13 @@ class DefaultAzureLLMModelCredential(BaseForm, BaseModelCredential): def encryption_dict(self, model: Dict[str, object]): return {**model, 'api_key': super().encryption(model.get('api_key', ''))} - api_version = froms.TextInputField("api_version", required=True) + api_version = forms.TextInputField("api_version", required=True) - api_base = froms.TextInputField('API 域名', required=True) + api_base = forms.TextInputField('API 域名', required=True) - api_key = froms.PasswordInputField("API Key", required=True) + api_key = forms.PasswordInputField("API Key", required=True) - deployment_name = froms.TextInputField("部署名", required=True) + deployment_name = forms.TextInputField("部署名", required=True) azure_llm_model_credential = AzureLLMModelCredential() diff --git a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py index 2d8097a70..2cc1601a3 100644 --- a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py +++ b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py @@ -14,9 +14,9 @@ from urllib.parse import urlparse, ParseResult import requests from langchain.chat_models.base import BaseChatModel -from common import froms +from common import forms from common.exception.app_exception import AppApiException -from common.froms import BaseForm +from common.forms import BaseForm from common.util.file_util import get_file_content from setting.models_provider.base_model_provider import IModelProvider, ModelProvideInfo, ModelInfo, ModelTypeConst, \ BaseModelCredential, DownModelChunk, DownModelChunkStatus, ValidCode @@ -51,8 +51,8 @@ class OllamaLLMModelCredential(BaseForm, BaseModelCredential): self.api_key = model_info.get('api_key') return self - api_base = froms.TextInputField('API 域名', required=True) - api_key = froms.PasswordInputField('API Key', required=True) + api_base = forms.TextInputField('API 域名', required=True) + api_key = forms.PasswordInputField('API Key', required=True) ollama_llm_model_credential = OllamaLLMModelCredential() diff --git a/apps/setting/models_provider/impl/openai_model_provider/openai_model_provider.py b/apps/setting/models_provider/impl/openai_model_provider/openai_model_provider.py index 55754619d..6529d1784 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/openai_model_provider.py +++ b/apps/setting/models_provider/impl/openai_model_provider/openai_model_provider.py @@ -12,9 +12,9 @@ from typing import Dict from langchain.schema import HumanMessage from langchain_openai import ChatOpenAI -from common import froms +from common import forms from common.exception.app_exception import AppApiException -from common.froms import BaseForm +from common.forms import BaseForm from common.util.file_util import get_file_content from setting.models_provider.base_model_provider import IModelProvider, ModelProvideInfo, BaseModelCredential, \ ModelInfo, \ @@ -50,8 +50,8 @@ class OpenAILLMModelCredential(BaseForm, BaseModelCredential): def encryption_dict(self, model: Dict[str, object]): return {**model, 'api_key': super().encryption(model.get('api_key', ''))} - api_base = froms.TextInputField('API 域名', required=True) - api_key = froms.PasswordInputField('API Key', required=True) + api_base = forms.TextInputField('API 域名', required=True) + api_key = forms.PasswordInputField('API Key', required=True) openai_llm_model_credential = OpenAILLMModelCredential() diff --git a/apps/setting/models_provider/impl/wenxin_model_provider/wenxin_model_provider.py b/apps/setting/models_provider/impl/wenxin_model_provider/wenxin_model_provider.py index 2805f4b1d..3d7c9a7d9 100644 --- a/apps/setting/models_provider/impl/wenxin_model_provider/wenxin_model_provider.py +++ b/apps/setting/models_provider/impl/wenxin_model_provider/wenxin_model_provider.py @@ -13,9 +13,9 @@ from langchain.schema import HumanMessage from langchain_community.chat_models import QianfanChatEndpoint from qianfan import ChatCompletion -from common import froms +from common import forms from common.exception.app_exception import AppApiException -from common.froms import BaseForm +from common.forms import BaseForm from common.util.file_util import get_file_content from setting.models_provider.base_model_provider import ModelProvideInfo, ModelTypeConst, BaseModelCredential, \ ModelInfo, IModelProvider, ValidCode @@ -55,9 +55,9 @@ class WenxinLLMModelCredential(BaseForm, BaseModelCredential): self.secret_key = model_info.get('secret_key') return self - api_key = froms.PasswordInputField('API Key', required=True) + api_key = forms.PasswordInputField('API Key', required=True) - secret_key = froms.PasswordInputField("Secret Key", required=True) + secret_key = forms.PasswordInputField("Secret Key", required=True) win_xin_llm_model_credential = WenxinLLMModelCredential() diff --git a/apps/smartdoc/conf.py b/apps/smartdoc/conf.py index 855b507a1..27e1e8b08 100644 --- a/apps/smartdoc/conf.py +++ b/apps/smartdoc/conf.py @@ -174,7 +174,7 @@ class ConfigManager: return True def load_from_yml(self): - for i in ['config_example.yml', 'config.yaml']: + for i in ['config_example.yml', 'config.yaml', 'config.yml']: if not os.path.isfile(os.path.join(self.root_path, i)): continue loaded = self.from_yaml(i) @@ -193,11 +193,12 @@ class ConfigManager: if manager.load_from_yml(): config = manager.config else: - msg = """ + msg = f""" Error: No config file found. - You can run `cp config_example.yml config_example.yml`, and edit it. + You can run `cp config_example.yml {root_path}/config.yml`, and edit it. + """ raise ImportError(msg) return config diff --git a/apps/smartdoc/urls.py b/apps/smartdoc/urls.py index a7f99c1ee..9e85a1874 100644 --- a/apps/smartdoc/urls.py +++ b/apps/smartdoc/urls.py @@ -5,13 +5,13 @@ The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.2/topics/http/urls/ Examples: Function views - 1. Add an import: froms my_app import views + 1. Add an import: forms my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views - 1. Add an import: froms other_app.views import Home + 1. Add an import: forms other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf - 1. Import the include() function: froms django.urls import include, path + 1. Import the include() function: forms django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ import os diff --git a/installer/run-maxkb.sh b/installer/run-maxkb.sh index b60cd5bf7..597da7f02 100644 --- a/installer/run-maxkb.sh +++ b/installer/run-maxkb.sh @@ -1,9 +1,9 @@ #!/bin/bash -# Start postgress +# Start postgresql docker-entrypoint.sh postgres & sleep 10 -# Wait postgress +# Wait postgresql until pg_isready --host=127.0.0.1; do sleep 1 && echo "waiting for postgres"; done # Start MaxKB diff --git a/ui/src/api/application-overview.ts b/ui/src/api/application-overview.ts index d77da6322..e6a4d2c4d 100644 --- a/ui/src/api/application-overview.ts +++ b/ui/src/api/application-overview.ts @@ -7,64 +7,64 @@ const prefix = '/application' /** * API_KEY列表 - * @param 参数 applicaiton_id + * @param 参数 application_id */ -const getAPIKey: (applicaiton_id: string, loading?: Ref) => Promise> = ( - applicaiton_id, +const getAPIKey: (application_id: string, loading?: Ref) => Promise> = ( + application_id, loading ) => { - return get(`${prefix}/${applicaiton_id}/api_key`, undefined, loading) + return get(`${prefix}/${application_id}/api_key`, undefined, loading) } /** * 新增API_KEY - * @param 参数 applicaiton_id + * @param 参数 application_id */ -const postAPIKey: (applicaiton_id: string, loading?: Ref) => Promise> = ( - applicaiton_id, +const postAPIKey: (application_id: string, loading?: Ref) => Promise> = ( + application_id, loading ) => { - return post(`${prefix}/${applicaiton_id}/api_key`, {}, undefined, loading) + return post(`${prefix}/${application_id}/api_key`, {}, undefined, loading) } /** * 删除API_KEY - * @param 参数 applicaiton_id api_key_id + * @param 参数 application_id api_key_id */ const delAPIKey: ( - applicaiton_id: String, + application_id: String, api_key_id: String, loading?: Ref -) => Promise> = (applicaiton_id, api_key_id, loading) => { - return del(`${prefix}/${applicaiton_id}/api_key/${api_key_id}`, undefined, undefined, loading) +) => Promise> = (application_id, api_key_id, loading) => { + return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading) } /** * 修改API_KEY - * @param 参数 applicaiton_id,api_key_id + * @param 参数 application_id,api_key_id * data { * is_active: boolean * } */ const putAPIKey: ( - applicaiton_id: string, + application_id: string, api_key_id: String, data: any, loading?: Ref -) => Promise> = (applicaiton_id, api_key_id, data, loading) => { - return put(`${prefix}/${applicaiton_id}/api_key/${api_key_id}`, data, undefined, loading) +) => Promise> = (application_id, api_key_id, data, loading) => { + return put(`${prefix}/${application_id}/api_key/${api_key_id}`, data, undefined, loading) } /** * 统计 - * @param 参数 applicaiton_id, data + * @param 参数 application_id, data */ const getStatistics: ( - applicaiton_id: string, + application_id: string, data: any, loading?: Ref -) => Promise> = (applicaiton_id, data, loading) => { - return get(`${prefix}/${applicaiton_id}/statistics/chat_record_aggregate_trend`, data, loading) +) => Promise> = (application_id, data, loading) => { + return get(`${prefix}/${application_id}/statistics/chat_record_aggregate_trend`, data, loading) } export default { diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index 888e6f495..c83ff3c8e 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -49,70 +49,70 @@ const postApplication: ( */ const putApplication: ( - applicaiton_id: String, + application_id: String, data: ApplicationFormType, loading?: Ref -) => Promise> = (applicaiton_id, data, loading) => { - return put(`${prefix}/${applicaiton_id}`, data, undefined, loading) +) => Promise> = (application_id, data, loading) => { + return put(`${prefix}/${application_id}`, data, undefined, loading) } /** * 删除应用 - * @param 参数 applicaiton_id + * @param 参数 application_id */ const delApplication: ( - applicaiton_id: String, + application_id: String, loading?: Ref -) => Promise> = (applicaiton_id, loading) => { - return del(`${prefix}/${applicaiton_id}`, undefined, {}, loading) +) => Promise> = (application_id, loading) => { + return del(`${prefix}/${application_id}`, undefined, {}, loading) } /** * 应用详情 - * @param 参数 applicaiton_id + * @param 参数 application_id */ const getApplicationDetail: ( - applicaiton_id: string, + application_id: string, loading?: Ref -) => Promise> = (applicaiton_id, loading) => { - return get(`${prefix}/${applicaiton_id}`, undefined, loading) +) => Promise> = (application_id, loading) => { + return get(`${prefix}/${application_id}`, undefined, loading) } /** * 获得当前应用可使用的知识库 - * @param 参数 applicaiton_id + * @param 参数 application_id */ const getApplicationDataset: ( - applicaiton_id: string, + application_id: string, loading?: Ref -) => Promise> = (applicaiton_id, loading) => { - return get(`${prefix}/${applicaiton_id}/list_dataset`, undefined, loading) +) => Promise> = (application_id, loading) => { + return get(`${prefix}/${application_id}/list_dataset`, undefined, loading) } /** * 获取AccessToken - * @param 参数 applicaiton_id + * @param 参数 application_id */ -const getAccessToken: (applicaiton_id: string, loading?: Ref) => Promise> = ( - applicaiton_id, +const getAccessToken: (application_id: string, loading?: Ref) => Promise> = ( + application_id, loading ) => { - return get(`${prefix}/${applicaiton_id}/access_token`, undefined, loading) + return get(`${prefix}/${application_id}/access_token`, undefined, loading) } /** * 修改AccessToken - * @param 参数 applicaiton_id + * @param 参数 application_id * data { * "is_active": true * } */ const putAccessToken: ( - applicaiton_id: string, + application_id: string, data: any, loading?: Ref -) => Promise> = (applicaiton_id, data, loading) => { - return put(`${prefix}/${applicaiton_id}/access_token`, data, undefined, loading) +) => Promise> = (application_id, data, loading) => { + return put(`${prefix}/${application_id}/access_token`, data, undefined, loading) } /** @@ -161,8 +161,8 @@ const postChatOpen: (data: ApplicationFormType) => Promise> = (data) ] } */ -const getChatOpen: (applicaiton_id: String) => Promise> = (applicaiton_id) => { - return get(`${prefix}/${applicaiton_id}/chat/open`) +const getChatOpen: (application_id: String) => Promise> = (application_id) => { + return get(`${prefix}/${application_id}/chat/open`) } /** * 对话 diff --git a/ui/src/api/dataset.ts b/ui/src/api/dataset.ts index a95395b45..850626cf4 100644 --- a/ui/src/api/dataset.ts +++ b/ui/src/api/dataset.ts @@ -17,7 +17,7 @@ const prefix = '/dataset' "name": "string", } */ -const getDateset: ( +const getDataset: ( page: pageRequest, param: any, loading?: Ref @@ -29,7 +29,7 @@ const getDateset: ( * 获取全部知识库 * @param 参数 */ -const getAllDateset: (loading?: Ref) => Promise> = (loading) => { +const getAllDataset: (loading?: Ref) => Promise> = (loading) => { return get(`${prefix}`, undefined, loading) } @@ -37,7 +37,7 @@ const getAllDateset: (loading?: Ref) => Promise> = (loadi * 删除知识库 * @param 参数 dataset_id */ -const delDateset: (dataset_id: String, loading?: Ref) => Promise> = ( +const delDataset: (dataset_id: String, loading?: Ref) => Promise> = ( dataset_id, loading ) => { @@ -69,7 +69,7 @@ const delDateset: (dataset_id: String, loading?: Ref) => Promise) => Promise> = ( +const postDataset: (data: datasetData, loading?: Ref) => Promise> = ( data, loading ) => { @@ -86,7 +86,7 @@ const postDateset: (data: datasetData, loading?: Ref) => Promise) => Promise> = ( +const postWebDataset: (data: any, loading?: Ref) => Promise> = ( data, loading ) => { @@ -97,7 +97,7 @@ const postWebDateset: (data: any, loading?: Ref) => Promise * 知识库详情 * @param 参数 dataset_id */ -const getDatesetDetail: (dataset_id: string, loading?: Ref) => Promise> = ( +const getDatasetDetail: (dataset_id: string, loading?: Ref) => Promise> = ( dataset_id, loading ) => { @@ -113,7 +113,7 @@ const getDatesetDetail: (dataset_id: string, loading?: Ref) => Promise< "desc": true } */ -const putDateset: (dataset_id: string, data: any) => Promise> = ( +const putDataset: (dataset_id: string, data: any) => Promise> = ( dataset_id, data: any ) => { @@ -152,7 +152,7 @@ const getDatasetHitTest: ( * @param 参数 dataset_id * @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步 */ -const putSyncWebDateset: ( +const putSyncWebDataset: ( dataset_id: string, sync_type: string, loading?: Ref @@ -161,14 +161,14 @@ const putSyncWebDateset: ( } export default { - getDateset, - getAllDateset, - delDateset, - postDateset, - getDatesetDetail, - putDateset, + getDataset, + getAllDataset, + delDataset, + postDataset, + getDatasetDetail, + putDataset, listUsableApplication, getDatasetHitTest, - postWebDateset, - putSyncWebDateset + postWebDataset, + putSyncWebDataset } diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 2d3d4d753..4ace004bc 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -14,7 +14,7 @@