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
Implement search in v1
  • Loading branch information
SamyPesse committed Feb 27, 2025
commit ba4e1d4d8a3ce9b0b39d36d881237304f7c523fd
10 changes: 9 additions & 1 deletion packages/gitbook/src/lib/v1.ts
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import {
getSiteRedirectBySource,
getSpace,
getUserById,
searchSiteContent,
} from './api';
import { getDynamicCustomizationSettings } from './customization';
import { getBasePath, getHost } from './links';
@@ -90,7 +91,6 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {

// @ts-ignore - types are compatible enough, and this will not be called in v1 this way
getPublishedContentByUrl(params) {
console.log('getPublishedContentByUrl', params);
return getPublishedContentByUrl(
params.url,
params.visitorAuthToken ?? undefined,
@@ -153,6 +153,14 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {
getEmbedByUrl(params) {
return getEmbedByUrlInSpace(params.spaceId, params.url);
},

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

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

return dataFetcher;
Loading
Oops, something went wrong.