Skip to content

Commit 19ab61a

Browse files
Merge branch 'main' of https://github.com/maxkb-dev/maxkb
2 parents a528de7 + aa4a834 commit 19ab61a

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

apps/setting/models_provider/impl/ollama_model_provider/model/llm.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from urllib.parse import urlparse, ParseResult
1111

1212
from langchain_core.messages import BaseMessage, get_buffer_string
13-
from langchain_openai.chat_models import ChatOpenAI
13+
from langchain_ollama.chat_models import ChatOllama
14+
1415

1516
from common.config.tokenizer_manage_config import TokenizerManage
1617
from setting.models_provider.base_model_provider import MaxKBBaseModel
@@ -24,7 +25,7 @@ def get_base_url(url: str):
2425
return result_url[:-1] if result_url.endswith("/") else result_url
2526

2627

27-
class OllamaChatModel(MaxKBBaseModel, ChatOpenAI):
28+
class OllamaChatModel(MaxKBBaseModel, ChatOllama):
2829
@staticmethod
2930
def is_cache_model():
3031
return False
@@ -33,12 +34,10 @@ def is_cache_model():
3334
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
3435
api_base = model_credential.get('api_base', '')
3536
base_url = get_base_url(api_base)
36-
base_url = base_url if base_url.endswith('/v1') else (base_url + '/v1')
3737
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
3838

39-
return OllamaChatModel(model=model_name, openai_api_base=base_url,
40-
openai_api_key=model_credential.get('api_key'),
41-
stream_usage=True, **optional_params)
39+
return OllamaChatModel(model=model_name, base_url=base_url,
40+
stream=True, **optional_params)
4241

4342
def get_num_tokens_from_messages(self, messages: List[BaseMessage]) -> int:
4443
tokenizer = TokenizerManage.get_tokenizer()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pycryptodome = "^3.19.0"
2828
beautifulsoup4 = "^4.12.2"
2929
html2text = "^2024.2.26"
3030
langchain-openai = "^0.1.8"
31+
langchain-ollama = "0.1.3"
3132
django-ipware = "^6.0.4"
3233
django-apscheduler = "^0.6.2"
3334
pymupdf = "1.24.9"

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@
244244
editorId="preview-only"
245245
:modelValue="item.answer"
246246
style="background: none"
247+
noImgZoomIn
247248
/>
248249
<template v-else> -</template>
249250
</div>
@@ -264,6 +265,7 @@
264265
editorId="preview-only"
265266
:modelValue="item.answer"
266267
style="background: none"
268+
noImgZoomIn
267269
/>
268270
<template v-else> -</template>
269271
</el-scrollbar>
@@ -300,6 +302,7 @@
300302
editorId="preview-only"
301303
:modelValue="file_content"
302304
style="background: none"
305+
noImgZoomIn
303306
/>
304307
<template v-else> -</template>
305308
</el-card>
@@ -351,6 +354,7 @@
351354
editorId="preview-only"
352355
:modelValue="file_content"
353356
style="background: none"
357+
noImgZoomIn
354358
/>
355359
<template v-else> -</template>
356360
</el-card>
@@ -374,6 +378,7 @@
374378
editorId="preview-only"
375379
:modelValue="item.content"
376380
style="background: none"
381+
noImgZoomIn
377382
/>
378383
</div>
379384
</div>
@@ -573,6 +578,7 @@
573578
editorId="preview-only"
574579
:modelValue="item.answer"
575580
style="background: none"
581+
noImgZoomIn
576582
/>
577583
<template v-else> -</template>
578584
</div>
@@ -603,6 +609,7 @@
603609
editorId="preview-only"
604610
:modelValue="item.answer"
605611
style="background: none"
612+
noImgZoomIn
606613
/>
607614
<template v-else> -</template>
608615
</div>

ui/src/views/document/index.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@
6464
:storeKey="storeKey"
6565
>
6666
<el-table-column type="selection" width="55" :reserve-selection="true" />
67-
<el-table-column
68-
prop="name"
69-
:label="$t('views.document.table.name')"
70-
min-width="280"
71-
sortable
72-
>
67+
<el-table-column prop="name" :label="$t('views.document.table.name')" min-width="280">
7368
<template #default="{ row }">
7469
<ReadWrite
7570
@change="editName($event, row.id)"
@@ -250,12 +245,7 @@
250245
{{ $t(hitHandlingMethod[row.hit_handling_method as keyof typeof hitHandlingMethod]) }}
251246
</template>
252247
</el-table-column>
253-
<el-table-column
254-
prop="create_time"
255-
:label="$t('common.createTime')"
256-
width="175"
257-
sortable
258-
>
248+
<el-table-column prop="create_time" :label="$t('common.createTime')" width="175" sortable>
259249
<template #default="{ row }">
260250
{{ datetimeFormat(row.create_time) }}
261251
</template>
@@ -829,7 +819,7 @@ function getList(bool?: boolean) {
829819
const param = {
830820
...(filterText.value && { name: filterText.value }),
831821
...filterMethod.value,
832-
order_by: orderBy.value,
822+
order_by: orderBy.value
833823
}
834824
documentApi
835825
.getDocument(id as string, paginationConfig.value, param, bool ? undefined : loading)

0 commit comments

Comments
 (0)