Skip to content

Commit

Permalink
feat: add ability to search for all tools by setting page to -1
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <[email protected]>
  • Loading branch information
tylerslaton committed Mar 22, 2024
1 parent 1363647 commit 454feea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PrismaClient } from '@prisma/client'
import type { Tool, ToolExample } from '@/lib/types'

const prisma = new PrismaClient()
const all = -1

export async function getToolsForUrl(url: string): Promise<{ tools: Tool[], examples: ToolExample[], lastIndexedAt: Date }> {
const toolEntry = await prisma.toolEntry.findFirst({
Expand Down Expand Up @@ -91,8 +92,8 @@ export async function getToolsForQuery(query: string, page: number, pageSize: nu
const skip = (page - 1) * pageSize
const toolEntries = await prisma.toolEntry.findMany({
where: { reference: { contains: query } },
take: pageSize,
skip: skip > 0 ? skip : undefined,
take: page != all ? pageSize : undefined,
skip: skip > 0 && page != all ? skip : undefined,
})

const tools: Record<string, Tool[]> = {}
Expand Down
2 changes: 1 addition & 1 deletion tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Finds a tool that matches the prompt provided, if one exists.
args: prompt: Prompt that describes a tool to be found

Do each of the following one after the other.
1. Go to "https://tools.gptscript.ai/api/search". DO NOT CHANGE THIS URL IN ANY WAY.
1. Go to "https://tools.gptscript.ai/api/search?page=-1". DO NOT CHANGE THIS URL IN ANY WAY.
2. From the response, look for a tool that is described by ${prompt}.
3. Return a list of names and URLs for each tool you find. Each URL should be in
the form of https://tools.gptscript.ai/{github url without https://}. If more than one
Expand Down

0 comments on commit 454feea

Please sign in to comment.