Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -344,20 +344,33 @@ if next_step == "π Continue researching (codes, build types, regulations)":
|
|
344 |
st.markdown("##### π¬ Ask Your Own Research Question")
|
345 |
user_question = st.text_input("What else would you like to learn about?")
|
346 |
if st.button("Ask"):
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
|
363 |
|
|
|
344 |
st.markdown("##### π¬ Ask Your Own Research Question")
|
345 |
user_question = st.text_input("What else would you like to learn about?")
|
346 |
if st.button("Ask"):
|
347 |
+
if user_question:
|
348 |
+
with st.spinner("Getting the answer..."):
|
349 |
+
response = client.chat.completions.create(
|
350 |
+
model="gpt-4",
|
351 |
+
messages=[
|
352 |
+
{"role": "system", "content": "You're a helpful Canadian homebuilding advisor. Keep answers clear and based on current standards."},
|
353 |
+
{"role": "user", "content": user_question}
|
354 |
+
],
|
355 |
+
temperature=0.7
|
356 |
+
)
|
357 |
+
st.markdown("### π‘ Answer")
|
358 |
+
st.markdown(response.choices[0].message.content.strip())
|
359 |
+
else:
|
360 |
+
st.warning("Please type a question first.")
|
361 |
+
|
362 |
+
# === Helpful Resource Links (shown no matter what) ===
|
363 |
+
st.markdown("##### π Helpful Resources")
|
364 |
+
st.markdown("""
|
365 |
+
- [National Building Code of Canada (2020)](https://nrc.canada.ca/en/certifications-evaluations-standards/codes-canada/codes-canada-publications/national-building-code-canada-2020)
|
366 |
+
- [BC Building Code](https://www.bccodes.ca/)
|
367 |
+
- [Alberta Building Codes & Standards](https://www.alberta.ca/building-codes-and-standards.aspx)
|
368 |
+
- [Ontario Building Code](https://www.ontario.ca/page/building-code)
|
369 |
+
- [Quebec Construction Code](https://www.rbq.gouv.qc.ca/en/technical-buildings/buildings/construction-code.html)
|
370 |
+
- [Tiny Home Legal Info (Canada)](https://tinyhousecanada.ca/)
|
371 |
+
""")
|
372 |
+
|
373 |
+
|
374 |
|
375 |
|
376 |
|