-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Archived automation and file_io modules, removed PersistableState an…
…d related functions, refactored Session and GitTracker to use path instead of PersistableState"
- Loading branch information
Showing
14 changed files
with
50 additions
and
106 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
using JSON3 | ||
using JLD2 | ||
|
||
@kwdef mutable struct PersistableState | ||
path::String | ||
PersistableState(path::String) = (mkpath(path); new(expanduser(abspath(expanduser((path)))))) | ||
end | ||
|
||
|
||
|
||
# persist!(conv::ConversationCTX) = save_message(conv) | ||
# save_message(conv::ConversationCTX) = save_conversation_to_file(conv) | ||
get_conversation_filename(p::PersistableState,conv_id::String) = (files = filter(f -> endswith(f, "_$(conv_id).log"), readdir(p.path)); isempty(files) ? nothing : joinpath(p.path, first(files))) | ||
|
||
function generate_overview(conv::CONV, conv_id::String, p::PersistableState) | ||
@assert false | ||
sanitized_chars = strip(replace(replace(first(conv.messages[1].content, 32), r"[^\w\s-]" => "_"), r"\s+" => "_"), '_') | ||
return joinpath(p.path, "$(date_format(conv.timestamp))_$(sanitized_chars)_$(conv_id).log") | ||
end | ||
|
||
(p::PersistableState)(conv::Session) = begin | ||
println(conversaion_path(p, conv)) | ||
mkpath_if_missing(joinpath(p.path, conv.id)) | ||
mkpath_if_missing(conversaion_path(p, conv)) | ||
save_conversation(conversaion_file(p, conv), conv) | ||
conv | ||
end | ||
|
||
|
||
|
||
export VirtualWorkspace, init_virtual_workspace_path | ||
|
||
struct VirtualWorkspace | ||
rel_path::String | ||
end | ||
|
||
function init_virtual_workspace_path(p::PersistableState, conv_ctx::Session) | ||
vpath = joinpath(conv_ctx.id, "workspace") | ||
rel_path = mkdir(expanduser(joinpath(p.path, vpath))) | ||
VirtualWorkspace(rel_path) | ||
end | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
|
||
export VirtualWorkspace, init_virtual_workspace_path | ||
|
||
struct VirtualWorkspace | ||
rel_path::String | ||
end | ||
|
||
function init_virtual_workspace_path(p::PersistableState, conv_ctx::Session) | ||
vpath = joinpath(conv_ctx.id, "workspace") | ||
rel_path = mkdir(expanduser(joinpath(p.path, vpath))) | ||
VirtualWorkspace(rel_path) | ||
end | ||
|
||
|
||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters