-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jonfairbanks/develop
UX Improvements
- Loading branch information
Showing
9 changed files
with
144 additions
and
72 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,74 @@ | ||
import streamlit as st | ||
|
||
from utils.ollama import get_models | ||
|
||
|
||
def set_initial_state(): | ||
|
||
########### | ||
# General # | ||
########### | ||
|
||
if "ollama_endpoint" not in st.session_state: | ||
st.session_state["ollama_endpoint"] = "http://localhost:11434" # Revert to None | ||
st.session_state["ollama_endpoint"] = "http://localhost:11434" | ||
|
||
if "embedding_model" not in st.session_state: | ||
st.session_state["embedding_model"] = None | ||
|
||
if "ollama_models" not in st.session_state: | ||
st.session_state["ollama_models"] = [] | ||
try: | ||
models = get_models() | ||
st.session_state["ollama_models"] = models | ||
except Exception as err: | ||
print( | ||
f"Warning: Initial loading of Ollama models failed. You might be hosting Ollama somewhere other than localhost. -- {err}" | ||
) | ||
st.session_state["ollama_models"] = [] | ||
pass | ||
|
||
if "selected_model" not in st.session_state: | ||
st.session_state["selected_model"] = None | ||
|
||
if "top_k" not in st.session_state: | ||
st.session_state["top_k"] = None | ||
if "messages" not in st.session_state: | ||
st.session_state["messages"] = [ | ||
{ | ||
"role": "assistant", | ||
"content": "Hello! Import some files or ingest a GitHub repo and we can get started.", | ||
} | ||
] | ||
|
||
if "github_repo" not in st.session_state: | ||
st.session_state["github_repo"] = None | ||
###################### | ||
# Files & Documents # | ||
###################### | ||
|
||
if "file_list" not in st.session_state: | ||
st.session_state["file_list"] = [] | ||
|
||
if "embedding_model" not in st.session_state: | ||
st.session_state["embedding_model"] = None | ||
|
||
if "chunk_size" not in st.session_state: | ||
st.session_state["chunk_size"] = None | ||
if "github_repo" not in st.session_state: | ||
st.session_state["github_repo"] = None | ||
|
||
if "advanced" not in st.session_state: | ||
st.session_state["advanced"] = False | ||
############### | ||
# Llama-Index # | ||
############### | ||
|
||
if "documents" not in st.session_state: | ||
st.session_state["documents"] = None | ||
|
||
if "query_engine" not in st.session_state: | ||
st.session_state["query_engine"] = None | ||
|
||
if "messages" not in st.session_state: | ||
st.session_state["messages"] = [ | ||
{ | ||
"role": "assistant", | ||
"content": "Hello! Import some files or ingest a GitHub repo and we can get started.", | ||
} | ||
] | ||
##################### | ||
# Advanced Settings # | ||
##################### | ||
|
||
if "advanced" not in st.session_state: | ||
st.session_state["advanced"] = False | ||
|
||
if "top_k" not in st.session_state: | ||
st.session_state["top_k"] = None | ||
|
||
if "embedding_model" not in st.session_state: | ||
st.session_state["embedding_model"] = None | ||
|
||
if "chunk_size" not in st.session_state: | ||
st.session_state["chunk_size"] = None |
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
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