Skip to content

Commit

Permalink
better usecount
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Jul 3, 2024
1 parent d70a925 commit 3c274f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/lib/server/textGeneration/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ async function* callTool(
Date.now() - startTime
);

await collections.tools.findOneAndUpdate({ _id: tool._id }, { $inc: { useCount: 1 } });

return { ...toolResult, call } as ToolResult;
} catch (error) {
MetricsServer.getMetrics().tool.toolUseCountError.inc({ tool: call.name });
Expand Down
4 changes: 1 addition & 3 deletions src/routes/tools/[toolId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
{data.tool?.createdByName}
</a>
<span class="text-gray-300">•</span>
text -> image
<span class="text-gray-300">•</span>
1.2M runs
{data.tool.useCount} runs
</p>
{/if}

Expand Down

0 comments on commit 3c274f6

Please sign in to comment.