Based on langchain and streamlit. The project used chatgpt-3.5 model.
- Customize your own girlfriend
- Chat context memory
- Chat with images you can customize
- Custom rule settings chatgpt
- streamlit + langchain + chatgpt
- Note: Character picture information is stored using Chroma vector, that is, the prompt words and pictures correspond one to one. Call the tool of langchain agent to generate pictures
AI-Girlfriend |-.streamlit #Streamlit project configuration files | |-config.toml | |-secrets.toml #Store secrets. In code, you can directly call st.secrets[“key”] to retrieve them. |-.venv #Create a virtual environment using venv | |- characters/agent_character #Character Resources | |-mina | |-mina_info.json #Store character information such as name, appearance, personality, occupation, etc. | |-mina_img.csv #Store images, with each image corresponding to its respective prompt word. | |-rias_gremory | |-serena | |-sophia |- gallery #streamlit ui resource |- home.py #Program entry point |- requirements.txt #Libraries that need to be installed |- utils_prompt.py #Custom Rules for ChatGPT |- utils.py #Required tools, such as LangChain's proxy tool wrapper and Chromadb vector database
python -m venv .venv pip install -r requirements.txt
streamlit run .\home.py
- When page content changes, Streamlit re-executes the code from top to bottom.
- st.session_state is used for caching data and will be reset when the page refreshes.
- @st.cache_resource is used to cache model resources. It processes the passed parameter hash and returns the corresponding result, ensuring the code does not need to be executed again on subsequent requests. For reference, see https://docs.streamlit.io/library/advanced-features/caching.





