This commit is contained in:
liqiang-fit2cloud 2024-12-02 18:43:18 +08:00
commit f48ce1fcdf
9 changed files with 36 additions and 21 deletions

View File

@ -115,7 +115,11 @@ class BaseImageUnderstandNode(IImageUnderstandNode):
image_list = data['image_list']
if len(image_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
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)
def get_history_message(self, history_chat_record, dialogue_number):

View File

@ -165,7 +165,7 @@ function initMaxkbStyle(root){
#maxkb .maxkb-mask .maxkb-content {
width: 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;
{{x_type}}: {{x_value}}px;
{{y_type}}: {{y_value}}px;
@ -244,6 +244,7 @@ function initMaxkbStyle(root){
cursor: pointer;
max-height:500px;
max-width:500px;
z-index:10000;
}
#maxkb #maxkb-chat-container{
z-index:10000;position: relative;

View File

@ -39,11 +39,12 @@ def clean_chat_log_job():
with transaction.atomic():
logs_to_delete = Chat.objects.filter(query_conditions).values_list('id', flat=True)[:batch_size]
count = logs_to_delete.count()
logs_to_delete_str = [str(uuid) for uuid in logs_to_delete]
if count == 0:
break
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:
break
@ -57,6 +58,6 @@ def run():
existing_job = scheduler.get_job(job_id='clean_chat_log')
if existing_job is not None:
existing_job.remove()
scheduler.add_job(clean_chat_log_job, 'cron', hour='0', minute='5', id='clean_chat_log')
scheduler.add_job(clean_chat_log_job, 'cron', hour='0', minute='5', id='clean_chat_log')
finally:
lock.un_lock('clean_chat_log_job')

View File

@ -17,7 +17,7 @@ from django.db.models import QuerySet
from common.config.embedding_config import ModelManage
from common.event import ListenerManagement, UpdateProblemArgs, UpdateEmbeddingDatasetIdArgs, \
UpdateEmbeddingDocumentIdArgs
from dataset.models import Document, Status
from dataset.models import Document, Status, TaskType, State
from ops import celery_app
from setting.models import Model
from setting.models_provider import get_model
@ -66,8 +66,8 @@ def embedding_by_document(document_id, model_id):
"""
def exception_handler(e):
QuerySet(Document).filter(id=document_id).update(
**{'status': Status.error, 'update_time': datetime.datetime.now()})
ListenerManagement.update_status(QuerySet(Document).filter(id=document_id), TaskType.EMBEDDING,
State.FAILURE)
max_kb_error.error(
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]}")
for document in document_list:
try:
print(document.id, model_id)
embedding_by_document.delay(document.id, model_id)
except Exception as e:
pass

View File

@ -410,7 +410,6 @@
<h5 class="p-8-12">本次对话</h5>
<div class="p-8-12 border-t-dashed lighter pre-wrap">
<div v-if="item.image_list?.length > 0">
<p class="mb-8 color-secondary">图片:</p>
<el-space wrap>
<template v-for="(f, i) in item.image_list" :key="i">
<el-image
@ -424,7 +423,6 @@
</el-space>
</div>
<div>
<p class="mb-8 color-secondary">提示词</p>
{{ item.question || '-' }}
</div>
</div>

View File

@ -125,7 +125,12 @@ const open = async (platform: Platform) => {
currentPlatform.config.corp_id = 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
case 'lark':
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/feishu`

View File

@ -131,7 +131,6 @@ function createPlatform(key: string, name: string): Platform {
const config = {
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
...(key === 'dingtalk' ? { corp_id: '' } : {}),
app_secret: '',
callback_url: ''
}
@ -172,6 +171,15 @@ function getPlatformInfo() {
isActive: data.is_active,
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]['app_secret'] = false
}

View File

@ -49,7 +49,7 @@
:sm="12"
:md="8"
:lg="6"
:xl="4"
:xl="6"
v-for="(item, index) in functionLibList"
:key="index"
class="mb-16"

View File

@ -113,18 +113,16 @@ import { type FormInstance } from 'element-plus'
import { ref, onMounted, computed } from 'vue'
import { input_type_list } from '@/components/dynamics-form/constructor/data'
import { MsgError } from '@/utils/message'
import { set,cloneDeep } from 'lodash'
import { set, cloneDeep } from 'lodash'
const props = defineProps<{ nodeModel: any }>()
const formNodeFormRef = ref<FormInstance>()
const editFormField = (form_field_data: any, field_index: number) => {
const _value=form_data.value.form_field_list.map(
(item: any, index: number) => {
if (field_index === index) {
return cloneDeep(form_field_data)
}
return cloneDeep(item)
const _value = form_data.value.form_field_list.map((item: any, index: number) => {
if (field_index === index) {
return cloneDeep(form_field_data)
}
)
return cloneDeep(item)
})
form_data.value.form_field_list = _value
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(
(field: any) => field.field !== form_field_data.field
)
sync_form_field_list()
}
const form = ref<any>({
is_result: true,