Browse Source

make excel parsing configurable (#2517)

### What problem does this PR solve?

#2516

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
tags/v0.12.0
Kevin Hu 1 year ago
parent
commit
78856703c4
No account linked to committer's email address
2 changed files with 5 additions and 1 deletions
  1. 4
    1
      rag/app/naive.py
  2. 1
    0
      rag/llm/chat_model.py

+ 4
- 1
rag/app/naive.py View File

elif re.search(r"\.xlsx?$", filename, re.IGNORECASE): elif re.search(r"\.xlsx?$", filename, re.IGNORECASE):
callback(0.1, "Start to parse.") callback(0.1, "Start to parse.")
excel_parser = ExcelParser() excel_parser = ExcelParser()
sections = [(l, "") for l in excel_parser.html(binary) if l]
if parser_config.get("html4excel"):
sections = [(l, "") for l in excel_parser.html(binary, 12) if l]
else:
sections = [(l, "") for l in excel_parser(binary) if l]


elif re.search(r"\.(txt|py|js|java|c|cpp|h|php|go|ts|sh|cs|kt|sql)$", filename, re.IGNORECASE): elif re.search(r"\.(txt|py|js|java|c|cpp|h|php|go|ts|sh|cs|kt|sql)$", filename, re.IGNORECASE):
callback(0.1, "Start to parse.") callback(0.1, "Start to parse.")

+ 1
- 0
rag/llm/chat_model.py View File



yield num_tokens_from_string(ans) yield num_tokens_from_string(ans)



class GeminiChat(Base): class GeminiChat(Base):


def __init__(self, key, model_name,base_url=None): def __init__(self, key, model_name,base_url=None):

Loading…
Cancel
Save