import 'dotenv/config'
import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { AgentView, AgentViewError } from "agentview";
import { OpenAI } from 'openai';
const app = new Hono();
const client = new OpenAI()
const av = new AgentView({
agent: "my_simple_agent",
version: "0.2.1"
})
app.post('/chat', async (c) => {
// your chat endpoint...
})
// Error handling
app.onError((error, c) => {
if (error instanceof AgentViewError) {
return c.json(error.body, error.status);
}
});
serve({
fetch: app.fetch,
port: 3000
}, (info) => {
console.log(`Agent API server is running on http://localhost:${info.port}`)
})