Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2: search and ask AI #2889

Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix type
  • Loading branch information
SamyPesse committed Feb 27, 2025
commit 59214850b3760bd4fdde56899d880dd4671cafe1
19 changes: 11 additions & 8 deletions packages/gitbook-v2/src/lib/data/types.ts
Original file line number Diff line number Diff line change
@@ -142,12 +142,15 @@ export interface GitBookDataFetcher {
/**
* Search content in a site.
*/
searchSiteContent(
params: Parameters<api.GitBookAPI['orgs']['searchSiteContent']>[2] & {
organizationId: string;
siteId: string;
/** Cache bust to ensure the search results are fresh when the space is updated. */
cacheBust?: string;
}
): Promise<api.SearchSpaceResult[]>;
searchSiteContent(params: {
organizationId: string;
siteId: string;
query: string;
scope:
| { mode: 'all' }
| { mode: 'current'; siteSpaceId: string }
| { mode: 'specific'; siteSpaceIds: string[] };
/** Cache bust to ensure the search results are fresh when the space is updated. */
cacheBust?: string;
}): Promise<api.SearchSpaceResult[]>;
}
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/Search/server-actions.tsx
Original file line number Diff line number Diff line change
@@ -238,7 +238,7 @@ async function searchSiteContent(
siteId: context.site.id,
query,
cacheBust,
...scope,
scope,
});

return (
4 changes: 1 addition & 3 deletions packages/gitbook/src/lib/v1.ts
Original file line number Diff line number Diff line change
@@ -155,9 +155,7 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {
},

async searchSiteContent(params) {
const { organizationId, siteId, query, cacheBust, ...scope } = params;

// @ts-ignore - no fully compatible, but fine enough
const { organizationId, siteId, query, cacheBust, scope } = params;
const result = await searchSiteContent(organizationId, siteId, query, scope, cacheBust);
return result.items;
},
Loading