JinHyeong99 commited on
Commit
f08de3f
Β·
1 Parent(s): 823949f
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -50,8 +50,12 @@ def get_csv_file(csv_docs):
50
  def get_json_file(json_docs):
51
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
52
  temp_filepath = os.path.join(temp_dir.name, json_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
53
- json_loader = JSONLoader()
54
- json_doc = json_loader.load(temp_filepath)
 
 
 
 
55
  return json_doc
56
 
57
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
 
50
  def get_json_file(json_docs):
51
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
52
  temp_filepath = os.path.join(temp_dir.name, json_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
53
+ json_loader = JSONLoader(
54
+ file_path = temp_filepath,
55
+ jq_schema='.messages[].content',
56
+ text_content=False
57
+ )
58
+ json_doc = json_loader.load()
59
  return json_doc
60
 
61
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.