Skip to content

Commit 02050a2

Browse files
committed
Merge branch 'main' into release-1.0
2 parents 117863e + b719946 commit 02050a2

File tree

90 files changed

+644
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+644
-229
lines changed

.github/workflows/build-and-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Checkout
4949
uses: actions/checkout@v4
5050
with:
51-
ref: main
51+
ref: ${{ github.ref_name }}
5252
- name: Prepare
5353
id: prepare
5454
run: |
@@ -104,7 +104,7 @@ jobs:
104104
- name: Checkout
105105
uses: actions/checkout@v4
106106
with:
107-
ref: main
107+
ref: ${{ github.ref_name }}
108108
- name: Prepare
109109
id: prepare
110110
run: |

.github/workflows/typos_check.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Typos Check
2+
on: [push, pull_request]
3+
4+
jobs:
5+
run:
6+
name: Spell Check with Typos
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout Actions Repository
10+
uses: actions/checkout@v2
11+
12+
- name: Check spelling
13+
uses: crate-ci/typos@master

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ share/python-wheels/
4242
MANIFEST
4343

4444
# PyInstaller
45-
# Usually these files are written by a python script froms a template
45+
# Usually these files are written by a python script forms a template
4646
# before PyInstaller builds the exe, so as to inject date/other infos into it.
4747
*.manifest
4848
*.spec

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,22 @@ docker run -d --name=maxkb -p 8080:8080 -v ~/.maxkb:/var/lib/postgresql/data 1pa
5151

5252
- 前端:[Vue.js](https://cn.vuejs.org/)
5353
- 后端:[Python / Django](https://www.djangoproject.com/)
54-
- Langchain:[Langchain](https://www.langchain.com/)
54+
- LangChain:[LangChain](https://www.langchain.com/)
5555
- 向量数据库:[PostgreSQL / pgvector](https://www.postgresql.org/)
5656
- 大模型:Azure OpenAI、百度千帆大模型、[Ollama](https://github.com/ollama/ollama)
5757

5858
## Star History
5959

6060
[![Star History Chart](https://api.star-history.com/svg?repos=1Panel-dev/MaxKB&type=Date)](https://star-history.com/#1Panel-dev/MaxKB&Date)
6161

62+
## 我们的其他开源产品
63+
64+
- [JumpServer](https://github.com/jumpserver/jumpserver/) - 广受欢迎的开源堡垒机
65+
- [DataEase](https://github.com/dataease/dataease/) - 人人可用的开源数据可视化分析工具
66+
- [MeterSphere](https://github.com/metersphere/metersphere/) - 一站式开源自动化测试平台
67+
- [1Panel](https://github.com/1panel-dev/1panel/) - 现代化、开源的 Linux 服务器运维管理面板
68+
- [Halo](https://github.com/halo-dev/halo/) - 强大易用的开源建站工具
69+
6270
## License
6371

6472
Copyright (c) 2014-2024 飞致云 FIT2CLOUD, All rights reserved.

apps/application/serializers/application_serializers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Authentication(serializers.Serializer):
196196
access_token = serializers.CharField(required=True, error_messages=ErrMessage.char("access_token"))
197197

198198
def auth(self, request, with_valid=True):
199-
token = request.META.get('HTTP_AUTHORIZATION', None)
199+
token = request.META.get('HTTP_AUTHORIZATION')
200200
token_details = None
201201
try:
202202
# 校验token
@@ -257,7 +257,7 @@ def insert(self, application: Dict):
257257
application_model = ApplicationSerializer.Create.to_application_model(user_id, application)
258258
dataset_id_list = application.get('dataset_id_list', [])
259259
application_dataset_mapping_model_list = [
260-
ApplicationSerializer.Create.to_application_dateset_mapping(application_model.id, dataset_id) for
260+
ApplicationSerializer.Create.to_application_dataset_mapping(application_model.id, dataset_id) for
261261
dataset_id in dataset_id_list]
262262
# 插入应用
263263
application_model.save()
@@ -280,7 +280,7 @@ def to_application_model(user_id: str, application: Dict):
280280
)
281281

282282
@staticmethod
283-
def to_application_dateset_mapping(application_id: str, dataset_id: str):
283+
def to_application_dataset_mapping(application_id: str, dataset_id: str):
284284
return ApplicationDatasetMapping(id=uuid.uuid1(), application_id=application_id, dataset_id=dataset_id)
285285

286286
class HitTest(serializers.Serializer):

apps/application/serializers/chat_message_serializers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ def chat(self):
178178
client_id = self.data.get('client_id')
179179
client_type = self.data.get('client_type')
180180
chat_info = self.is_valid(raise_exception=True)
181-
pipline_manage_builder = PipelineManage.builder()
181+
pipeline_manage_builder = PipelineManage.builder()
182182
# 如果开启了问题优化,则添加上问题优化步骤
183183
if chat_info.application.problem_optimization:
184-
pipline_manage_builder.append_step(BaseResetProblemStep)
184+
pipeline_manage_builder.append_step(BaseResetProblemStep)
185185
# 构建流水线管理器
186-
pipline_message = (pipline_manage_builder.append_step(BaseSearchDatasetStep)
186+
pipeline_message = (pipeline_manage_builder.append_step(BaseSearchDatasetStep)
187187
.append_step(BaseGenerateHumanMessageStep)
188188
.append_step(BaseChatStep)
189189
.build())
@@ -198,8 +198,8 @@ def chat(self):
198198
params = chat_info.to_pipeline_manage_params(message, get_post_handler(chat_info), exclude_paragraph_id_list,
199199
client_id, client_type, stream)
200200
# 运行流水线作业
201-
pipline_message.run(params)
202-
return pipline_message.context['chat_result']
201+
pipeline_message.run(params)
202+
return pipeline_message.context['chat_result']
203203

204204
@staticmethod
205205
def re_open_chat(chat_id: str):

apps/application/template/embed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function initMaxkbStyle(root){
247247
#maxkb #maxkb-chat-container{
248248
z-index:10000;position: relative;
249249
border-radius: 8px;
250-
border: 1px solid var(--N300, #DEE0E3);
250+
border: 1px solid #ffffff;
251251
background: linear-gradient(188deg, rgba(235, 241, 255, 0.20) 39.6%, rgba(231, 249, 255, 0.20) 94.3%), #EFF0F1;
252252
box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.10);
253253
position: fixed;bottom: 20px;right: 45px;overflow: hidden;

apps/common/auth/authenticate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def get_token_details(self):
4747
class TokenAuth(TokenAuthentication):
4848
# 重新 authenticate 方法,自定义认证规则
4949
def authenticate(self, request):
50-
auth = request.META.get('HTTP_AUTHORIZATION', None
51-
)
50+
auth = request.META.get('HTTP_AUTHORIZATION')
5251
# 未认证
5352
if auth is None:
5453
raise AppAuthenticationFailed(1003, '未登录,请先登录')

apps/common/event/listener_manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def delete_embedding_by_dataset_id_list(source_ids: List[str]):
215215

216216
@staticmethod
217217
@poxy
218-
def init_embedding_model(ags):
218+
def init_embedding_model(ages):
219219
EmbeddingModel.get_embedding_model()
220220

221221
def run(self):
File renamed without changes.

apps/common/froms/array_object_card.py renamed to apps/common/forms/array_object_card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class ArrayCard(BaseExecField):
File renamed without changes.

apps/common/froms/base_form.py renamed to apps/common/forms/base_form.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@date:2023/11/1 16:04
77
@desc:
88
"""
9-
from common.froms import BaseField
9+
from common.forms import BaseField
1010

1111

1212
class BaseForm:

apps/common/froms/multi_select.py renamed to apps/common/forms/multi_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import List, Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class MultiSelect(BaseExecField):

apps/common/froms/object_card.py renamed to apps/common/forms/object_card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class ObjectCard(BaseExecField):

apps/common/froms/password_input.py renamed to apps/common/forms/password_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms import BaseField, TriggerType
11+
from common.forms import BaseField, TriggerType
1212

1313

1414
class PasswordInputField(BaseField):

apps/common/froms/radio_button_field.py renamed to apps/common/forms/radio_button_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import List, Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class Radio(BaseExecField):

apps/common/froms/radio_card_field.py renamed to apps/common/forms/radio_card_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import List, Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class Radio(BaseExecField):

apps/common/froms/radio_field.py renamed to apps/common/forms/radio_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import List, Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class Radio(BaseExecField):

apps/common/froms/single_select_field.py renamed to apps/common/forms/single_select_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import List, Dict
1010

11-
from common.froms.base_field import TriggerType, BaseExecField
11+
from common.forms.base_field import TriggerType, BaseExecField
1212

1313

1414
class SingleSelect(BaseExecField):

apps/common/froms/tab_card.py renamed to apps/common/forms/tab_card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import BaseExecField, TriggerType
11+
from common.forms.base_field import BaseExecField, TriggerType
1212

1313

1414
class TabCard(BaseExecField):

apps/common/froms/table_checkbox.py renamed to apps/common/forms/table_checkbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import TriggerType, BaseExecField
11+
from common.forms.base_field import TriggerType, BaseExecField
1212

1313

1414
class TableRadio(BaseExecField):

apps/common/froms/table_radio.py renamed to apps/common/forms/table_radio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import TriggerType, BaseExecField
11+
from common.forms.base_field import TriggerType, BaseExecField
1212

1313

1414
class TableRadio(BaseExecField):

apps/common/froms/text_input_field.py renamed to apps/common/forms/text_input_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
from typing import Dict
1010

11-
from common.froms.base_field import BaseField, TriggerType
11+
from common.forms.base_field import BaseField, TriggerType
1212

1313

1414
class TextInputField(BaseField):

apps/common/util/file_util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010

1111
def get_file_content(path):
12-
file = open(path, "r",
13-
encoding='utf-8')
14-
content = file.read()
15-
file.close()
12+
with open(path, "r", encoding='utf-8') as file:
13+
content = file.read()
1614
return content

apps/common/util/split_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def parse(self, text: str):
336336
:return: 解析后数据 {content:段落数据,keywords:[‘段落关键词’],parent_chain:['段落父级链路']}
337337
"""
338338
text = text.replace('\r', '\n')
339+
text = text.replace("\0", '')
339340
result_tree = self.parse_to_tree(text, 0)
340341
result = result_tree_to_paragraph(result_tree, [], [])
341342
return [item for item in [self.post_reset_paragraph(row) for row in result] if

apps/setting/models_provider/constants/model_provider_constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
from setting.models_provider.impl.azure_model_provider.azure_model_provider import AzureModelProvider
1212
from setting.models_provider.impl.ollama_model_provider.ollama_model_provider import OllamaModelProvider
1313
from setting.models_provider.impl.openai_model_provider.openai_model_provider import OpenAIModelProvider
14+
from setting.models_provider.impl.qwen_model_provider.qwen_model_provider import QwenModelProvider
1415
from setting.models_provider.impl.wenxin_model_provider.wenxin_model_provider import WenxinModelProvider
16+
from setting.models_provider.impl.kimi_model_provider.kimi_model_provider import KimiModelProvider
1517

1618

1719
class ModelProvideConstants(Enum):
1820
model_azure_provider = AzureModelProvider()
1921
model_wenxin_provider = WenxinModelProvider()
2022
model_ollama_provider = OllamaModelProvider()
2123
model_openai_provider = OpenAIModelProvider()
24+
model_kimi_provider = KimiModelProvider()
25+
model_qwen_provider = QwenModelProvider()

apps/setting/models_provider/impl/azure_model_provider/azure_model_provider.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from langchain.schema import HumanMessage
1313
from langchain_community.chat_models.azure_openai import AzureChatOpenAI
1414

15-
from common import froms
15+
from common import forms
1616
from common.exception.app_exception import AppApiException
17-
from common.froms import BaseForm
17+
from common.forms import BaseForm
1818
from common.util.file_util import get_file_content
1919
from setting.models_provider.base_model_provider import IModelProvider, ModelProvideInfo, BaseModelCredential, \
2020
ModelInfo, \
@@ -51,11 +51,11 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5151
def encryption_dict(self, model: Dict[str, object]):
5252
return {**model, 'api_key': super().encryption(model.get('api_key', ''))}
5353

54-
api_base = froms.TextInputField('API 域名', required=True)
54+
api_base = forms.TextInputField('API 域名', required=True)
5555

56-
api_key = froms.PasswordInputField("API Key", required=True)
56+
api_key = forms.PasswordInputField("API Key", required=True)
5757

58-
deployment_name = froms.TextInputField("部署名", required=True)
58+
deployment_name = forms.TextInputField("部署名", required=True)
5959

6060

6161
class DefaultAzureLLMModelCredential(BaseForm, BaseModelCredential):
@@ -87,13 +87,13 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
8787
def encryption_dict(self, model: Dict[str, object]):
8888
return {**model, 'api_key': super().encryption(model.get('api_key', ''))}
8989

90-
api_version = froms.TextInputField("api_version", required=True)
90+
api_version = forms.TextInputField("api_version", required=True)
9191

92-
api_base = froms.TextInputField('API 域名', required=True)
92+
api_base = forms.TextInputField('API 域名', required=True)
9393

94-
api_key = froms.PasswordInputField("API Key", required=True)
94+
api_key = forms.PasswordInputField("API Key", required=True)
9595

96-
deployment_name = froms.TextInputField("部署名", required=True)
96+
deployment_name = forms.TextInputField("部署名", required=True)
9797

9898

9999
azure_llm_model_credential = AzureLLMModelCredential()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
"""
3+
@project: maxkb
4+
@Author:虎
5+
@file: __init__.py.py
6+
@date:2023/10/31 17:16
7+
@desc:
8+
"""

apps/setting/models_provider/impl/kimi_model_provider/icon/kimi_icon_svg

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)