Skip to main content

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

Project description

streamlit-custom-component

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

Installation instructions

pip install streamlit-monaco-copilot

Usage instructions

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_monaco_copilot-0.0.1.tar.gz (429.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_monaco_copilot-0.0.1-py3-none-any.whl (432.2 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_monaco_copilot-0.0.1.tar.gz.

File metadata

  • Download URL: streamlit_monaco_copilot-0.0.1.tar.gz
  • Upload date:
  • Size: 429.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for streamlit_monaco_copilot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c264be6e85513ed0a766ec4893ef5fb8e9f9e7a67ac79cef19c38505f00a918d
MD5 8b3aafeba6c120b73c473ecebb52cf52
BLAKE2b-256 2ea42b0108326ea5fed0d639cab48199333d215539d2a306edf88413c97932a1

See more details on using hashes here.

File details

Details for the file streamlit_monaco_copilot-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_monaco_copilot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1481cfcba01c284531c1dd3aa936f7f85486c5b86a51509808a8c3151c056c8
MD5 ff8130538e7e514d7f916a76529ccf98
BLAKE2b-256 84a71d83d2d4355bc663fb50af3146b6dcda0b38b24818960dc5ec45565232c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page