You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/...?q=image&page=8&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=image
Returns an array of strings in format "username" or "username/projectName"
Found 9912 results for "image"(2961ms)
86const buffer = new Uint8Array(await res.arrayBuffer())
87const base64 = btoa(String.fromCharCode(...buffer))
88faviconDataUrl = `data:image/x-icon;base64,${base64}`
89}
90} catch {
150${badgeBg}
151${valueBg}
152${faviconDataUrl ? `<image x='${iconX}' y='${Math.round((s.height - s.icon) / 2)}' width='${s.icon}' height='${s.icon}' href='${faviconDataUrl}'/>` : ''}
153${labelText ? `<text x='${labelTextX}' y='${s.y}' fill='#333' text-anchor='${faviconDataUrl ? 'start' : 'middle'}'>${labelText}</text>` : ''}
154${valueText ? `<text x='${labelWidth + iconWidth + valueWidth / 2}' y='${s.y}' fill='${textColor}' text-anchor='middle'>${valueText}</text>` : ''}
156`,
157{
158headers: { 'Content-Type': 'image/svg+xml' }
159}
160)
71tags: Array.isArray(recipe.tags) ? recipe.tags.filter(tag => typeof tag === "string") : undefined,
72source: recipe.source && typeof recipe.source === "string" ? recipe.source.trim() : undefined,
73imageUrl: recipe.imageUrl && typeof recipe.imageUrl === "string" ? recipe.imageUrl.trim() : undefined,
74};
75}
125// System prompt for recipe parsing
126const RECIPE_PARSING_PROMPT =
127`You are a recipe parsing expert. Your task is to extract structured recipe information from various sources (text, images, PDFs).
128129IMPORTANT: You must return ONLY a valid JSON object with no additional text, markdown formatting, or explanations.
237});
238239app.post("/image", async (c) => {
240try {
241const { content: base64Image } = await c.req.json() as ParseRequest;
242243console.log("Processing image upload, base64 length:", base64Image?.length);
244245// Validate base64 image
246if (!base64Image || base64Image.length < 100) {
247return c.json({ success: false, error: "Invalid or empty image data" } as ParseResponse);
248}
249250// Use OpenAI Vision to parse recipe from image
251const completion = await openai.chat.completions.create({
252model: "gpt-4o-mini",
259type: "text",
260text:
261"Parse the recipe from this image. Extract all visible recipe information including title, ingredients with amounts, and cooking steps.",
262},
263{
264type: "image_url",
265image_url: {
266url: base64Image.startsWith("data:") ? base64Image : `data:image/jpeg;base64,${base64Image}`,
267},
268},
306const rawRecipe = JSON.parse(jsonText);
307const recipe = validateAndCleanRecipe(rawRecipe);
308recipe.source = "Image upload";
309310return c.json({ success: true, recipe } as ParseResponse);
318}
319} catch (error) {
320console.error("Image parsing error:", error);
321return c.json({
322success: false,
323error: `Failed to parse recipe from image: ${error.message}`,
324} as ParseResponse);
325}