Skip to content

[refactor] connect Open Library pages to Lark API - #100

Merged
TechQuery merged 12 commits into
mainfrom
copilot/connect-open-library-feishu-api
Jul 24, 2026
Merged

[refactor] connect Open Library pages to Lark API#100
TechQuery merged 12 commits into
mainfrom
copilot/connect-open-library-feishu-api

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR-100 PR-100 PR-100 Powered by Pull Request Badge

This updates the shared search infrastructure to include Open Library books sourced from the Feishu-backed book dataset. Book search results now participate in the existing /search/[model] flow and render with the established Open Library card UI.

  • Search model integration

    • Added SearchBookModel in models/Book.ts
    • Registered book in SystemModel.searchMap so books can be queried through the common search entrypoint
  • Search result rendering

    • Added the Open Library tab/label in pages/search/[model]/index.tsx
    • Mapped book results to the existing Open Library book card presentation
  • API support for search

    • Extended pages/api/open-library/books.ts to support:
      • keyword filtering
      • page-based slicing
      • total count response for the generic search page
    • Preserved the original full-list response when no search/pagination params are provided, so existing callers keep working
  • Response shape

    • Introduced a typed paginated response for book search results
export class SearchBookModel extends ListModel<Book, SearchBookFilter> {
  client = ownClient;
  baseURI = 'open-library/books';

  async loadPage(page = this.pageIndex, pageSize = this.pageSize, { keywords = '' }: SearchBookFilter = {}) {
    const { body } = await this.client.get<SearchBookPage>(
      `${this.baseURI}?${buildURLData({ keywords, page, pageSize })}`,
    );

    if (!body) throw new Error('Open Library book search API returned an empty response');

    return { pageData: body.data, totalCount: body.totalCount };
  }
}

Human changes

  1. [optimize] simplify AI codes of Open Library pages
  2. [optimize] update Upstream packages

Copilot AI review requested due to automatic review settings July 23, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI linked an issue Jul 23, 2026 that may be closed by this pull request
@TechQuery TechQuery added the feature New feature or request label Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 23, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title [WIP] Connect open library Feishu multi-dimensional table API Add Open Library books to shared search flow Jul 23, 2026
Copilot AI requested a review from TechQuery July 23, 2026 10:47

@TechQuery TechQuery left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 在重复理解 issue 中的各条链接内容的前提下再写代码

Comment thread models/Book.ts Outdated
Comment thread pages/api/open-library/books.ts Outdated
Copilot AI review requested due to automatic review settings July 23, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 在重复理解 issue 中的各条链接内容的前提下再写代码

已按 issue 里的链接重新对照后修改,现已改成走飞书表格数据源,并删除临时 books API。5934fe6

Copilot AI requested a review from TechQuery July 23, 2026 12:04
Copilot AI review requested due to automatic review settings July 24, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

pages/open-library/books/index.tsx:40

  • store={new BookModel()} creates a fresh store instance on every render, which can reset list state and trigger unnecessary network requests. Memoize the store instance so ScrollList can preserve pagination/loading state across renders.
        <ScrollList
          translator={i18n}
          store={new BookModel()}
          defaultData={books}

Comment thread models/Book.ts Outdated
Comment thread models/Book.ts
Comment on lines +34 to +41
export class BookModel extends BiDataTable<Book>() {
client = larkClient;

queryOptions: BiDataQueryOptions = { text_field_as_array: false };

constructor(appId = LibraryBaseId, tableId = BookTableId) {
super(appId, tableId);
}
Comment thread models/Book.ts
Comment on lines +44 to +55
export class SearchBookModel extends BiSearch<Book>(BookModel) {
searchKeys = [
'title',
'isbn',
'authors',
'summary',
'recommendation',
'tags',
'donors',
'keepers',
];
}
Comment thread pages/search/[model]/index.tsx
Comment thread pages/open-library/books/index.tsx Outdated
Comment thread models/Book.ts Fixed
Copilot AI review requested due to automatic review settings July 24, 2026 17:21
@TechQuery
TechQuery marked this pull request as ready for review July 24, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (2)

models/Book.ts:44

  • The PR description states that pages/api/open-library/books.ts was extended for keyword filtering/pagination and that search uses the /api/open-library/books endpoint, but this branch deletes that API route and implements book search via BiDataTable/BiSearch against Lark instead. Either the PR description needs updating, or the intended API-backed search flow is missing.
}

export class SearchBookModel extends BiSearch<Book>(BookModel) {
  searchKeys = [
    'title',

pages/open-library/book/[id].tsx:106

  • The ISBN label is hardcoded as ISBN while the surrounding metadata labels use t(...). This creates an untranslated user-facing string and breaks the project’s i18n pattern on this page.
                  <Col as="li">
                    <div className="text-muted small">ISBN</div>
                    <div>{isbn || t('not_available')}</div>
                  </Col>

Comment on lines 44 to 49
const SearchNameMap = ({ t }: typeof i18n): Record<string, string> => ({
activity: t('activity'),
book: t('open_library'),
project: t('open_source_projects'),
NGO: t('NGO'),
});
Comment thread package.json
@TechQuery TechQuery changed the title Add Open Library books to shared search flow [refactor] connect Open Library pages to Lark API Jul 24, 2026
@TechQuery
TechQuery merged commit 91c553c into main Jul 24, 2026
5 checks passed
@TechQuery
TechQuery deleted the copilot/connect-open-library-feishu-api branch July 24, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

对接【开源图书馆】飞书多维表格 API

3 participants