ข้อมูลสรุปที่ทำงานด้วยระบบ AI

ดูซอร์สโค้ดตัวอย่างที่เสร็จสมบูรณ์

ค้นหาสถานที่เพื่อดูข้อมูลสรุปที่ทำงานด้วยระบบ AI การค้นหาที่แนะนำบางรายการมีดังนี้

  • "โรงแรม" สำหรับข้อมูลสรุปเกี่ยวกับย่านใกล้เคียง
  • "สถานีชาร์จ EV" สำหรับข้อมูลสรุปสิ่งอำนวยความสะดวกของ EVCS
  • ร้านอาหารหรือธุรกิจใดก็ได้สำหรับสรุปสถานที่และรีวิว

TypeScript

// 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'
) as HTMLAnchorElement;

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

async function init(): Promise<void> {
    // Request needed libraries.
    const [{ AdvancedMarkerElement }] = 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.
    innerMap.addListener('bounds_changed', () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds()!;
    });

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

    // Handle selection of an autocomplete result.
    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 | null,
        flagUrl: string | null
    ) => {
        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) ---
    if (place.generativeSummary?.overview) {
        createTab(
            'Overview',
            place.generativeSummary.overview,
            place.generativeSummary.disclosureText,
            place.generativeSummary.flagContentURI
        );
    }

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

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

    // --- 4. EV Amenity Summary (uses content blocks)) ---
    if (place.evChargeAmenitySummary) {
        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 = '';
    }
}

void init();

JavaScript

// 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 init() {
    // Request needed libraries.
    const [{ AdvancedMarkerElement }] = 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.
    innerMap.addListener('bounds_changed', () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds();
    });

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

    // Handle selection of an autocomplete result.
    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) ---
    if (place.generativeSummary?.overview) {
        createTab(
            'Overview',
            place.generativeSummary.overview,
            place.generativeSummary.disclosureText,
            place.generativeSummary.flagContentURI
        );
    }

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

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

    // --- 4. EV Amenity Summary (uses content blocks)) ---
    if (place.evChargeAmenitySummary) {
        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 = '';
    }
}

void init();

CSS

/* 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: 2px;
    font-family: Roboto, sans-serif;
    font-size: 1rem;
}

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

/* 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;
}

HTML

<html>
    <head>
        <title>AI Place Summaries</title>
        <link rel="stylesheet" type="text/css" href="./style.css" />
        <script type="module" src="./index.js"></script>
        <script>
            // prettier-ignore
            (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: "GOOGLE_MAPS_API_KEY"
            });
        </script>
    </head>
    <body>
        <gmp-map center="37.80, -122.425" zoom="14" map-id="DEMO_MAP_ID">
            <!-- Search Input Card -->
            <div
                class="place-autocomplete-card"
                slot="control-inline-start-block-start">
                <gmp-place-autocomplete
                    placeholder="Find places with AI summaries"></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>

ข้อมูลสรุปที่ทำงานด้วยระบบ AI คือภาพรวมของสถานที่หรือพื้นที่ซึ่งให้ข้อมูลเชิงลึกที่เป็นประโยชน์เกี่ยวกับสถานที่ที่เฉพาะเจาะจง พื้นที่รอบๆ สถานที่ และรีวิวที่เกี่ยวข้องกับสถานที่ ข้อมูลสรุปที่ทำงานด้วยระบบ AI มี 3 ประเภทด้วยกัน ดังนี้

  • ข้อมูลสรุปเกี่ยวกับสถานที่: ภาพรวมสั้นๆ ความยาว 100 อักขระที่เจาะจงสำหรับรหัสสถานที่หนึ่งๆ ซึ่งรวบรวมข้อมูลประเภทต่างๆ ไว้เป็นภาพรวมระดับสูงของสถานที่

  • สรุปรีวิว: ข้อมูลสรุปที่สร้างขึ้นเกี่ยวกับสถานที่ซึ่งอิงตามรีวิวจากผู้ใช้เท่านั้น

  • ข้อมูลสรุปเกี่ยวกับพื้นที่: ข้อมูลสรุปที่สร้างขึ้นสำหรับพื้นที่รอบๆ สถานที่ ซึ่งให้บริบทเพิ่มเติม รวมถึงจุดที่น่าสนใจในบริเวณใกล้เคียง ข้อมูลสรุปเกี่ยวกับพื้นที่อาจเป็นประเภทใดประเภทหนึ่งจาก 2 ประเภทต่อไปนี้

    • ข้อมูลสรุปเกี่ยวกับย่านใกล้เคียง: ภาพรวมระดับสูงของจุดที่น่าสนใจในบริเวณใกล้เคียงสำหรับสถานที่ที่มีประเภท premise, street_address และทุกประเภทในหมวดหมู่ที่พักอาศัยและที่พัก

    • ข้อมูลสรุปเกี่ยวกับสิ่งอำนวยความสะดวกของสถานีชาร์จรถยนต์ไฟฟ้า: ภาพรวมระดับสูงของจุดที่น่าสนใจในบริเวณใกล้เคียงสำหรับสถานที่ที่มีประเภท electric_vehicle_charging_station

เรียกดูข้อมูลสรุปที่ทำงานด้วยระบบ AI

หากต้องการเรียกข้อมูลและแสดงข้อมูลสรุปที่ทำงานด้วยระบบ AI ให้ทำตามขั้นตอนต่อไปนี้

  1. โหลดไลบรารี Places

    const { Place } = await google.maps.importLibrary("places");
  2. รับอินสแตนซ์ Place ข้อมูลโค้ดต่อไปนี้แสดงการสร้างอินสแตนซ์ Place จากรหัสสถานที่

    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;
            

เนื่องจากสถานที่บางแห่งไม่มีข้อมูลสรุปที่ทำงานด้วยระบบ AI โปรดตรวจสอบว่ามีข้อมูลที่จำเป็นก่อนที่จะแสดงต่อผู้ใช้ ข้อมูลโค้ดต่อไปนี้ใช้คำสั่ง 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.';
    

แสดงการระบุแหล่งที่มาที่จำเป็น

ข้อมูลสรุปที่ทำงานด้วยระบบ AI ทั้งหมดที่แสดงในแอปของคุณต้องมีการระบุแหล่งที่มาที่เหมาะสมตามนโยบายและมาตรฐานของ Google ดูข้อมูลเพิ่มเติมได้ที่นโยบายและการระบุแหล่งที่มาสำหรับ Maps JavaScript API

ข้อมูลสรุปเกี่ยวกับสถานที่

ข้อมูลสรุปเกี่ยวกับสถานที่เป็นภาพรวมสั้นๆ ความยาว 100 อักขระที่เจาะจงรหัสสถานที่หนึ่งๆ เพื่อให้ภาพรวมระดับสูงของสถานที่นั้น ข้อมูลสรุปเกี่ยวกับสถานที่อาจไฮไลต์อาหาร บริการ หรือสินค้าที่ได้รับความนิยมซึ่งมีจำหน่ายในสถานที่นั้นๆ ดังนี้

  • "ร้านอาหารใน Forum Shops เสิร์ฟอาหารอิตาเลียนแบบดั้งเดิมจานใหญ่ในบรรยากาศสบายๆ"

  • "ร้านทำผมสุดเก๋ที่ให้บริการตัดผม ทำสีผม และไดร์ผม"

  • "ร้านค้าขนาดใหญ่ที่มีผู้ขายหลายรายจำหน่ายของตกแต่ง เฟอร์นิเจอร์ และเสื้อผ้าวินเทจหลากหลายรายการ"

ข้อมูลสรุปของสถานที่มีให้บริการสำหรับประเภทสถานที่ที่แสดงในประเภทที่รองรับสำหรับหมวดหมู่วัฒนธรรม ความบันเทิงและนันทนาการ อาหารและเครื่องดื่ม ช็อปปิ้ง บริการ และกีฬา

ระบบรองรับข้อมูลสรุปของสถานที่น่าสนใจในภาษาและภูมิภาคต่อไปนี้

ภาษา ภูมิภาค
อังกฤษ

อินเดีย

สหรัฐอเมริกา

ขอข้อมูลสรุปเกี่ยวกับสถานที่

หากต้องการขอข้อมูลสรุปเกี่ยวกับสถานที่ที่สร้างขึ้น ให้ใส่ช่อง 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);
}
    

สรุปรีวิว

สรุปรีวิวคือข้อมูลสรุปที่สร้างขึ้นโดยอิงตามรีวิวของผู้ใช้เท่านั้น สรุปรีวิวจะให้ข้อมูลเชิงลึกระดับสูงและช่วยให้ผู้ใช้มีข้อมูลประกอบการตัดสินใจโดยการสังเคราะห์องค์ประกอบสำคัญของรีวิวจากผู้ใช้ เช่น แอตทริบิวต์ของสถานที่และความเห็นของผู้รีวิว

ตัวอย่างเช่น สรุปรีวิวของ Ferry Building ในซานฟรานซิสโกมีข้อมูลตั้งแต่อาหารและการช็อปปิ้งไปจนถึงวิวและบรรยากาศ ดังนี้

"ผู้เข้าชมกล่าวว่าสถานที่สำคัญทางประวัติศาสตร์แห่งนี้มีร้านค้า ร้านอาหาร และตลาดเกษตรกรให้เลือกมากมาย โดยหลายคนชื่นชมวิวอ่าวและวิวเมือง นอกจากนี้ยังเน้นย้ำถึงบรรยากาศที่มีชีวิตชีวา การเดินทางด้วยเรือข้ามฟากที่สะดวกสบายไปยังจุดหมายอื่นๆ และโอกาสในการเพลิดเพลินกับธุรกิจในท้องถิ่น"

สรุปรีวิวรองรับจุดที่น่าสนใจในภาษาและภูมิภาคต่อไปนี้

ภาษา ภูมิภาค
อังกฤษ อาร์เจนตินา โบลิเวีย บราซิล ชิลี โคลอมเบีย คอสตาริกา สาธารณรัฐโดมินิกัน เอกวาดอร์ กัวเตมาลา อินเดีย ญี่ปุ่น เม็กซิโก ปารากวัย เปรู สหราชอาณาจักร สหรัฐอเมริกา อุรุกวัย เวเนซุเอลา
ญี่ปุ่น ญี่ปุ่น
โปรตุเกส บราซิล
สเปน กัวเตมาลา คอสตาริกา โคลอมเบีย ชิลี โบลิเวีย ปารากวัย เปรู เม็กซิโก เวเนซุเอลา สหรัฐอเมริกา สาธารณรัฐโดมินิกัน อาร์เจนตินา อุรุกวัย เอกวาดอร์

ขอสรุปรีวิว

หากต้องการขอสรุปรีวิว ให้ใส่ช่อง reviewSummary เมื่อเรียกใช้ fetchFields() ดังนี้

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);
}
  

สรุปพื้นที่

ระบบจะสร้างข้อมูลสรุปเกี่ยวกับพื้นที่โดยรอบสถานที่ ข้อมูลสรุปเกี่ยวกับพื้นที่ให้บริบทเพิ่มเติมเกี่ยวกับสถานที่ รวมถึงจุดที่น่าสนใจในบริเวณใกล้เคียง เพื่อให้ผู้ใช้มีข้อมูลประกอบการตัดสินใจมากขึ้นเกี่ยวกับสถานที่ที่จะไปและสิ่งที่ต้องทำเมื่อไปถึง ตัวอย่างเช่น เมื่อไปเยือนเมืองใหม่ คุณสามารถดูข้อมูลสรุปเกี่ยวกับย่านใกล้เคียงที่สร้างขึ้นสำหรับโรงแรมเพื่อดูข้อมูลเพิ่มเติมเกี่ยวกับพื้นที่โดยรอบได้ ดังนี้

  • "ย่านที่มีชีวิตชีวาในซานฟรานซิสโกแห่งนี้ผสมผสานระหว่างนอร์ทบีชและไชน่าทาวน์ ตั้งอยู่ทางตะวันตกเฉียงเหนือของย่านการเงิน และมีสถานที่สำคัญทางวรรณกรรม สถานที่ท่องเที่ยวทางวัฒนธรรมที่ไม่เหมือนใคร และร้านอาหารที่หลากหลาย สถานที่ที่น่าสนใจ ได้แก่ ร้านหนังสือ City Lights อันโด่งดัง พิพิธภัณฑ์รถรางเคเบิลที่น่าตื่นตาตื่นใจ และถนนที่คึกคักของไชน่าทาวน์"

หากกำลังพิจารณาชาร์จรถยนต์ไฟฟ้า คุณสามารถดูข้อมูลสรุปที่สร้างขึ้นสำหรับสถานีชาร์จรถยนต์ไฟฟ้าเพื่อดูข้อมูลเพิ่มเติมเกี่ยวกับพื้นที่โดยรอบได้ ดังนี้

  • "ย่านนี้มีร้านอาหารให้เลือกมากมายในระยะเดิน 9 นาที เช่น Starbucks, Sushi Jin และ Safeway"

นอกจากคำอธิบายพื้นที่แล้ว การตอบกลับยังมีรายการอินสแตนซ์ Place สำหรับสถานที่ที่อ้างอิงในคำอธิบายด้วย โปรดเรียกใช้ fetchFields() ในอินสแตนซ์ Place เหล่านี้เพื่อขอรายละเอียดเพิ่มเติมสำหรับสถานที่แต่ละแห่ง

ข้อมูลสรุปเกี่ยวกับพื้นที่ที่ทำงานด้วยระบบ AI มี 2 ประเภท ได้แก่

  • ข้อมูลสรุปเกี่ยวกับย่านใกล้เคียง: ภาพรวมระดับสูงของจุดที่น่าสนใจในบริเวณใกล้เคียงสำหรับสถานที่ที่มีประเภท premise, street_address และทุกประเภทในหมวดหมู่ที่พักอาศัยและที่พัก

  • สรุปสิ่งอำนวยความสะดวกของสถานีชาร์จรถยนต์ไฟฟ้า: ภาพรวมระดับสูงของจุดที่น่าสนใจในบริเวณใกล้เคียงสำหรับสถานที่ที่มีประเภท electric_vehicle_charging_station

ระบบรองรับข้อมูลสรุปเกี่ยวกับพื้นที่สำหรับจุดที่น่าสนใจในภาษาและภูมิภาคต่อไปนี้

ภาษา ภูมิภาค
อังกฤษ สหรัฐอเมริกา

ขอข้อมูลสรุปเกี่ยวกับย่านใกล้เคียง

คุณสามารถขอข้อมูลสรุปเกี่ยวกับย่านใกล้เคียงสำหรับสถานที่ที่มีประเภท premise, street_address และทุกประเภทในหมวดหมู่ที่พักอาศัยและที่พัก หากต้องการขอข้อมูลสรุปเกี่ยวกับย่านใกล้เคียง ให้ใส่ช่อง neighborhoodSummary เมื่อเรียกใช้ fetchFields()

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 มีข้อมูลสรุป 4 ประเภท ได้แก่ overview, coffee, restaurant และ store ด้วยเหตุนี้ โครงสร้างข้อมูลจึงเป็นอาร์เรย์ของออบเจ็กต์ ซึ่งแต่ละออบเจ็กต์จะมีข้อมูลสรุป หากต้องการขอข้อมูลสรุปสิ่งอำนวยความสะดวกของสถานีชาร์จรถยนต์ไฟฟ้า ให้ใส่ช่อง evChargeAmenitySummary เมื่อเรียกใช้ fetchFields()

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);
}