Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
f48ce1fcdf
@ -115,7 +115,11 @@ class BaseImageUnderstandNode(IImageUnderstandNode):
|
|||||||
image_list = data['image_list']
|
image_list = data['image_list']
|
||||||
if len(image_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
|
if len(image_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
|
||||||
return HumanMessage(content=chat_record.problem_text)
|
return HumanMessage(content=chat_record.problem_text)
|
||||||
return HumanMessage(content=data['question'])
|
file_id = image_list[0]['file_id']
|
||||||
|
return HumanMessage(content=[
|
||||||
|
{'type': 'text', 'text': data['question']},
|
||||||
|
{'type': 'image_url', 'image_url': {'url': f'/api/file/{file_id}'}},
|
||||||
|
])
|
||||||
return HumanMessage(content=chat_record.problem_text)
|
return HumanMessage(content=chat_record.problem_text)
|
||||||
|
|
||||||
def get_history_message(self, history_chat_record, dialogue_number):
|
def get_history_message(self, history_chat_record, dialogue_number):
|
||||||
|
|||||||
@ -165,7 +165,7 @@ function initMaxkbStyle(root){
|
|||||||
#maxkb .maxkb-mask .maxkb-content {
|
#maxkb .maxkb-mask .maxkb-content {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
box-shadow: 1px 1px 1px 2000px rgba(0,0,0,.6);
|
box-shadow: 1px 1px 1px 9999px rgba(0,0,0,.6);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
{{x_type}}: {{x_value}}px;
|
{{x_type}}: {{x_value}}px;
|
||||||
{{y_type}}: {{y_value}}px;
|
{{y_type}}: {{y_value}}px;
|
||||||
@ -244,6 +244,7 @@ function initMaxkbStyle(root){
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
max-height:500px;
|
max-height:500px;
|
||||||
max-width:500px;
|
max-width:500px;
|
||||||
|
z-index:10000;
|
||||||
}
|
}
|
||||||
#maxkb #maxkb-chat-container{
|
#maxkb #maxkb-chat-container{
|
||||||
z-index:10000;position: relative;
|
z-index:10000;position: relative;
|
||||||
|
|||||||
@ -39,11 +39,12 @@ def clean_chat_log_job():
|
|||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
logs_to_delete = Chat.objects.filter(query_conditions).values_list('id', flat=True)[:batch_size]
|
logs_to_delete = Chat.objects.filter(query_conditions).values_list('id', flat=True)[:batch_size]
|
||||||
count = logs_to_delete.count()
|
count = logs_to_delete.count()
|
||||||
|
logs_to_delete_str = [str(uuid) for uuid in logs_to_delete]
|
||||||
if count == 0:
|
if count == 0:
|
||||||
break
|
break
|
||||||
deleted_count, _ = Chat.objects.filter(id__in=logs_to_delete).delete()
|
deleted_count, _ = Chat.objects.filter(id__in=logs_to_delete).delete()
|
||||||
# 删除对应的文件
|
# 删除对应的文件
|
||||||
File.objects.filter(meta__chat_id__in=[str(uuid) for uuid in logs_to_delete]).delete()
|
File.objects.filter(meta__chat_id__in=logs_to_delete_str).delete()
|
||||||
if deleted_count < batch_size:
|
if deleted_count < batch_size:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from django.db.models import QuerySet
|
|||||||
from common.config.embedding_config import ModelManage
|
from common.config.embedding_config import ModelManage
|
||||||
from common.event import ListenerManagement, UpdateProblemArgs, UpdateEmbeddingDatasetIdArgs, \
|
from common.event import ListenerManagement, UpdateProblemArgs, UpdateEmbeddingDatasetIdArgs, \
|
||||||
UpdateEmbeddingDocumentIdArgs
|
UpdateEmbeddingDocumentIdArgs
|
||||||
from dataset.models import Document, Status
|
from dataset.models import Document, Status, TaskType, State
|
||||||
from ops import celery_app
|
from ops import celery_app
|
||||||
from setting.models import Model
|
from setting.models import Model
|
||||||
from setting.models_provider import get_model
|
from setting.models_provider import get_model
|
||||||
@ -66,8 +66,8 @@ def embedding_by_document(document_id, model_id):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def exception_handler(e):
|
def exception_handler(e):
|
||||||
QuerySet(Document).filter(id=document_id).update(
|
ListenerManagement.update_status(QuerySet(Document).filter(id=document_id), TaskType.EMBEDDING,
|
||||||
**{'status': Status.error, 'update_time': datetime.datetime.now()})
|
State.FAILURE)
|
||||||
max_kb_error.error(
|
max_kb_error.error(
|
||||||
f'获取向量模型失败:{str(e)}{traceback.format_exc()}')
|
f'获取向量模型失败:{str(e)}{traceback.format_exc()}')
|
||||||
|
|
||||||
@ -102,7 +102,6 @@ def embedding_by_dataset(dataset_id, model_id):
|
|||||||
max_kb.info(f"数据集文档:{[d.name for d in document_list]}")
|
max_kb.info(f"数据集文档:{[d.name for d in document_list]}")
|
||||||
for document in document_list:
|
for document in document_list:
|
||||||
try:
|
try:
|
||||||
print(document.id, model_id)
|
|
||||||
embedding_by_document.delay(document.id, model_id)
|
embedding_by_document.delay(document.id, model_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -410,7 +410,6 @@
|
|||||||
<h5 class="p-8-12">本次对话</h5>
|
<h5 class="p-8-12">本次对话</h5>
|
||||||
<div class="p-8-12 border-t-dashed lighter pre-wrap">
|
<div class="p-8-12 border-t-dashed lighter pre-wrap">
|
||||||
<div v-if="item.image_list?.length > 0">
|
<div v-if="item.image_list?.length > 0">
|
||||||
<p class="mb-8 color-secondary">图片:</p>
|
|
||||||
<el-space wrap>
|
<el-space wrap>
|
||||||
<template v-for="(f, i) in item.image_list" :key="i">
|
<template v-for="(f, i) in item.image_list" :key="i">
|
||||||
<el-image
|
<el-image
|
||||||
@ -424,7 +423,6 @@
|
|||||||
</el-space>
|
</el-space>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p class="mb-8 color-secondary">提示词:</p>
|
|
||||||
{{ item.question || '-' }}
|
{{ item.question || '-' }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -125,7 +125,12 @@ const open = async (platform: Platform) => {
|
|||||||
currentPlatform.config.corp_id = currentPlatform.config.agent_id
|
currentPlatform.config.corp_id = currentPlatform.config.agent_id
|
||||||
delete currentPlatform.config.agent_id
|
delete currentPlatform.config.agent_id
|
||||||
}
|
}
|
||||||
currentPlatform.config.callback_url = defaultCallbackUrl
|
currentPlatform.config = {
|
||||||
|
corp_id: currentPlatform.config.corp_id,
|
||||||
|
app_key: currentPlatform.config.app_key,
|
||||||
|
app_secret: currentPlatform.config.app_secret,
|
||||||
|
callback_url: defaultCallbackUrl
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'lark':
|
case 'lark':
|
||||||
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/feishu`
|
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/feishu`
|
||||||
|
|||||||
@ -131,7 +131,6 @@ function createPlatform(key: string, name: string): Platform {
|
|||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
|
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
|
||||||
...(key === 'dingtalk' ? { corp_id: '' } : {}),
|
|
||||||
app_secret: '',
|
app_secret: '',
|
||||||
callback_url: ''
|
callback_url: ''
|
||||||
}
|
}
|
||||||
@ -172,6 +171,15 @@ function getPlatformInfo() {
|
|||||||
isActive: data.is_active,
|
isActive: data.is_active,
|
||||||
config: data.config
|
config: data.config
|
||||||
})
|
})
|
||||||
|
if (platform.key === 'dingtalk') {
|
||||||
|
const { corp_id, app_key, app_secret } = platform.config
|
||||||
|
platform.config = {
|
||||||
|
corp_id,
|
||||||
|
app_key,
|
||||||
|
app_secret,
|
||||||
|
callback_url: platform.config.callback_url
|
||||||
|
}
|
||||||
|
}
|
||||||
showPassword[platform.key] = {}
|
showPassword[platform.key] = {}
|
||||||
showPassword[platform.key]['app_secret'] = false
|
showPassword[platform.key]['app_secret'] = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
:sm="12"
|
:sm="12"
|
||||||
:md="8"
|
:md="8"
|
||||||
:lg="6"
|
:lg="6"
|
||||||
:xl="4"
|
:xl="6"
|
||||||
v-for="(item, index) in functionLibList"
|
v-for="(item, index) in functionLibList"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="mb-16"
|
class="mb-16"
|
||||||
|
|||||||
@ -117,14 +117,12 @@ import { set,cloneDeep } from 'lodash'
|
|||||||
const props = defineProps<{ nodeModel: any }>()
|
const props = defineProps<{ nodeModel: any }>()
|
||||||
const formNodeFormRef = ref<FormInstance>()
|
const formNodeFormRef = ref<FormInstance>()
|
||||||
const editFormField = (form_field_data: any, field_index: number) => {
|
const editFormField = (form_field_data: any, field_index: number) => {
|
||||||
const _value=form_data.value.form_field_list.map(
|
const _value = form_data.value.form_field_list.map((item: any, index: number) => {
|
||||||
(item: any, index: number) => {
|
|
||||||
if (field_index === index) {
|
if (field_index === index) {
|
||||||
return cloneDeep(form_field_data)
|
return cloneDeep(form_field_data)
|
||||||
}
|
}
|
||||||
return cloneDeep(item)
|
return cloneDeep(item)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
form_data.value.form_field_list = _value
|
form_data.value.form_field_list = _value
|
||||||
sync_form_field_list()
|
sync_form_field_list()
|
||||||
}
|
}
|
||||||
@ -161,6 +159,7 @@ const deleteField = (form_field_data: any) => {
|
|||||||
form_data.value.form_field_list = form_data.value.form_field_list.filter(
|
form_data.value.form_field_list = form_data.value.form_field_list.filter(
|
||||||
(field: any) => field.field !== form_field_data.field
|
(field: any) => field.field !== form_field_data.field
|
||||||
)
|
)
|
||||||
|
sync_form_field_list()
|
||||||
}
|
}
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
is_result: true,
|
is_result: true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user