-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation tools #213
base: dev
Are you sure you want to change the base?
Documentation tools #213
Conversation
src/at_tools/att_doc_sources.rs
Outdated
"list" => doc_sources_list(ccx, tool_call_id).await, | ||
"add" => doc_sources_add(ccx, tool_call_id, args).await, | ||
"remove" => doc_sources_remove(ccx, tool_call_id, args).await, | ||
_ => Err(format!("Unknown action `{}`", action)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown argument action {}
. Action must be one of add
, remove
, list
src/at_tools/att_doc_sources.rs
Outdated
|
||
if source.starts_with("http://") || source.starts_with("https://") { | ||
if let Some((dir, _)) = get_directory_and_file_from_url(&source) { | ||
let dir = format!("./.refact/docs/{dir}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why writing into ./.refact. We already have .refact directory at ~/.refact
|
||
// if the source is an url, download the page and convert it to markdown | ||
if source.starts_with("http://") || source.starts_with("https://") { | ||
task::spawn(add_url_to_documentation(ccx.global_context.clone(), source, 2, 40)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2, 40 be better constants defined on top of the file
src/at_tools/att_doc_sources.rs
Outdated
let Some((dir_name, file_name)) = get_directory_and_file_from_url(&url) else { | ||
continue; // skip this url | ||
}; | ||
let file_path = format!("./.refact/docs/{dir_name}/{file_name}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guessing it wouldn't work in Windows
src/documentation_files.rs
Outdated
use crate::files_in_workspace::Document; | ||
|
||
pub async fn enqueue_all_documentation_files(gcx: Arc<ARwLock<GlobalContext>>) { | ||
let Ok(paths) = fs::read_dir("./.refact/docs") else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad path
src/at_tools/att_doc_sources.rs
Outdated
.documentation_sources | ||
.lock() | ||
.await | ||
.join(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'm not a fan of this writing style and we don't write in a project like this, why does it take 8 lines when it could be one single line?
@@ -98,6 +99,18 @@ tools: | |||
description: "The exact name of a function, method, class, type alias. No spaces allowed." | |||
parameters_required: | |||
- "symbol" | |||
|
|||
- name: "doc_sources" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would describe all that with a little bit more details so model would have more clue how to use it properly
src/at_tools/att_doc_sources.rs
Outdated
}; | ||
|
||
if let Ok(origin_json) = serde_json::to_string(&origin) { | ||
let file_path = format!("./.refact/docs/{directory}/origin.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't like this path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance:
Paths aren't treated well. Do not write to ./.refact, don't assume all filesystems use "/" to join paths.
To think about:
- Using the same "vecdb" for both documentation and code can cause problems
- Is filesystem a proper way to store documentation? Mb prefer a database
I'm not sure if I tooluse is a proper way to manage documentation for a user. Tooluse is rather a thing to retrieve a context for the current chat session, not to manipulate things... I'd do it as a part of Refact's WebGUI. Why would someone list documentation or delete using a chat interface?
What I see it could be used as: when user sends a message with a link in it, it would read it as a .md file and:
if file is too big: use a local vecdb search on it
if size is ok: paste to messages as is.
Being able to add documentation sources via chat, and letting the chat assistent use that as a source.
For example you can ask:
"Add "https://cplusplus.com/reference/stl/" to the documentation"
And if that was succesfull you can ask:
"What are the methods of std::string?"