[Slides] Let image search use a configurable Custom Search address

オープン 初心者向け
#9,124 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
api, backend

調査の方向性

templates/slides/server/lib/media-search-providers.ts から始めてください。そこで GOOGLE_IMAGE_SEARCH_URL が定義され、Custom Search のリクエストが組み立てられています。その後、server/register-secrets.ts で GOOGLE_SEARCH_CX がどのように登録されているか確認してください。省略可能なシークレット GOOGLE_SEARCH_URL を追加し、.env.example にコメントアウトした状態で記載し、media-search-providers.test.ts で両方のケースを網羅してください。何も設定されていないときはリクエストが変わらず、設定されているときは設定されたアドレスに送られれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Slides image search sends every request to GOOGLE_IMAGE_SEARCH_URL, a constant set to https://www.googleapis.com/customsearch/v1 in templates/slides/server/lib/media-search-providers.ts:3. Only GOOGLE_API_KEY and GOOGLE_SEARCH_CX come from settings.

Google's overview page says "Existing Custom Search JSON API customers have until January 1, 2027 to transition to an alternative solution" (https://developers.google.com/custom-search/v1/overview). After that date image search in Slides stops for everyone who set it up, and there is no setting that changes where the request goes.

I'd like to add one optional setting, GOOGLE_SEARCH_URL, resolved the same way as the other two:

const [apiKey, searchEngineId, searchUrl] = await Promise.all([
  runtime.resolveSecret("GOOGLE_API_KEY"),
  runtime.resolveSecret("GOOGLE_SEARCH_CX"),
  runtime.resolveSecret("GOOGLE_SEARCH_URL"),
]);
// ...
const response = await runtime.fetch(
  `${searchUrl || GOOGLE_IMAGE_SEARCH_URL}?${params}`,
  fetchOptions(),
);

It would be registered in server/register-secrets.ts with required: false like GOOGLE_SEARCH_CX, listed commented out in .env.example, and covered in media-search-providers.test.ts with one case that the request goes to Google when it isn't set and one that it goes to the configured address when it is. With nothing set the request is the same as today.

Since CONTRIBUTING asks for an issue before a new config option, I wanted to check the shape first. I can send it as a PR if this works for you.

主要言語
TypeScript
スター
7.7k
フォーク
706
平均マージ
1日 11時間
マージ済み PR(30日)
790

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

BuilderIO/agent-native のほかの issue

BuilderIO/agent-native の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。