-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccb09cc
commit 62ef51d
Showing
6 changed files
with
146 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
from enum import Enum | ||
from metagpt.const import METAGPT_ROOT as TIANJI_PATH | ||
from metagpt.logs import logger | ||
|
||
""" | ||
def get_all_knowledge_paths(knowledge_path: str = METAGPT_ROOT, suffix: str = ".txt"): | ||
files = os.listdir(knowledge_path) | ||
all_knowledge_paths = [] | ||
for file in files: | ||
file_path = os.path.join(knowledge_path, file) | ||
if os.path.isdir(file_path): | ||
all_knowledge_paths.extend(get_all_knowledge_paths(file_path)) | ||
else: | ||
if file_path.endswith(suffix): | ||
all_knowledge_paths.append(knowledge_path) | ||
return all_knowledge_paths | ||
""" | ||
|
||
|
||
class KNOWLEDGE_PATH(str, Enum): | ||
WISHES = TIANJI_PATH / "tianji/knowledges/04-Wishes" | ||
|
||
def path(self): | ||
load_path = self.value | ||
logger.info("加载知识库:" + load_path) | ||
|
||
return os.path.join(load_path, "knowledges.txt") | ||
|
||
|
||
class EMBEDDING_PATH(str, Enum): | ||
WISHES = TIANJI_PATH / "temp/embedding/04-Wishes" | ||
|
||
def path(self, filename="other"): | ||
save_path = os.path.join(self.value, filename) | ||
logger.info("Embedding 路径:" + save_path) | ||
|
||
return save_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters