lds204 commited on
Commit
5cf4ca2
Β·
1 Parent(s): 06b9841
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -50,7 +50,13 @@ def get_json_file(json_docs):
50
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
51
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
52
  f.write(json_docs.getvalue())
53
- json_doc = json.loads(Path(temp_filepath).read_text())
 
 
 
 
 
 
54
  return json_doc
55
 
56
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
 
50
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
51
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
52
  f.write(json_docs.getvalue())
53
+
54
+ json_loader = JSONLoader(
55
+ file_path = temp_filepath,
56
+ jq_schema='.messages[].content',
57
+ text_content=True)
58
+
59
+ json_doc = json_loader.load()
60
  return json_doc
61
 
62
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.