Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Fix issue with Windows paths being interpreted as escape characters

davidmezzetti2c76a79d4a08
diff --git a/src/python/txtai/console/base.py b/src/python/txtai/console/base.py
index 855ff482..de5f1679 100644
--- a/src/python/txtai/console/base.py
+++ b/src/python/txtai/console/base.py
@@ -72,7 +72,7 @@ class Console(Cmd):
elif command.startswith(".limit"):
self.limit(command)
elif command.startswith(".load"):
- command = shlex.split(line)
+ command = self.split(line)
self.path = command[1]
self.load(self.path)
elif command.startswith(".workflow"):
@@ -144,7 +144,7 @@ class Console(Cmd):
if isinstance(self.app, Application):
self.console.print(list(self.app.workflow(command[1], command[2:])))
- def split(self, command, default):
+ def split(self, command, default=None):
"""
Splits command by whitespace.
diff --git a/test/python/testconsole.py b/test/python/testconsole.py
index 49e55797..f71444d8 100644
--- a/test/python/testconsole.py
+++ b/test/python/testconsole.py
@@ -66,7 +66,7 @@ class TestConsole(unittest.TestCase):
Test application
"""
- self.assertIn("console.yml", self.command(".load " + self.apppath))
+ self.assertIn("console.yml", self.command(f".load {self.apppath}"))
self.assertIn("1", self.command(".limit 1"))
self.assertIn("Maine man wins", self.command("feel good story"))
@@ -82,7 +82,7 @@ class TestConsole(unittest.TestCase):
Test embeddings index
"""
- self.assertIn("embeddings", self.command(".load " + self.embedpath))
+ self.assertIn("embeddings", self.command(f".load {self.embedpath}"))
self.assertIn("1", self.command(".limit 1"))
self.assertIn("Maine man wins", self.command("feel good story"))
@@ -132,7 +132,7 @@ class TestConsole(unittest.TestCase):
Test .workflow command
"""
- self.command(".load " + self.apppath)
+ self.command(f".load {self.apppath}")
self.assertIn("echo", self.command(".workflow test echo"))
def command(self, command, console=None):