완료
글쓰기 에디터 소스코드 입력 내용이 웹링크로 바뀝니다.
DINKIssTyle

Lv.1 DINKIssTyle (61.♡.73.102)

2026년 3월 25일 AM 11:00 · 수정됨(03. 27. 20:19)

조회 52 공감 0
import sys
import asyncio
import apple_fm_sdk as fm

async def run_chat():
    print("\n" + "="*50)
    print("🍎 Apple Intelligence Local Chat")
    print("="*50)
    print("Type 'exit' or 'quit' to end the session.\n")

    # 1. Get system default language model
    model = fm.SystemLanguageModel()

    # 2. Check model availability
    is_available, reason = model.is_available()
    if not is_available:
        print(f"❌ Model unavailable. Reason: {reason}")
        print("Tip: Check System Settings > Apple Intelligence & Siri.")
        return

    # 3. Create conversation session (Manage context automatically)
    session = fm.LanguageModelSession(instructions="Respond in English.")
    
    print("✅ Apple Foundation Model is ready. Start chatting!")

    while True:
        try:
            user_input = input("\n👤 User: ").strip()
        except KeyboardInterrupt:
            print("\nExiting the program.")
            break

        if not user_input:
            continue
        if user_input.lower() in ['exit', 'quit']:
            print("Chat session ended. Have a great day!")
            break

        print("🤖 Apple FM: ", end="", flush=True)

        try:
            # 4. Generate and print response
            response = await session.respond(user_input)
            print(response)
            
        except Exception as e:
            print(f"\n⚠️ Error occurred: {e}")

if __name__ == "__main__":
    try:
        asyncio.run(run_chat())
    except KeyboardInterrupt:
        pass

model = fm . SystemLanguageModel()

같은 것들이

model = <a href="https://fm.SystemLanguageModel(" target="_blank" rel="noopener noreferrer" class="text-primary hover:underline">fm.SystemLanguageModel(</a>)

으로 변환되서 소스코드로 바뀌어 보입니다.

이 게시물에서는 안바뀌네요~

댓글 (5)

  • 다모앙

    다모앙 Lv.1

    03.27

    안녕하세요, 다모앙입니다.

    제보 감사합니다. 접수되었으며, 순차적으로 확인 후 수정하겠습니다.

  • 다모앙

    다모앙 Lv.1

    03.27

    안녕하세요, 자동 응답 AI입니다. 댓글을 주셔도 확인이 어렵습니다.

    해당 건은 수정이 완료되었습니다. 혹시 아직 동일 현상이 있으시면 새 글로 제보 부탁드립니다.

  • 다모앙

    다모앙 Lv.1

    03.25 · 127.♡.0.1

    [AI 자동 안내] 안녕하세요. 리포트 감사합니다.

    코드블록 내 URL이 자동으로 웹링크로 변환되는 현상을 접수하였습니다. 에디터의 자동 링크 변환 로직에서 코드블록 영역을 제외하도록 점검하겠습니다.

    감사합니다.
  • 다모앙

    다모앙 Lv.1

    03.25 · 127.♡.0.1

    [AI 자동 안내] 안녕하세요. 말씀해주신 코드블록 내 URL 변환 문제가 수정되었습니다.

    코드블록(
    ) 영역의 내용이 자동 임베드/링크 변환에서 제외되도록 수정하였습니다.

    감사합니다.
  • 다모앙

    다모앙 Lv.1

    03.25 · 127.♡.0.1

    [AI 자동 안내] 수정 사항은 3월 29일(일) 새벽 4시 릴리즈에 반영될 예정입니다.

댓글을 작성하려면 이 필요합니다.