Metadata-Version: 2.1
Name: streamlit-monaco-copilot
Version: 0.0.1
Summary: Streamlit component that allows you to build your own simple github copilot
Home-page: https://github.com/liuhetian/streamlit-monaco-copilot
Author: Liu-Hetian
Author-email: 80733866@qq.com
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit >=0.63
Provides-Extra: devel
Requires-Dist: wheel ; extra == 'devel'
Requires-Dist: pytest ==7.4.0 ; extra == 'devel'
Requires-Dist: playwright ==1.48.0 ; extra == 'devel'
Requires-Dist: requests ==2.31.0 ; extra == 'devel'
Requires-Dist: pytest-playwright-snapshot ==1.0 ; extra == 'devel'
Requires-Dist: pytest-rerunfailures ==12.0 ; extra == 'devel'

# streamlit-custom-component

Streamlit component that allows you to build your own simple github copilot



## Installation instructions

```sh
pip install streamlit-monaco-copilot
```

## Usage instructions

type some code in the text area, and use `shift + enter` to run the component

```python
import streamlit as st
from streamlit_monaco_copilot import st_monaco_copilot


from uuid import uuid4

value = st_monaco_copilot(
    "foo", 
    language='python',
    initial_code='print("hello world")',
    suggestion=st.session_state.get('suggestion', ''), 
    key='fixed'  # component need a key! or it will not be destoryed by streamlit rerun when suggestion changed!
)


value


if value and value.get('uuid'):
    new_uuid = value['uuid']
else:
    new_uuid = ''

if value and new_uuid and new_uuid != st.session_state.get('uuid'):
    # maybe use openai or deepseek api to get suggestion
    st.session_state['suggestion'] = 'i have suggestion about this code: `' + value.get('beforeCursor', '') + '`'
    st.session_state['uuid'] = new_uuid
    import time 
    time.sleep(1)  # i don't know why, but without this, the fontend component will not work
    st.rerun()
```


## todo

- [ ] remove toolkit near inline suggestion code 


