-
Notifications
You must be signed in to change notification settings - Fork 0
knowledge extractor #79
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
base: add-history-support
Are you sure you want to change the base?
Conversation
Tried to implement different situations: - user query to agent - agent response - commands in system_mode
What done: - agent chat - system commands logs - bash commands logs(but it doesnt work)
krinkin
left a comment
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.
consider to refactor logging (add logger for the whole project)
|
|
||
| class SessionTracker { | ||
| public: | ||
| enum class EventType { |
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.
Comments?
|
|
||
| void openLogFile(); | ||
|
|
||
| sqlite3 *db; |
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.
It is better to use some prefix for members
tui-tux/src/session_tracker.cpp
Outdated
| // interactions -- table for user chat with agent | ||
| // commands -- bash commands | ||
| // system_commands -- commands in system mode | ||
| const char *schemaSql = R"SQL( |
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.
extract sql code from cpp
tui-tux/src/session_tracker.cpp
Outdated
| resolved BOOLEAN DEFAULT 0, | ||
| FOREIGN KEY(session_id) REFERENCES sessions(session_id) | ||
| ); | ||
| CREATE TABLE IF NOT EXISTS commands ( |
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.
Think on joining this two tables
| int handle_input(); | ||
|
|
||
| static void handle_pty_input(int fd, char ch); | ||
| void handle_pty_input(int fd, char ch); |
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?
tui-tux/src/command_manager.cpp
Outdated
| const std::pair<std::string, std::string> bookmark = bookmark_manager->get_bookmark(alias); | ||
| bookmark_manager->agency_manager->session_history.push_back(bookmark); | ||
| std::cout << bookmark.second << "\n"; | ||
| SessionTracker::get().finalizeCommand(0, "Alias executed: " + alias); |
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.
Consider to define names and values for different error codes
tui-tux/src/terminal_multiplexer.cpp
Outdated
|
|
||
| void TerminalMultiplexer::handle_pty_input(const int fd, const char ch) { | ||
| if (ch == '\n') { | ||
| SessionTracker::get().logEvent(SessionTracker::EventType::ShellCommand, current_command); |
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.
it should be a separated method like update_command
… full support of logging command and its output
| void resize(); | ||
| void run_terminal(); | ||
| int handle_screen_output(Screen &screen, int fd) const; | ||
| int handle_screen_output(Screen &screen, int fd); |
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've done it because i want to call non-const method to collect command output and change variable last_command_finished
Knowledge Extractor component
This component add to ishell functionality to capture user actions, save them into session history, ability to create structured markdown protocols from this history and group them by tags. And ability to reuse this knowledges in the future by adding them to AI's context at the problem solving.
Session capturing
A singleton class, SessionTracker, has been created to handle logging into an SQLite database. It is responsible for recording:
Persistant storage
sessions,commands,interactions,bookmarksandknowledge baseUsage of knowledge base
markdowncomand to operate with knowladges in system mode