Spaces:
Sleeping
Sleeping
Create frontend_chain.py
Browse files- chains/frontend_chain.py +17 -0
chains/frontend_chain.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain.prompts import PromptTemplate
|
| 2 |
+
from langchain.chains import LLMChain
|
| 3 |
+
from chains.model import get_local_model
|
| 4 |
+
|
| 5 |
+
llm = get_local_model()
|
| 6 |
+
|
| 7 |
+
prompt = PromptTemplate(
|
| 8 |
+
input_variables=["tasks_json"],
|
| 9 |
+
template=(
|
| 10 |
+
"You are the Frontend Agent. Based on these tasks, write React components with TailwindCSS.\n"
|
| 11 |
+
"Ensure the UI is clean, responsive, and functional.\n\n"
|
| 12 |
+
"Tasks:\n{tasks_json}\n\n"
|
| 13 |
+
"Output only valid React code."
|
| 14 |
+
),
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
frontend_chain = LLMChain(llm=llm, prompt=prompt)
|