<< [[2025-01-12|Before]] | [[2025-01-15|Next]] >>
## Goal
- `imgPathCrew` 연결하기
- `file Select`의 전체적인 UI 구현하기
## TODO
> [!TODO] TODO
> - [v] fileSelect Crew의 기능 분리
> - [v] st.sesstion을 활용해 fileSelect Crew가 여러 번 실행되지 않도록 구현
> - [v] 이미지 문서 탐색 Crew 연결하기
> - [v] 문서 탐색 결과 선택 옵션 UI 구현
## Issue/Solution
#### Issue 1
> [!blank]
>
>> [!warning]+ Problem
>>`모든 문서를 찾는 Crew(docPathSearch)`와 `모든 이미지를 찾는 Crew(ImgPathSearch)`는 한 번 실행되면 파일이 바뀌거나 다시 실행할 이유가 없다. (결과 값이 이상하지 않다면)
>>하지만 현재 Code는 키워드에 맞는 문서들을 찾기 위해 **fileSelect crew**만 실행하는 것이 아니라 문서 경로와 이미지 경로를 구하는 `Crew`까지 같이 실행된다.
>
>> [!summary]+ Solution
>> Class `Crews`을 만들어 각각의 `Crew`를 분리하고 `Streamlit Sesstion` 기능을 이용해 파일이나 확장자가 바뀌지 않는 이상 `docPathSearch Crew`와 `ImgPathSearch Crew`을 실행하지 않고 기존의 결과를 반환하도록 구현하였다.
>> `fileSelect crew`의 경우는 **키위드가 바뀌었을 때** 실행되도록 구현하였다.
#### Issue 2 ([[2025-01-07#Issue 2 ( 2025-01-06 Issue 3 Before Issue )|Before Issue]])
> [!blank]
>
>> [!warning]+ Problem
>>`fileSelect Crew`의 `Agent`가 만들어내는 결과 값이 정확하지 않거나 이상한 경우가 많이 발생한다.
>
>> [!summary]+ Solution
>> `Crew`의 `Agent`를 아무리 수정하여도 이상한 결과 값이 나오는 것은 막을 수 없었다.
>> 이를 해결하기 위해 `Crew`가 가져온 문서들과 이미지들 중 사용할 것들을 직접 결정할 수 있도록 UI를 구현하였다.
>> 또한 `fileSelct Crew`의 결과 값 말고도 `docPathSearch Crew`와 `ImgPathSearch Crew`가 이상한 경우도 있기 때문에 **파일 경로 Reset** 버튼을 만들어 문서가 이상 있을 때 이를 초기화 할 수 있도록 구현하였다.
>> 불러온 경로들의 이상이 있는지 없는지를 판단해야 `파일 경로 Reset`를 누를지 말지 결정 할 수 있기 때문에 **Streamlit dialog**을 이용해 불러온 모든 경로를 사용자가 볼 수 있도록 구현하였다.
## Reference
- [[Streamlit#session_state|Streamlit session]]
- [Streamlit cache clear](https://discuss.streamlit.io/t/clearing-cache/30534/2)
- [Streamlit dialog](https://docs.streamlit.io/develop/api-reference/execution-flow/st.dialog)
## Git commit contents
- [build : fileReader Agnet를 추가하여 기존 fileSelect Crew의 기능 분리](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/834795d488636c2b1800c9c3d5eee934afe86adf "build : fileReader Agnet를 추가하여여 기존 fileSelect Crew의 기능 분리")
- [build : streamlit cache를 사용해 Crew가 중복되어 사용되지 않도록 구현](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/84910a77c9a33acda5116e2692352581824ceb9e "build : streamlit cache를 사용해 Crew가 중복되어 사용되지 않도록 구현")
- [build : imgPathCrew 구현](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/1ab8d6cc7ea06bb5aa036a5601867aa01df448a9 "build : imgPathCrew 구현")
- [build : 문서 선택 옵션 구현](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/2305b363061e2f5829d61766e833b49e7036bdd1 "build : 문서 선택 옵션 구현")
- [build : UI에서 표현된 문서 이름 변경 및 파일 경로 RESET 버튼 구현](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/c82ae8125b7d99fb7fac2bc4874695d2dc4ba100 "build : UI에서 표현된 문서 이름 변경 및 파일 경로 RESET 버튼 구현")
- [build : 불러온 파일 목록 UI 구현, 파일 경로 전처리 함수 추가](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/68add0c32e824b3feb59a1857217ba314701aa1a "build : 불러온 파일 목록 UI 구현, 파일 경로 전처리 함수 추가")
## What should I do more
- Chat message UI 구현하기
- 사용자 질문에 답 반환하기