Search
Code3,166
language, offset = 0, model = "openai/gpt-oss-120b", reasoning_effort = "medium", tools = [], } const isGptOss = typeof model === "string" && model.startsWith("openai/gpt-oss"); const supportsReasoning = isGptOss; const supportsTools = isGptOss; const baseUrl = (typeof base_url === "string" && base_url.trim()) ? base_url.trim().replace(/\/$/, "") : ""; let endpoint = "https://api.groq.com/openai/v1/chat/completions"; if (baseUrl) { if (/(\/v\d+)?\/(chat\/)?completions$/i.test(baseUrl)) {
export async function groqChatCompletion(apiKey, payload) { console.log('>>> [groqChatCompletion] Payload:', payload); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { try { const res = await groqChatCompletion(apiKey, { model: 'openai/gpt-oss-120b', messages: [ { role: 'system', content: 'Classify the user request as either links or text. Respond with a single token: links or text. Use links if the user appears to want a search results list of sources; use text if the user is asking for an explanation/summary/definition.' },
language, offset = 0, model = 'openai/gpt-oss-120b', reasoning_effort = 'medium', tools = [], } const isGptOss = typeof model === 'string' && model.startsWith('openai/gpt-oss'); const supportsReasoning = isGptOss; const supportsTools = isGptOss; const encoder = new TextEncoder(); const baseUrl = (typeof base_url === 'string' && base_url.trim()) ? base_url.trim().replace(/\/$/, '') : ''; let endpoint = 'https://api.groq.com/openai/v1/chat/completions'; if (baseUrl) { if (/(\/v\d+)?\/(chat\/)?completions$/i.test(baseUrl)) {
import { Hono } from "https://esm.sh/hono@3.11.7";import { OpenAI } from "https://esm.town/v/std/openai";import { email } from "https://esm.town/v/std/email";import type { ChatRequest, ChatResponse, InviteRequest, InviteDetails } from "../../shared/types.ts";const api = new Hono();const openai = new OpenAI();// Middleware to ensure user is authenticated const messages = await getConversationMessages(currentConversationId); // Prepare messages for OpenAI (exclude the current user message since we'll add it) const chatMessages = messages .filter(m => m.id !== userMessage.id) // Exclude the message we just added try { // Get response from ChatGPT const completion = await openai.chat.completions.create({ messages: chatMessages, model: "gpt-4o-mini",
- **Automatic user creation** on first login- **Conversation history storage** with full message history- **ChatGPT integration** via OpenAI API- **Group chat functionality** with role-based permissions- **Email invitations** with secure tokens
## Tech Stack- **Backend**: Hono, LastLogin auth, SQLite, OpenAI, Server-Sent Events- **Frontend**: React, TailwindCSS, Real-time SSE connections- **Database**: SQLite with participant and invitation tables
<div class="relative"> <select x-model="selectedModel" @change="onModelChange()" class="px-2 py-1 pr-8 border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 rounded-md focus:ring-2 focus:ring-blue-500 appearance-none text-xs w-full dark:text-gray-200"> <option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option> <option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option> <option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option> <option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option> <span>JSON mode</span> </label> <label class="inline-flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')"> <input type="checkbox" x-model="useBrowserSearch" @change="onUseBrowserSearchChange()" class="rounded border-gray-300 dark:border-gray-600"> <span>browser search</span> </label> <label class="inline-flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')"> <input type="checkbox" x-model="useCodeInterpreter" @change="onUseCodeInterpreterChange()" class="rounded border-gray-300 dark:border-gray-600"> <span>code interpreter</span>
- ✅ Chat message display with user/assistant styling- ✅ Message input with textarea and send button- ✅ OpenAI API integration (GPT-4o-mini)- ✅ Real-time message updates- ✅ Loading states and typing indicators
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite/main.tsx";import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";import { OpenAI } from "https://esm.town/v/std/openai";const app = new Hono();const openai = new OpenAI();// Unwrap Hono errors to see original error details});// Send a message and get OpenAI responseapp.post("/api/threads/:threadId/messages", async (c) => { const email = c.req.header('X-LastLogin-Email'); ); // Prepare messages for OpenAI (limit to last 20 messages to avoid token limits) const messages = messageHistory.slice(-20).map(msg => ({ role: msg.role as 'user' | 'assistant', })); // Get OpenAI response const completion = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: messages, if (!assistantResponse) { throw new Error("No response from OpenAI"); }
import { PresidentDocs } from "./nonprofitDocs";import { OpenAI } from "https://esm.town/v/std/openai";const openai = new OpenAI();export default async function (req: Request): Promise<Response> { // { role: "user", content: "Say hello in a creative way" }, const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: systemPrompt },
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found