🚀 SimplyOffer AI Backend

HR Data Intelligence Agent API - Next.js Edition

Available Endpoints:

Example Usage:

// Text streaming
const response = await fetch('/api/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    message: "I want to do salary fitment",
    thread_id: "user-123"
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  
  const text = decoder.decode(value);
  const lines = text.split('\n');
  
  for (const line of lines) {
    if (line.startsWith('data: ')) {
      const event = JSON.parse(line.slice(6));
      console.log(event);
    }
  }
}

Voice Streaming Example:

// With voice synthesis
const response = await fetch('/api/chat-with-voice', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    message: "Tell me about the candidates",
    thread_id: "user-123",
    voice: "nova",
    enable_voice: true
  })
});

// Events include:
// { type: "text", content: "..." }
// { type: "voice_start" }
// { type: "voice_data", format: "mp3", audio: "base64..." }
// { type: "voice_complete" }