Skip to content

Commit d1075fb

Browse files
authored
Merge pull request #120 from cagostino/chris/comp_bug
fixing a compile bug where it was dropping the absolute path before a…
2 parents 5432ead + 88020a1 commit d1075fb

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

npcsh/helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ def get_npc_path(npc_name: str, db_path: str) -> str:
406406
query = f"SELECT source_path FROM compiled_npcs WHERE name = {npc_name}"
407407
cursor.execute(query)
408408
result = cursor.fetchone()
409-
print(result)
410409
if result:
411410
return result[0]
412411
except Exception as e:

npcsh/npc_compiler.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ def {tool.tool_name}_execute(inputs):
751751
def compile(self, npc_file: str):
752752
self.npc_cache.clear() # Clear the cache
753753
self.resolved_npcs.clear()
754-
755754
if isinstance(npc_file, NPC):
756755
npc_file = npc_file.name + ".npc"
757756
if not npc_file.endswith(".npc"):
@@ -1044,7 +1043,7 @@ def update_compiled_npcs_table(self, npc_file, parsed_content) -> None:
10441043

10451044

10461045
def load_npc_from_file(npc_file: str, db_conn: sqlite3.Connection) -> NPC:
1047-
# print(npc_file)
1046+
10481047
if not npc_file.endswith(".npc"):
10491048
# append it just incase
10501049
name += ".npc"
@@ -1964,9 +1963,9 @@ def _execute_ai_model(self, sql: str, model: SQLModel) -> pd.DataFrame:
19641963
)
19651964

19661965
# Optionally pull the synthesized data into a new column
1967-
df[
1968-
"ai_analysis"
1969-
] = synthesized_df # Adjust as per what synthesize returns
1966+
df["ai_analysis"] = (
1967+
synthesized_df # Adjust as per what synthesize returns
1968+
)
19701969

19711970
return df
19721971

npcsh/shell_helpers.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,12 +1165,14 @@ def execute_slash_command(
11651165
compiled_script = npc_compiler.compile(current_npc)
11661166
output = f"Compiled NPC profile: {compiled_script}"
11671167
else: # Compile all NPCs in the directory
1168-
output = ''
1168+
output = ""
11691169
for filename in os.listdir(npc_compiler.npc_directory):
11701170
if filename.endswith(".npc"):
11711171
try:
1172-
compiled_script = npc_compiler.compile(filename)
1173-
output += f"Compiled NPC profile: {compiled_script['name']}\n"
1172+
compiled_script = npc_compiler.compile(npc_compiler.npc_directory+'/'+filename)
1173+
output += (
1174+
f"Compiled NPC profile: {compiled_script['name']}\n"
1175+
)
11741176
except Exception as e:
11751177
output += f"Error compiling {filename}: {str(e)}\n"
11761178

@@ -1778,6 +1780,7 @@ def execute_command(
17781780
if npc_name is None:
17791781
npc_name = "sibiji" # Default NPC
17801782
npc_path = get_npc_path(npc_name, db_path)
1783+
17811784
npc = load_npc_from_file(npc_path, db_conn)
17821785
else:
17831786
npc = current_npc
@@ -2705,9 +2708,11 @@ def enter_spool_mode(
27052708
command_history,
27062709
conversation_id,
27072710
"user",
2708-
user_prompt
2709-
if user_prompt
2710-
else f"Please analyze this image: {filename}",
2711+
(
2712+
user_prompt
2713+
if user_prompt
2714+
else f"Please analyze this image: {filename}"
2715+
),
27112716
wd=os.getcwd(),
27122717
model=model,
27132718
provider=provider,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_setup_message():
5757

5858
setup(
5959
name="npcsh",
60-
version="0.3.16",
60+
version="0.3.17",
6161
packages=find_packages(exclude=["tests*"]),
6262
install_requires=[
6363
"redis",

0 commit comments

Comments
 (0)