openfree commited on
Commit
3179421
·
verified ·
1 Parent(s): dd99253

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -34,13 +34,12 @@ def get_logs():
34
 
35
  import re
36
 
37
- # app.py ― get_deployment_update만 교체
38
  def get_deployment_update(code_md: str):
39
  clean = remove_code_block(code_md)
40
  result = deploy_to_vercel(clean)
41
 
42
  m = re.search(r"https?://[\\w-]+\\.vercel\\.app", result)
43
- if m: # ── 성공 ──
44
  url = m.group(0)
45
  html_box = (
46
  f"<div class='deploy-success'>"
@@ -48,14 +47,16 @@ def get_deployment_update(code_md: str):
48
  f"<a href='{url}' target='_blank'>{url}</a>"
49
  f"</div>"
50
  )
51
- else: # ── 실패 ──
52
  html_box = (
53
- "<div class='deploy-error'>"
54
  f"❌ {html.escape(result)}"
55
- "</div>"
56
  )
57
- # ▲▲▲ 반드시 visible=True 로 돌려준다 ▲▲▲
58
- return gr.HTML.update(value=html_box, visible=True, sanitize=False)
 
 
59
 
60
 
61
  # ------------------------
@@ -888,6 +889,7 @@ with gr.Blocks(css_paths=["app.css"], theme=theme) as demo:
888
  value="", # 첫 화면은 비워 두기
889
  visible=False, # 처음엔 숨김
890
  elem_id="deploy_result_container",
 
891
  )
892
 
893
 
 
34
 
35
  import re
36
 
 
37
  def get_deployment_update(code_md: str):
38
  clean = remove_code_block(code_md)
39
  result = deploy_to_vercel(clean)
40
 
41
  m = re.search(r"https?://[\\w-]+\\.vercel\\.app", result)
42
+ if m:
43
  url = m.group(0)
44
  html_box = (
45
  f"<div class='deploy-success'>"
 
47
  f"<a href='{url}' target='_blank'>{url}</a>"
48
  f"</div>"
49
  )
50
+ else:
51
  html_box = (
52
+ f"<div class='deploy-error'>"
53
  f"❌ {html.escape(result)}"
54
+ f"</div>"
55
  )
56
+
57
+ # ↓↓↓ generic updater 사용!
58
+ return gr.update(value=html_box, visible=True)
59
+
60
 
61
 
62
  # ------------------------
 
889
  value="", # 첫 화면은 비워 두기
890
  visible=False, # 처음엔 숨김
891
  elem_id="deploy_result_container",
892
+ sanitize=False # <a> 태그 그대로 렌더
893
  )
894
 
895