Skip to content

Commit

Permalink
update index loader
Browse files Browse the repository at this point in the history
  • Loading branch information
svilupp committed Jan 22, 2024
1 parent 5152103 commit f370f2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/AIHelpMe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ function __init__()
CONV_HISTORY::Vector{Vector{<:Any}} = Vector{Vector{<:Any}}()
CONV_HISTORY_LOCK::ReentrantLock = ReentrantLock()
MAX_HISTORY_LENGTH::Int = 1
MAIN_INDEX::Union{Nothing, RAG.AbstractChunkIndex} = nothing
LAST_CONTEXT::Union{Nothing, RAG.RAGContext} = nothing
## Load index
# TODO: load_index!()
MAIN_INDEX::Union{Nothing, RAG.AbstractChunkIndex} = load_index!()
end

end
4 changes: 3 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ function load_index!(file_path::Union{Nothing, AbstractString} = nothing;
global MAIN_INDEX
if !isnothing(file_path)
@assert endswith(file_path, ".jls") "Provided file path must end with `.jls` (serialized Julia object)."
file_str = "from file $(file_path) "
else
artifact_path = artifact"juliaextra"
file_path = joinpath(artifact_path, "docs-index.jls")
file_str = " "
end
index = deserialize(file_path)
@assert index isa RAG.AbstractChunkIndex "Provided file path must point to a serialized RAG index (Deserialized type: $(typeof(index)))."
verbose && @info "Loaded index in $file_path into MAIN_INDEX"
verbose && @info "Loaded index $(file_str)into MAIN_INDEX"
MAIN_INDEX = index

return index
Expand Down

0 comments on commit f370f2f

Please sign in to comment.