Add the prefered embedding model to the add_document interface

This commit is contained in:
Josako
2024-05-02 10:19:15 +02:00
parent 659588deab
commit 31250443c2
4 changed files with 18 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
from flask import session
from flask_wtf import FlaskForm
from wtforms import (StringField, BooleanField, SubmitField, DateField,
SelectMultipleField, FieldList, FormField)
SelectField, FieldList, FormField)
from wtforms.validators import DataRequired, Length, Optional
from flask_wtf.file import FileField, FileAllowed, FileRequired
@@ -11,5 +12,12 @@ class AddDocumentForm(FlaskForm):
name = StringField('Name', validators=[Length(max=100)])
language = StringField('Language', validators=[Length(max=2)])
valid_from = DateField('Valid from', id='form-control datepicker', validators=[Optional()])
doc_embedding_model = SelectField('Default Embedding Model', choices=[], validators=[DataRequired()])
submit = SubmitField('Submit')
def __init__(self):
super(AddDocumentForm, self).__init__()
self.doc_embedding_model.choices = [(model, model) for model in
session.get('tenant').get('allowed_embedding_models')]
self.doc_embedding_model.data = session.get('default_embedding_model')