خلاصه‌های مبتنی بر هوش مصنوعی

کد منبع کامل مثال را ببینید

مکان‌هایی را برای دیدن خلاصه‌های مبتنی بر هوش مصنوعی جستجو کنید. برخی از جستجوهای پیشنهادی:

  • «هتل» برای خلاصه محله‌ها.
  • «ایستگاه شارژ خودروهای برقی» برای خلاصه امکانات رفاهی EVCS.
  • هر رستوران یا کسب و کاری برای خلاصه مکان و نظرات.

تایپ اسکریپت

// Define DOM elements.
const mapElement = document.querySelector('gmp-map') as google.maps.MapElement;
const placeAutocomplete = document.querySelector(
    'gmp-place-autocomplete'
) as google.maps.places.PlaceAutocompleteElement;
const summaryPanel = document.getElementById('summary-panel') as HTMLDivElement;
const placeName = document.getElementById('place-name') as HTMLElement;
const placeAddress = document.getElementById('place-address') as HTMLElement;
const tabContainer = document.getElementById('tab-container') as HTMLDivElement;
const summaryContent = document.getElementById(
    'summary-content'
) as HTMLDivElement;
const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement;
const flagContentLink = document.getElementById('flag-content-link') as HTMLAnchorElement;

let innerMap;
let marker: google.maps.marker.AdvancedMarkerElement;

async function initMap(): Promise<void> {
    // Request needed libraries.
    const [] = await Promise.all([
        google.maps.importLibrary('marker'),
        google.maps.importLibrary('places'),
    ]);

    innerMap = mapElement.innerMap;
    innerMap.setOptions({
        mapTypeControl: false,
        streetViewControl: false,
        fullscreenControl: false,
    });

    // Bind autocomplete bounds to map bounds.
    google.maps.event.addListener(innerMap, 'bounds_changed', async () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds();
    });

    // Create the marker.
    marker = new google.maps.marker.AdvancedMarkerElement({
        map: innerMap,
    });

    // Handle selection of an autocomplete result.
    // prettier-ignore
    // @ts-ignore
    placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => {
            const place = placePrediction.toPlace();

            // Fetch all summary fields.
            await place.fetchFields({
                fields: [
                    'displayName',
                    'formattedAddress',
                    'location',
                    'generativeSummary',
                    'neighborhoodSummary',
                    'reviewSummary',
                    'evChargeAmenitySummary',
                ],
            });

            // Update the map viewport and position the marker.
            if (place.viewport) {
                innerMap.fitBounds(place.viewport);
            } else {
                innerMap.setCenter(place.location);
                innerMap.setZoom(17);
            }
            marker.position = place.location;

            // Update the panel UI.
            updateSummaryPanel(place);
        }
    );
}

function updateSummaryPanel(place: google.maps.places.Place) {
    // Reset UI
    summaryPanel.classList.remove('hidden');
    tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements.
    summaryContent.textContent = '';
    aiDisclosure.textContent = '';

    placeName.textContent = place.displayName || '';
    placeAddress.textContent = place.formattedAddress || '';

    let firstTabActivated = false;

    /**
     * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment).
     */
    const createTab = (
        label: string,
        content: string | Node,
        disclosure: string,
        flagUrl: string
    ) => {
        const btn = document.createElement('button');
        btn.className = 'tab-button';
        btn.textContent = label;

        btn.onclick = () => {
            // Do nothing if the tab is already active.
            if (btn.classList.contains('active')) {
                return;
            }

            // Manage the active class state.
            document
                .querySelectorAll('.tab-button')
                .forEach((b) => b.classList.remove('active'));
            btn.classList.add('active');

            if (typeof content === 'string') {
                summaryContent.textContent = content;
            } else {
                summaryContent.replaceChildren(content.cloneNode(true));
            }

            // Set the disclosure text.
            aiDisclosure.textContent = disclosure || 'AI-generated content.';

            // Add the content flag URI.
            if (flagUrl) {
                flagContentLink.href = flagUrl;
                flagContentLink.textContent = "Report an issue"
            }
        };

        tabContainer.appendChild(btn);

        // Auto-select the first available summary.
        if (!firstTabActivated) {
            btn.click();
            firstTabActivated = true;
        }
    };

    // --- 1. Generative Summary (Place) ---
    //@ts-ignore
    if (place.generativeSummary?.overview) {
        createTab(
            'Overview',
            //@ts-ignore
            place.generativeSummary.overview,
            //@ts-ignore
            place.generativeSummary.disclosureText,
            //@ts-ignore
            place.generativeSummary.flagContentURI
        );
    }

    // --- 2. Review Summary ---
    //@ts-ignore
    if (place.reviewSummary?.text) {
        createTab(
            'Reviews',
            //@ts-ignore
            place.reviewSummary.text,
            //@ts-ignore
            place.reviewSummary.disclosureText,
            //@ts-ignore
            place.reviewSummary.flagContentURI
        );
    }

    // --- 3. Neighborhood Summary ---
    //@ts-ignore
    if (place.neighborhoodSummary?.overview?.content) {
        createTab(
            'Neighborhood',
            //@ts-ignore
            place.neighborhoodSummary.overview.content,
            //@ts-ignore
            place.neighborhoodSummary.disclosureText,
            //@ts-ignore
            place.neighborhoodSummary.flagContentURI
        );
    }

    // --- 4. EV Amenity Summary (uses content blocks)) ---
    //@ts-ignore
    if (place.evChargeAmenitySummary) {
        //@ts-ignore
        const evSummary = place.evChargeAmenitySummary;
        const evContainer = document.createDocumentFragment();

        // Helper to build a safe DOM section for EV categories.
        const createSection = (title: string, text: string) => {
            const wrapper = document.createElement('div');
            wrapper.style.marginBottom = '15px'; // Or use a CSS class

            const titleEl = document.createElement('strong');
            titleEl.textContent = title;

            const textEl = document.createElement('div');
            textEl.textContent = text;

            wrapper.appendChild(titleEl);
            wrapper.appendChild(textEl);
            return wrapper;
        };

        // Check and append each potential section
        if (evSummary.overview?.content) {
            evContainer.appendChild(
                createSection('Overview', evSummary.overview.content)
            );
        }
        if (evSummary.coffee?.content) {
            evContainer.appendChild(
                createSection('Coffee', evSummary.coffee.content)
            );
        }
        if (evSummary.restaurant?.content) {
            evContainer.appendChild(
                createSection('Food', evSummary.restaurant.content)
            );
        }
        if (evSummary.store?.content) {
            evContainer.appendChild(
                createSection('Shopping', evSummary.store.content)
            );
        }

        // Only add the tab if the container has children
        if (evContainer.hasChildNodes()) {
            createTab(
                'EV Amenities',
                evContainer, // Passing a Node instead of string
                evSummary.disclosureText,
                evSummary.flagContentURI
            );
        }
    }

    // Safely handle the empty state.
    if (!firstTabActivated) {
        const msg = document.createElement('em');
        msg.textContent =
            'No AI summaries are available for this specific location.';
        summaryContent.replaceChildren(msg);
        aiDisclosure.textContent = '';
    }
}

initMap();

جاوا اسکریپت

// Define DOM elements.
const mapElement = document.querySelector('gmp-map');
const placeAutocomplete = document.querySelector('gmp-place-autocomplete');
const summaryPanel = document.getElementById('summary-panel');
const placeName = document.getElementById('place-name');
const placeAddress = document.getElementById('place-address');
const tabContainer = document.getElementById('tab-container');
const summaryContent = document.getElementById('summary-content');
const aiDisclosure = document.getElementById('ai-disclosure');
const flagContentLink = document.getElementById('flag-content-link');
let innerMap;
let marker;
async function initMap() {
    // Request needed libraries.
    const [] = await Promise.all([
        google.maps.importLibrary('marker'),
        google.maps.importLibrary('places'),
    ]);
    innerMap = mapElement.innerMap;
    innerMap.setOptions({
        mapTypeControl: false,
        streetViewControl: false,
        fullscreenControl: false,
    });
    // Bind autocomplete bounds to map bounds.
    google.maps.event.addListener(innerMap, 'bounds_changed', async () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds();
    });
    // Create the marker.
    marker = new google.maps.marker.AdvancedMarkerElement({
        map: innerMap,
    });
    // Handle selection of an autocomplete result.
    // prettier-ignore
    // @ts-ignore
    placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => {
        const place = placePrediction.toPlace();
        // Fetch all summary fields.
        await place.fetchFields({
            fields: [
                'displayName',
                'formattedAddress',
                'location',
                'generativeSummary',
                'neighborhoodSummary',
                'reviewSummary',
                'evChargeAmenitySummary',
            ],
        });
        // Update the map viewport and position the marker.
        if (place.viewport) {
            innerMap.fitBounds(place.viewport);
        }
        else {
            innerMap.setCenter(place.location);
            innerMap.setZoom(17);
        }
        marker.position = place.location;
        // Update the panel UI.
        updateSummaryPanel(place);
    });
}
function updateSummaryPanel(place) {
    // Reset UI
    summaryPanel.classList.remove('hidden');
    tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements.
    summaryContent.textContent = '';
    aiDisclosure.textContent = '';
    placeName.textContent = place.displayName || '';
    placeAddress.textContent = place.formattedAddress || '';
    let firstTabActivated = false;
    /**
     * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment).
     */
    const createTab = (label, content, disclosure, flagUrl) => {
        const btn = document.createElement('button');
        btn.className = 'tab-button';
        btn.textContent = label;
        btn.onclick = () => {
            // Do nothing if the tab is already active.
            if (btn.classList.contains('active')) {
                return;
            }
            // Manage the active class state.
            document
                .querySelectorAll('.tab-button')
                .forEach((b) => b.classList.remove('active'));
            btn.classList.add('active');
            if (typeof content === 'string') {
                summaryContent.textContent = content;
            }
            else {
                summaryContent.replaceChildren(content.cloneNode(true));
            }
            // Set the disclosure text.
            aiDisclosure.textContent = disclosure || 'AI-generated content.';
            // Add the content flag URI.
            if (flagUrl) {
                flagContentLink.href = flagUrl;
                flagContentLink.textContent = "Report an issue";
            }
        };
        tabContainer.appendChild(btn);
        // Auto-select the first available summary.
        if (!firstTabActivated) {
            btn.click();
            firstTabActivated = true;
        }
    };
    // --- 1. Generative Summary (Place) ---
    //@ts-ignore
    if (place.generativeSummary?.overview) {
        createTab('Overview', 
        //@ts-ignore
        place.generativeSummary.overview, 
        //@ts-ignore
        place.generativeSummary.disclosureText, 
        //@ts-ignore
        place.generativeSummary.flagContentURI);
    }
    // --- 2. Review Summary ---
    //@ts-ignore
    if (place.reviewSummary?.text) {
        createTab('Reviews', 
        //@ts-ignore
        place.reviewSummary.text, 
        //@ts-ignore
        place.reviewSummary.disclosureText, 
        //@ts-ignore
        place.reviewSummary.flagContentURI);
    }
    // --- 3. Neighborhood Summary ---
    //@ts-ignore
    if (place.neighborhoodSummary?.overview?.content) {
        createTab('Neighborhood', 
        //@ts-ignore
        place.neighborhoodSummary.overview.content, 
        //@ts-ignore
        place.neighborhoodSummary.disclosureText, 
        //@ts-ignore
        place.neighborhoodSummary.flagContentURI);
    }
    // --- 4. EV Amenity Summary (uses content blocks)) ---
    //@ts-ignore
    if (place.evChargeAmenitySummary) {
        //@ts-ignore
        const evSummary = place.evChargeAmenitySummary;
        const evContainer = document.createDocumentFragment();
        // Helper to build a safe DOM section for EV categories.
        const createSection = (title, text) => {
            const wrapper = document.createElement('div');
            wrapper.style.marginBottom = '15px'; // Or use a CSS class
            const titleEl = document.createElement('strong');
            titleEl.textContent = title;
            const textEl = document.createElement('div');
            textEl.textContent = text;
            wrapper.appendChild(titleEl);
            wrapper.appendChild(textEl);
            return wrapper;
        };
        // Check and append each potential section
        if (evSummary.overview?.content) {
            evContainer.appendChild(createSection('Overview', evSummary.overview.content));
        }
        if (evSummary.coffee?.content) {
            evContainer.appendChild(createSection('Coffee', evSummary.coffee.content));
        }
        if (evSummary.restaurant?.content) {
            evContainer.appendChild(createSection('Food', evSummary.restaurant.content));
        }
        if (evSummary.store?.content) {
            evContainer.appendChild(createSection('Shopping', evSummary.store.content));
        }
        // Only add the tab if the container has children
        if (evContainer.hasChildNodes()) {
            createTab('EV Amenities', evContainer, // Passing a Node instead of string
            evSummary.disclosureText, evSummary.flagContentURI);
        }
    }
    // Safely handle the empty state.
    if (!firstTabActivated) {
        const msg = document.createElement('em');
        msg.textContent =
            'No AI summaries are available for this specific location.';
        summaryContent.replaceChildren(msg);
        aiDisclosure.textContent = '';
    }
}
initMap();

سی‌اس‌اس

/* Reuse existing map height */
gmp-map {
    height: 100%;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Existing Autocomplete Card Style */
.place-autocomplete-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 15px;
    font-family: Roboto, sans-serif;
    font-size: 1rem;
}

gmp-place-autocomplete {
    width: 300px;
}

/* New: Summary Panel Styles */
.summary-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 0; /* Padding handled by children */
    font-family: Roboto, sans-serif;
    width: 350px;
    max-height: 80vh; /* Prevent overflow on small screens */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

#place-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

#place-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

#place-address {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background-color: #f1f1f1;
}

.tab-button.active {
    font-weight: bold;
    border-bottom: 3px solid #000000;
}

.tab-button.active:hover {
    background-color: #ffffff;
    cursor: default;
}

/* Content Area */
.content-area {
    padding: 15px;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #333;
}

.disclosure-footer {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    font-style: italic;
}

.flag-content-link {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
}
/* Reuse existing map height */
gmp-map {
    height: 100%;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Existing Autocomplete Card Style */
.place-autocomplete-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 15px;
    font-family: Roboto, sans-serif;
    font-size: 1rem;
}

gmp-place-autocomplete {
    width: 300px;
}

/* New: Summary Panel Styles */
.summary-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 0; /* Padding handled by children */
    font-family: Roboto, sans-serif;
    width: 350px;
    max-height: 80vh; /* Prevent overflow on small screens */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

#place-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

#place-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

#place-address {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background-color: #f1f1f1;
}

.tab-button.active {
    font-weight: bold;
    border-bottom: 3px solid #000000;
}

.tab-button.active:hover {
    background-color: #ffffff;
    cursor: default;
}

/* Content Area */
.content-area {
    padding: 15px;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #333;
}

.disclosure-footer {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    font-style: italic;
}

.flag-content-link {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
}

اچ‌تی‌ام‌ال

<html>
    <head>
        <title>AI Place Summaries</title>
        <link rel="stylesheet" type="text/css" href="./style.css" />
        <script type="module" src="./index.js"></script>
        <!-- prettier-ignore -->
        <script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
        ({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
    </head>
    <body>
        <gmp-map center="37.805, -122.425" zoom="14" map-id="DEMO_MAP_ID">
            <!-- Search Input Card -->
            <div
                class="place-autocomplete-card"
                slot="control-inline-start-block-start">
                <p>Search for a place with AI summaries:</p>
                <gmp-place-autocomplete></gmp-place-autocomplete>
            </div>

            <!-- Summary text panel (initially hidden) -->
            <div
                id="summary-panel"
                class="summary-card hidden"
                slot="control-inline-end-block-start">
                <div id="place-header">
                    <h2 id="place-name"></h2>
                    <p id="place-address"></p>
                </div>

                <!-- Tabs for toggling summary types -->
                <div class="tab-container" id="tab-container"></div>

                <!-- Content display area -->
                <div id="summary-content" class="content-area"></div>

                <!-- Legal/AI Disclosure -->
                <div id="ai-disclosure" class="disclosure-footer"></div>

                <!-- Flag content link -->
                <a id="flag-content-link" class="flag-content-link"></a>
            </div>
        </gmp-map>
    </body>
</html>

نمونه را امتحان کنید

خلاصه‌های مبتنی بر هوش مصنوعی، مروری بر یک مکان یا منطقه هستند که بینش‌های مفیدی در مورد مکان‌های خاص، منطقه اطراف یک مکان و بررسی‌های مرتبط با آن مکان ارائه می‌دهند. سه نوع مختلف خلاصه مبتنی بر هوش مصنوعی وجود دارد:

  • خلاصه مکان : یک مرور کلی ۱۰۰ کاراکتری و مختصر مختص به یک شناسه مکان مشخص که انواع مختلفی از داده‌ها را در یک تصویر کلی از یک مکان گردآوری می‌کند.

  • خلاصه نظرات : خلاصه‌ای از یک مکان که صرفاً بر اساس نظرات کاربران تهیه شده است.

  • خلاصه منطقه : خلاصه‌ای تولید شده برای منطقه اطراف یک مکان، که زمینه اضافی از جمله نقاط مورد علاقه نزدیک را ارائه می‌دهد. خلاصه‌های منطقه می‌توانند یکی از دو نوع باشند:

    • خلاصه محله : یک نمای کلی سطح بالا از نقاط دیدنی اطراف برای مکان‌هایی با انواع premise ، street_address و همه انواع موجود در دسته‌بندی‌های Housing و Lodging .

    • خلاصه امکانات ایستگاه شارژ خودروهای برقی : یک نمای کلی سطح بالا از نقاط دیدنی اطراف برای مکان‌هایی با نوع electric_vehicle_charging_station .

خلاصه‌های مبتنی بر هوش مصنوعی را بازیابی کنید

برای بازیابی و نمایش خلاصه‌های مبتنی بر هوش مصنوعی، مراحل زیر را دنبال کنید:

  1. کتابخانه Places را بارگذاری کنید .

    const { Place } = await google.maps.importLibrary("places");
  2. دریافت یک نمونه Place . قطعه کد زیر ایجاد یک نمونه Place را از یک place ID نشان می‌دهد:

    const place = new Place("ChIJaYaXFTqq3oARNy537Kb_W_c");
  3. در فراخوانی تابع place.fetchFields() ، فیلدهای مربوط به انواع خلاصه‌هایی که می‌خواهید استفاده کنید را مشخص کنید. در قطعه کد زیر، تمام فیلدهای خلاصه درخواست می‌شوند:

    await place.fetchFields({
      fields: [
        'generativeSummary',
        'neighborhoodSummary',
        'reviewSummary',
        'evChargeAmenitySummary'
        // Include other fields as needed.
      ]
    });
              
  4. داده‌های خلاصه را به ترتیب با دسترسی به ویژگی‌های generativeSummary ، neighborhoodSummary ، reviewSummary و evChargeAmenitySummary بازیابی کنید. قطعه کد زیر بازیابی نمای کلی از یک generativeSummary را نشان می‌دهد.

    const summaryText = place.generativeSummary.overview;
            

از آنجا که همه مکان‌ها خلاصه‌های مبتنی بر هوش مصنوعی ندارند، قبل از نمایش آن به کاربران، حتماً وجود داده‌های مورد نیاز را بررسی کنید. قطعه کد زیر از یک عبارت if برای بررسی وجود generativeSummary استفاده می‌کند:

if (place.generativeSummary) {
  overviewText = place.generativeSummary.overview;
} else {
  overviewText = 'No summary is available.';
}
    

روش دیگر، استفاده از یک عملگر nullish برای بررسی مختصر وجود خلاصه است:

const overviewText = place.generativeSummary.overview ?? 'No summary is available.';
    

نمایش ویژگی‌های مورد نیاز

تمام خلاصه‌های نمایش داده شده با هوش مصنوعی در برنامه شما باید با ذکر منبع مناسب مطابق با سیاست‌ها و استانداردهای گوگل همراه باشند. برای اطلاعات بیشتر، به بخش سیاست‌ها و منابع مربوط به Maps JavaScript API مراجعه کنید.

خلاصه مکان‌ها

خلاصه مکان‌ها، خلاصه‌های مختصر و ۱۰۰ کاراکتری مختص به یک شناسه مکان مشخص هستند که تصویری کلی از یک مکان ارائه می‌دهند. خلاصه مکان‌ها ممکن است غذاها، خدمات یا کالاهای محبوب موجود برای خرید در یک مکان را برجسته کنند:

  • «رستوران فروم شاپز، غذاهای سنتی ایتالیایی را در فضایی خودمانی سرو می‌کند.»

  • «سالن زیبایی که خدمات کوتاهی و رنگ مو و همچنین اکستنشن مو ارائه می‌دهد.»

  • «فروشگاهی بزرگ با فروشندگان فراوان که انواع دکور، مبلمان و لباس‌های قدیمی را ارائه می‌دهند.»

خلاصه مکان‌ها برای انواع مکان‌های نشان داده شده در انواع پشتیبانی شده برای دسته‌های فرهنگ ، سرگرمی و تفریح ، غذا و نوشیدنی ، خرید ، خدمات و ورزش در دسترس است.

خلاصه مکان‌ها برای نکات مورد علاقه در زبان‌ها و مناطق زیر پشتیبانی می‌شود:

زبان منطقه
انگلیسی

هند

ایالات متحده

درخواست خلاصه مکان

برای درخواست خلاصه مکان مولد، فیلد generativeSummary را هنگام فراخوانی fetchFields() اضافه کنید:

await place.fetchFields({
    fields: [
        'generativeSummary',
        // Include other fields as needed.
    ],
});
    

از ویژگی generativeSummary برای بازیابی خلاصه مکان‌ها استفاده کنید. قطعه کد زیر نمای کلی و متن افشا را از generativeSummary بازیابی می‌کند:

if (place.generativeSummary) {
    console.log("Place Overview:", place.generativeSummary.overview);
    console.log("Disclosure:", place.generativeSummary.disclosureText);
}
    

خلاصه‌های مرور

خلاصه نظرات، خلاصه‌هایی هستند که صرفاً بر اساس نظرات کاربران تولید می‌شوند. با ترکیب عناصر کلیدی نظرات کاربران، مانند ویژگی‌های مکان و نظر منتقد، خلاصه نظرات بینش سطح بالایی ارائه می‌دهد و به کاربران در تصمیم‌گیری آگاهانه کمک می‌کند.

برای مثال، خلاصه‌ای از نقد و بررسی ساختمان فری در سانفرانسیسکو شامل اطلاعاتی از غذا و خرید گرفته تا مناظر و جو آن می‌شود:

بازدیدکنندگان می‌گویند این مکان تاریخی، مجموعه‌ای متنوع از مغازه‌ها، رستوران‌ها و بازار کشاورزان را ارائه می‌دهد و بسیاری از آنها از مناظر خلیج و شهر تمجید می‌کنند. آنها همچنین فضای پر جنب و جوش، دسترسی راحت به مقاصد دیگر با کشتی و فرصت لذت بردن از مشاغل محلی را برجسته می‌کنند.

خلاصه نظرات برای نکات مورد علاقه در زبان‌ها و مناطق زیر پشتیبانی می‌شود:

زبان منطقه
انگلیسی آرژانتین، بولیوی، برزیل، شیلی، کلمبیا، کاستاریکا، جمهوری دومینیکن، اکوادور، گواتمالا، هند، ژاپن، مکزیک، پاراگوئه، پرو، بریتانیا، ایالات متحده، اروگوئه، ونزوئلا
ژاپنی ژاپن
پرتغالی برزیل
اسپانیایی آرژانتین، بولیوی، شیلی، کلمبیا، کاستاریکا، جمهوری دومینیکن، اکوادور، گواتمالا، مکزیک، پاراگوئه، پرو، ایالات متحده آمریکا، اروگوئه، ونزوئلا

درخواست خلاصه بررسی

برای درخواست خلاصه بررسی، هنگام فراخوانی fetchFields() فیلد reviewSummary اضافه کنید:

await place.fetchFields({
    fields: [
        'reviewSummary',
        // Include other fields as needed.
    ],
});
  

از ویژگی reviewSummary برای بازیابی خلاصه‌های نقد و بررسی استفاده کنید. برای بازیابی خلاصه‌های نقد و بررسی، به ویژگی reviewSummary.text دسترسی پیدا کنید. قطعه کد زیر متن را از یک reviewSummary بازیابی می‌کند.

if (place.reviewSummary) {
    console.log("Place Review Summary:", place.reviewSummary.text);
}
  

خلاصه‌های منطقه

خلاصه‌های منطقه‌ای برای منطقه اطراف یک مکان ایجاد می‌شوند. خلاصه‌های منطقه‌ای، زمینه بیشتری برای یک مکان، از جمله نقاط دیدنی اطراف، فراهم می‌کنند تا کاربران بتوانند پس از رسیدن به آنجا، تصمیم آگاهانه‌تری در مورد مکان مورد نظر و کارهایی که باید انجام دهند، بگیرند. به عنوان مثال، هنگام بازدید از یک شهر جدید، می‌توانید خلاصه محله تولید شده برای یک هتل را مشاهده کنید تا درباره منطقه اطراف اطلاعات بیشتری کسب کنید:

  • این منطقه پر جنب و جوش در سانفرانسیسکو، که ساحل شمالی و محله چینی‌ها را در هم می‌آمیزد، در شمال غربی منطقه مالی واقع شده و دارای بناهای تاریخی ادبی، جاذبه‌های فرهنگی منحصر به فرد و رستوران‌های متنوع است. از جمله مکان‌های قابل توجه می‌توان به کتابفروشی نمادین سیتی لایتس، موزه جذاب تله کابین و خیابان‌های شلوغ محله چینی‌ها اشاره کرد.

اگر قصد شارژ کردن یک وسیله نقلیه الکتریکی را دارید، می‌توانید خلاصه‌ای از اطلاعات تولید شده برای یک ایستگاه شارژ وسیله نقلیه الکتریکی را مشاهده کنید تا اطلاعات بیشتری در مورد منطقه اطراف کسب کنید:

  • این منطقه طیف وسیعی از گزینه‌های غذاخوری را در عرض ۹ دقیقه پیاده‌روی ارائه می‌دهد، از جمله استارباکس، سوشی جین و سیف‌وی.

همراه با شرح منطقه، پاسخ همچنین شامل فهرستی از نمونه‌های Place برای مکان‌های ارجاع داده شده در شرح است؛ برای درخواست جزئیات بیشتر برای هر مکان، تابع fetchFields() را روی این نمونه‌های Place فراخوانی کنید.

دو نوع خلاصه منطقه مبتنی بر هوش مصنوعی وجود دارد:

  • خلاصه محله : یک نمای کلی سطح بالا از نقاط دیدنی اطراف برای مکان‌هایی با انواع premise ، street_address و همه انواع موجود در دسته‌بندی‌های Housing و Lodging .

  • خلاصه امکانات ایستگاه شارژ خودروهای برقی : یک نمای کلی سطح بالا از نقاط دیدنی اطراف برای مکان‌هایی با نوع electric_vehicle_charging_station .

خلاصه‌های منطقه‌ای برای نکات مورد علاقه در زبان‌ها و مناطق زیر پشتیبانی می‌شوند:

زبان منطقه
انگلیسی ایالات متحده

درخواست خلاصه محله

شما می‌توانید خلاصه محله را برای مکان‌هایی با انواع premise ، street_address و همه انواع در دسته‌بندی‌های مسکن و اقامتگاه درخواست کنید. برای درخواست خلاصه محله، هنگام فراخوانی تابع fetchFields() فیلد neighborhoodSummary را نیز اضافه کنید:

await place.fetchFields({
    fields: [
        'neighborhoodSummary',
        // Include other fields as needed.
    ],
});
  

از ویژگی neighborhoodSummary برای بازیابی خلاصه‌های همسایگی استفاده کنید. برای بازیابی خلاصه‌های همسایگی، برای دریافت متن به ویژگی neighborhoodSummary.content دسترسی پیدا کنید.

قطعه کد زیر محتوای یک neighborhoodSummary را بازیابی می‌کند:

if (place.neighborhoodSummary) {
    console.log("Place Neighborhood Summary:", place.neighborhoodSummary.overview.content);
}
  

خلاصه امکانات رفاهی ایستگاه شارژ خودروی برقی را درخواست کنید

شما می‌توانید خلاصه امکانات ایستگاه شارژ خودروهای الکتریکی را برای مکان‌هایی با نوع electric_vehicle_charging_station درخواست کنید. خلاصه امکانات EVCS چهار نوع خلاصه ارائه می‌دهد: overview ، coffee ، restaurant و store ؛ به همین دلیل ساختار داده آن آرایه‌ای از اشیاء است که هر کدام شامل یک خلاصه است. برای درخواست خلاصه امکانات ایستگاه شارژ خودروهای الکتریکی، هنگام فراخوانی fetchFields() فیلد evChargeAmenitySummary را وارد کنید:

await place.fetchFields({
    fields: [
        'evChargeAmenitySummary',
        // Include other fields as needed.
    ],
});
  

از ویژگی evChargeAmenitySummary برای بازیابی خلاصه امکانات ایستگاه شارژ خودروهای الکتریکی استفاده کنید. برای بازیابی متن از این خلاصه‌ها، به ویژگی content از ویژگی‌های evChargeAmenitySummary.overview ، evChargeAmenitySummary.coffee ، evChargeAmenitySummary.restaurant و evChargeAmenitySummary.store دسترسی پیدا کنید.

قطعه کد زیر محتوای یک evChargeAmenitySummary را بازیابی می‌کند:

// overview, coffee, restaurant, store.
if (place.evChargeAmenitySummary) {
    console.log("Place EVCS Amenity Summary:", place.evChargeAmenitySummary.overview.content);
    console.log("Coffee:", place.evChargeAmenitySummary.coffee.content);
    console.log("Restaurants:", place.evChargeAmenitySummary.restaurant.content);
    console.log("Stores:", place.evChargeAmenitySummary.store.content);
}