Skip to content

ProxymanApp/GPTClientApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

GPT Chat App

A simple iOS chat application built with SwiftUI that integrates with OpenAI's GPT-4 API using Server-Side Events for real-time streaming responses.

Features

  • 🎨 iMessage-style chat bubbles - Beautiful, rounded chat bubbles with proper alignment
  • 📱 Native iOS interface - Clean, modern UI that feels native to iOS
  • Real-time streaming - Uses Server-Side Events for smooth, real-time GPT responses
  • 🎯 Smart scrolling - Auto-scrolls to show new messages with smooth animations
  • ⌨️ Keyboard-friendly - Responsive text input with proper keyboard handling

Setup Instructions

  1. Get your OpenAI API Key

  2. Configure the app

    • Open GPTClientApp/Config.swift
    • Replace "YOUR_API_KEY_HERE" with your actual OpenAI API key:
    static let openAIAPIKey = "sk-your-actual-api-key-here"
  3. Build and Run

    • Open the project in Xcode
    • Select your target device or simulator
    • Press Cmd + R to build and run

Architecture

The app is structured with the following components:

  • ChatMessage - Data model for chat messages
  • ChatBubbleView - SwiftUI view for individual chat bubbles
  • OpenAIService - Service class handling OpenAI API communication with SSE
  • ContentView - Main chat interface with message list and input field
  • Config - Configuration constants including API key

Requirements

  • iOS 14.0+
  • Xcode 12.0+
  • Valid OpenAI API key with GPT-4 access

Usage

  1. Launch the app
  2. Type your message in the text field at the bottom
  3. Tap the send button (paper plane icon)
  4. Watch as GPT-4 responds in real-time with streaming text
  5. Continue the conversation!

API Usage

The app uses OpenAI's Chat Completions API with the following configuration:

  • Model: gpt-4
  • Streaming: Enabled (Server-Side Events)
  • Max tokens: 1500

Security Note

Make sure to keep your API key secure and never commit it to version control. Consider using environment variables or secure keychain storage for production apps.

About

Demonstrate how to capture open api endpoint with Proxyman

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages