Commit 37ad526a authored by jyong's avatar jyong

add document form and answer field

parent 6040da75
...@@ -206,6 +206,8 @@ class Document(db.Model): ...@@ -206,6 +206,8 @@ class Document(db.Model):
server_default=db.text('CURRENT_TIMESTAMP(0)')) server_default=db.text('CURRENT_TIMESTAMP(0)'))
doc_type = db.Column(db.String(40), nullable=True) doc_type = db.Column(db.String(40), nullable=True)
doc_metadata = db.Column(db.JSON, nullable=True) doc_metadata = db.Column(db.JSON, nullable=True)
doc_form = db.Column(db.String(
255), nullable=False, server_default=db.text("'text_model'::character varying"))
DATA_SOURCES = ['upload_file', 'notion_import'] DATA_SOURCES = ['upload_file', 'notion_import']
...@@ -308,6 +310,7 @@ class DocumentSegment(db.Model): ...@@ -308,6 +310,7 @@ class DocumentSegment(db.Model):
document_id = db.Column(UUID, nullable=False) document_id = db.Column(UUID, nullable=False)
position = db.Column(db.Integer, nullable=False) position = db.Column(db.Integer, nullable=False)
content = db.Column(db.Text, nullable=False) content = db.Column(db.Text, nullable=False)
answer = db.Column(db.Text, nullable=True)
word_count = db.Column(db.Integer, nullable=False) word_count = db.Column(db.Integer, nullable=False)
tokens = db.Column(db.Integer, nullable=False) tokens = db.Column(db.Integer, nullable=False)
...@@ -442,4 +445,4 @@ class Embedding(db.Model): ...@@ -442,4 +445,4 @@ class Embedding(db.Model):
self.embedding = pickle.dumps(embedding_data, protocol=pickle.HIGHEST_PROTOCOL) self.embedding = pickle.dumps(embedding_data, protocol=pickle.HIGHEST_PROTOCOL)
def get_embedding(self) -> list[float]: def get_embedding(self) -> list[float]:
return pickle.loads(self.embedding) return pickle.loads(self.embedding)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment