Spaces:
Sleeping
Sleeping
File size: 4,401 Bytes
134342e d0c886f 134342e d0c886f 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e d0c886f 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e 9eae061 134342e d0c886f 134342e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# ... (Önceki import ve config kısımları aynı)
alp_logo = os.path.join(os.path.dirname(__file__), "alp.png")
# TÜRKÇE PROMPTLAR
DEFAULT_PROMPTS = [{
"category": "📝 Plan Yap",
"prompts": [
"İş kurma planı oluştur",
"Hedeflerim için yol haritası hazırla",
"Mülakat provası için strateji öner"
]
}, {
"category": "✍️ İçerik Üret",
"prompts": [
"Teknoloji blogu için makale taslağı oluştur",
"Şirket vizyon metni yaz",
"Satış e-postası taslağı hazırla"
]
}]
# TÜRKÇE ÖNERİLER
DEFAULT_SUGGESTIONS = [{
"label": 'Planlama',
"children": [
{"label": "İş Planı", "value": "İş kurma planı oluştur"},
{"label": "Hedef Planı", "value": "Hedeflerim için yol haritası hazırla"},
{"label": "Mülakat Stratejisi", "value": "Mülakat provası için strateji öner"}
]
}, {
"label": 'Yazım',
"children": [
{"label": "Teknoloji Makalesi", "value": "Teknoloji blogu için makale taslağı oluştur"},
{"label": "Vizyon Metni", "value": "Şirket vizyon metni yaz"},
{"label": "Satış E-postası", "value": "Satış e-postası taslağı hazırla"}
]
}]
# TÜRKÇE ARAYÜZ KODU
with gr.Blocks(css=css, fill_width=True) as demo:
state = gr.State({
"conversations_history": {},
"conversations": [],
"conversation_id": "",
"editing_message_index": -1,
})
with ms.Application(), antdx.XProvider(
theme=DEFAULT_THEME, locale='tr_TR'), ms.AutoLoading():
# SOL PANEL
with antd.Col(md=dict(flex="0 0 260px"), elem_classes="chatbot-conversations"):
with antd.Flex(vertical=True, gap="small"):
# Logo ve Başlık
with antd.Typography.Title(level=1, style={"fontSize": 24, "margin": 0}):
with antd.Flex(align="center", gap="small"):
antd.Image(alp_logo, width=32, height=32, preview=False)
ms.Span("AlpDroid AI")
# Yeni Sohbet Butonu
with antd.Button("Yeni Sohbet", block=True, icon=antd.Icon("PlusOutlined")) as add_conversation_btn
# Sohbet Geçmişi
with antdx.Conversations() as conversations:
with ms.Slot('menu.items'):
antd.Menu.Item("Sil", key="delete", danger=True, icon=antd.Icon("DeleteOutlined"))
# SAĞ PANEL
with antd.Col(flex=1, style={"height": "100%"}):
with antd.Flex(vertical=True, gap="middle"):
# Sohbet Kutusu
with antdx.Bubble.List(items=DEFAULT_CONVERSATIONS_HISTORY) as chatbot:
# Kullanıcı Mesajı
with antdx.Bubble.List.Role(role="user", placement="end"):
ms.Markdown()
with ms.Slot("footer"):
antd.Button(icon=antd.Icon("EditOutlined"))
antd.Popconfirm("Bu mesajı silmek istiyor musunuz?",
ok_button_props={"danger": True},
children=[antd.Button(icon=antd.Icon("DeleteOutlined"))]
)
# Asistan Mesajı
with antdx.Bubble.List.Role(role="assistant", placement="start"):
antd.Avatar(alp_logo)
ms.Markdown()
with ms.Slot("footer"):
antd.Button(icon=antd.Icon("SyncOutlined"))
antd.Popconfirm("Mesajı yeniden oluştur?",
children=[antd.Button(icon=antd.Icon("DeleteOutlined"))]
)
# Giriş Alanı
with antdx.Sender(placeholder="Mesaj yazın veya '/' ile komut seçin"):
with antd.Tooltip("Geçmişi Temizle"):
antd.Button(icon=antd.Icon("ClearOutlined"))
with antdx.Suggestion(items=DEFAULT_SUGGESTIONS):
antd.Input.Textarea()
# EVENT HANDLERS (Önceki koddaki olay yönetim fonksiyonları aynen kalacak)
# ... (Önceki event handler'lar buraya gelecek)
if __name__ == "__main__":
demo.launch() |