Skip to content

Commit fafa1a0

Browse files
author
Zhe Yu
committed
feat(nvim): Improve error message when collection hasn't been vectorised
1 parent 12ce415 commit fafa1a0

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

lua/vectorcode/integrations/codecompanion/query_tool.lua

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,23 @@ For example, you should include `parameter`, `arguments` and `return value` for
181181
)
182182
)
183183
stderr = cc_common.flatten_table_to_string(stderr)
184-
agent.chat:add_tool_output(
185-
self,
186-
string.format("**VectorCode Tool**: Failed with error:\n```\n%s\n```", stderr)
187-
)
184+
if string.find(stderr, "InvalidCollectionException") then
185+
agent.chat:add_tool_output(
186+
self,
187+
string.format(
188+
"`%s` hasn't been vectorised. Please use the `vectorcode_vectorise` tool or vectorise it from the CLI.",
189+
cmd.project_root
190+
)
191+
)
192+
else
193+
agent.chat:add_tool_output(
194+
self,
195+
string.format(
196+
"**VectorCode Tool**: Failed with error:\n```\n%s\n```",
197+
stderr
198+
)
199+
)
200+
end
188201
end,
189202
---@param agent CodeCompanion.Agent
190203
---@param cmd QueryToolArgs

0 commit comments

Comments
 (0)