DDingcheol commited on
Commit
3bd7aa1
Β·
1 Parent(s): ef9ba64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -49,14 +49,13 @@ def get_csv_file(csv_docs):
49
  def get_json_file(json_docs):
50
  temp_dir = tempfile.TemporaryDirectory()
51
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
52
- with open(temp_filepath, "wb") as f:
53
- f.write(json_docs.getvalue())
54
- json_loader = JSONLoader(file_path=temp_filepath)
55
  json_doc = json_loader.load()
56
  return json_doc
57
 
58
 
59
-
60
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
61
  def get_text_chunks(documents):
62
  text_splitter = RecursiveCharacterTextSplitter(
 
49
  def get_json_file(json_docs):
50
  temp_dir = tempfile.TemporaryDirectory()
51
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
52
+ with open(temp_filepath, "wb") as f:
53
+ f.write(json_docs.getvalue())
54
+ json_loader = JSONLoader(file_path=temp_filepath, jq_schema='.messages[].content', text_content=False)
55
  json_doc = json_loader.load()
56
  return json_doc
57
 
58
 
 
59
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
60
  def get_text_chunks(documents):
61
  text_splitter = RecursiveCharacterTextSplitter(