main
HuangHai 4 weeks ago
parent d43db4d172
commit 6490ee9677

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.10 (3)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.10" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (3)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
</project>

@ -96,6 +96,5 @@ if __name__ == "__main__":
# 创建新的向量索引
manage_index("create", "vector", dims=200)
# 创建新的原始文本索引
manage_index("create", "text")

@ -23,8 +23,6 @@ def split_paragraphs(text):
paragraphs = [p.strip() for p in text.split('\n\n') if p.strip()]
return paragraphs
# 修改process_file函数
# Move save_to_es function definition before process_file
def save_to_es(text):
"""保存向量化文本和原始文本到ES"""
vector = text_to_embedding(text)
@ -46,7 +44,6 @@ def save_to_es(text):
except Exception as e:
logger.error(f"保存文本到ES失败: {e}")
# Then define process_file function
def process_file(file_path):
"""处理文本文件"""
with open(file_path, 'r', encoding='utf-8') as f:

Loading…
Cancel
Save