Update app.py
Browse files
app.py
CHANGED
@@ -67,17 +67,18 @@ def get_text_chunks(documents):
|
|
67 |
# ๊ฐ ๋ฌธ์์ ๋ด์ฉ์ ๋ฆฌ์คํธ์ ์ถ๊ฐ
|
68 |
texts = []
|
69 |
for doc in documents:
|
70 |
-
if
|
|
|
|
|
|
|
71 |
# ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ ๊ทธ๋๋ก ์ถ๊ฐ
|
72 |
texts.append(doc)
|
73 |
-
else:
|
74 |
-
# ๊ทธ ์ธ์ ๊ฒฝ์ฐ์๋ ๋ฌธ์์ ๋ด์ฉ์ ์ถ๊ฐ
|
75 |
-
texts.append(doc.page_content)
|
76 |
|
77 |
# ๋๋ ์ฒญํฌ๋ฅผ ๋ฐํ
|
78 |
return text_splitter.split_documents(texts)
|
79 |
|
80 |
|
|
|
81 |
# ํ
์คํธ ์ฒญํฌ๋ค๋ก๋ถํฐ ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํ๋ ํจ์์
๋๋ค.
|
82 |
def get_vectorstore(text_chunks):
|
83 |
# OpenAI ์๋ฒ ๋ฉ ๋ชจ๋ธ์ ๋ก๋ํฉ๋๋ค. (Embedding models - Ada v2)
|
|
|
67 |
# ๊ฐ ๋ฌธ์์ ๋ด์ฉ์ ๋ฆฌ์คํธ์ ์ถ๊ฐ
|
68 |
texts = []
|
69 |
for doc in documents:
|
70 |
+
if hasattr(doc, 'page_content'):
|
71 |
+
# ๋ฌธ์ ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ์๋ง ์ถ๊ฐ
|
72 |
+
texts.append(doc.page_content)
|
73 |
+
elif isinstance(doc, str):
|
74 |
# ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ ๊ทธ๋๋ก ์ถ๊ฐ
|
75 |
texts.append(doc)
|
|
|
|
|
|
|
76 |
|
77 |
# ๋๋ ์ฒญํฌ๋ฅผ ๋ฐํ
|
78 |
return text_splitter.split_documents(texts)
|
79 |
|
80 |
|
81 |
+
|
82 |
# ํ
์คํธ ์ฒญํฌ๋ค๋ก๋ถํฐ ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํ๋ ํจ์์
๋๋ค.
|
83 |
def get_vectorstore(text_chunks):
|
84 |
# OpenAI ์๋ฒ ๋ฉ ๋ชจ๋ธ์ ๋ก๋ํฉ๋๋ค. (Embedding models - Ada v2)
|