29 lines
649 B
Python
29 lines
649 B
Python
import streamlit as st
|
|
|
|
|
|
def generate_prompt(user_message: str, file_context=None) -> str:
|
|
# Kontext ist entweder leer oder die angeklickte und geöffnete Datei
|
|
|
|
system_content = """\
|
|
<persona>
|
|
You are an experienced Python coding assistant.
|
|
</persona>
|
|
<style>
|
|
Write python in PEP8 style. Keep explanaitions short.
|
|
</style>
|
|
<constraints>
|
|
Keep each answer under 200 words.
|
|
</constraints>
|
|
"""
|
|
|
|
task = (f"<task> {user_message} </task>")
|
|
|
|
if "file_content" in st.session_state:
|
|
context = (f" <code> {st.session_state['file_content']} </code>")
|
|
else:
|
|
context = ""
|
|
|
|
|
|
return system_content + task + context
|
|
|