Skip to content

Commit

Permalink
Merge branch 'main' into feat/model-provider-based-on-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel committed Dec 28, 2023
2 parents b78d12e + 972cf3c commit 3440bec
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/services/dataset_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,9 +1104,9 @@ def update_segment(cls, args: dict, segment: DocumentSegment, document: Document
if segment.content == content:
if document.doc_form == 'qa_model':
segment.answer = args['answer']
if args['keywords']:
if 'keywords' in args and args['keywords']:
segment.keywords = args['keywords']
if args['enabled'] is not None:
if'enabled' in args and args['enabled'] is not None:
segment.enabled = args['enabled']
db.session.add(segment)
db.session.commit()
Expand Down
10 changes: 9 additions & 1 deletion api/services/file_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ def get_file_preview(file_id: str) -> str:

# extract text from file
extension = upload_file.extension
if extension.lower() not in ALLOWED_EXTENSIONS:
etl_type = current_app.config['ETL_TYPE']
if etl_type == 'Unstructured':
allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx',
'docx', 'csv', 'eml', 'msg', 'pptx', 'ppt', 'xml',
'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg']
else:
allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', 'docx', 'csv',
'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg']
if extension.lower() not in allowed_extensions:
raise UnsupportedFileTypeError()

text = FileExtractor.load(upload_file, return_text=True)
Expand Down
12 changes: 11 additions & 1 deletion web/app/components/datasets/create/step-two/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
font-size: 13px;
line-height: 18px;
}

.input {
@apply inline-flex h-9 w-full py-1 px-2 rounded-lg text-xs leading-normal;
@apply bg-gray-100 caret-primary-600 hover:bg-gray-100 focus:ring-1 focus:ring-inset focus:ring-gray-200 focus-visible:outline-none focus:bg-white placeholder:text-gray-400;
Expand Down Expand Up @@ -316,16 +317,19 @@
.fileIcon.json {
background-image: url(../assets/json.svg);
}

.sourceContent {
flex: 1 1 auto;
}

.sourceCount {
@apply shrink-0 ml-1;
font-weight: 500;
font-size: 13px;
line-height: 18px;
color: #667085;
}

.segmentCount {
flex: 1 1 30%;
max-width: 120px;
Expand Down Expand Up @@ -382,6 +386,10 @@

.previewWrap {
flex-shrink: 0;
width: 524px;
}

.previewWrap.isMobile {
max-width: 524px;
}

Expand Down Expand Up @@ -410,15 +418,17 @@
backdrop-filter: blur(4px);
animation: fix 0.5s;
}

@keyframes fix {
from {
padding-top: 42px;
font-size: 18px;
line-height: 28px;
}

to {
padding-top: 12px;
font-size: 12px;
line-height: 18px;
}
}
}
2 changes: 1 addition & 1 deletion web/app/components/datasets/create/step-two/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ const StepTwo = ({
</div>
</div>
<FloatRightContainer isMobile={isMobile} isOpen={showPreview} onClose={hidePreview} footer={null}>
{showPreview && <div ref={previewScrollRef} className={cn(s.previewWrap, 'relative h-full overflow-y-scroll border-l border-[#F2F4F7]')}>
{showPreview && <div ref={previewScrollRef} className={cn(s.previewWrap, isMobile && s.isMobile, 'relative h-full overflow-y-scroll border-l border-[#F2F4F7]')}>
<div className={cn(s.previewHeader, previewScrolled && `${s.fixed} pb-3`)}>
<div className='flex items-center justify-between px-8'>
<div className='grow flex items-center'>
Expand Down

0 comments on commit 3440bec

Please sign in to comment.