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

feat: add neurosearch component on the search page #277

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8798ead
feat: add component for generative search answer
WerySkok Aug 3, 2024
00abd9c
feat(SearchPage): move genanswer component under title in blocks
WerySkok Aug 3, 2024
c83bd74
feat: add mocks for searchPage storybook
Uyama0 Aug 3, 2024
186a999
feat(demo): add mocks
Uyama0 Aug 3, 2024
4e60381
feat(generative-search): add carcas to component and initial styling
WerySkok Aug 3, 2024
317ee16
feat(generative search): add carousel
Uyama0 Aug 3, 2024
5ae8d32
revert: remove i18n attempts for now
WerySkok Aug 4, 2024
cca8484
feat(package.json): add markdown-it as dependency
WerySkok Aug 4, 2024
41b7d10
feat(mardkown): add markdown parser
Uyama0 Aug 4, 2024
9dda5fe
Merge branch 'neurosearch' of github.com:diplodoc-platform/components…
Uyama0 Aug 6, 2024
9710933
chore(mocks): changed mock value name
Uyama0 Aug 7, 2024
f8290ef
Merge branch 'master' into neurosearch
Uyama0 Aug 10, 2024
55914bc
feat: add generative search different reactions
Uyama0 Aug 10, 2024
86999b4
fix(generative search): props drilling
Uyama0 Aug 11, 2024
73f2765
feat (chatbot): add components of chatbot
Uyama0 Aug 11, 2024
05a9098
chore(chatbot): remove unnecessary component ChatBot
Uyama0 Aug 12, 2024
1f02a65
feat(carousel): add carousel
Uyama0 Aug 14, 2024
a3b6ec0
chore(misc): minor updates to various components
Uyama0 Aug 14, 2024
bc6ca71
fix(generative-search): add missing return
WerySkok Aug 14, 2024
72a8b67
feat(generative search): add event handlers for some events
WerySkok Aug 14, 2024
4d32a6b
feat(SearchSuggest): add generativeSuggestOnClick handler for monitoring
WerySkok Aug 14, 2024
bfd2adc
feat(demo): add storybook examples for monitoring
WerySkok Aug 14, 2024
f80d4d5
feat(dark theme): add dark theme capability
Uyama0 Aug 15, 2024
5893332
fix(card cources): fix card min card width
Uyama0 Aug 15, 2024
618ee42
feat(card sources): add target="_blank" to source links
WerySkok Aug 15, 2024
a8bcdce
fix(ui): update various UI elements
Uyama0 Aug 15, 2024
e827c23
Merge branch 'neurosearch' of github.com:diplodoc-platform/components…
Uyama0 Aug 15, 2024
0b18de2
fix(mocks): revert data mocks
Uyama0 Aug 15, 2024
a4e8746
fix(ui): update various UI elements
Uyama0 Aug 16, 2024
cc1d404
Merge branch 'master' into neurosearch
WerySkok Aug 16, 2024
f5b7cab
chore(package.json): remove markdown-it from deps and regenerate lock…
WerySkok Aug 16, 2024
0e2aceb
fix: fix linter warnings
WerySkok Aug 16, 2024
dc99a79
fix: return package-locks from master
WerySkok Aug 16, 2024
f78b9b2
fix: expand button put to the bottom
WerySkok Aug 20, 2024
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
29 changes: 29 additions & 0 deletions demo/src/Components/SearchPage/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
/* eslint-disable no-console */

import React, {useState} from 'react';
import {ISearchItem, SearchPage} from '@diplodoc/components';

import mockData from './data';
import generativeSearchData from './searchData';

// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any
const log = (...message: any[]) => console.log(...message);

type Args = {
Mobile: string;
GenerativeSearchLoading: boolean;
GenerativeSearchError: boolean;
};

const SearchPageDemo = (args: Args) => {
const isMobile = args['Mobile'];
const generativeSearchLoading = args['GenerativeSearchLoading'];
const generativeSearchError = args['GenerativeSearchError'];

const [page, setPage] = useState(1);
const [items, setItems] = useState(getItems(page, mockData));

Expand All @@ -35,6 +43,21 @@ const SearchPageDemo = (args: Args) => {
relevantOnClick={(item) => log('Click on like button', item)}
itemsPerPage={2}
totalItems={mockData.length}
generativeSearchData={generativeSearchData}
generativeSearchLoading={generativeSearchLoading}
generativeSearchError={generativeSearchError}
generativeExpandOnClick={(answer) =>
console.log('Click on generative answer expand', answer)
}
generativeSourceOnClick={(link) =>
console.log('Click on generative answer source', link)
}
generativeIrrelevantOnClick={(answer) =>
console.log('Click on generative answer dislike button', answer)
}
generativeRelevantOnClick={(answer) =>
console.log('Click on generative answer like button', answer)
}
/>
</div>
);
Expand All @@ -47,6 +70,12 @@ export default {
Mobile: {
control: 'boolean',
},
GenerativeSearchLoading: {
control: 'boolean',
},
GenerativeSearchError: {
control: 'boolean',
},
},
};

Expand Down
26 changes: 26 additions & 0 deletions demo/src/Components/SearchPage/searchData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default {
message: {
content:
'<p>Чтобы работать с YFM, можно следовать таким рекомендациям:</p><ul><li><p><strong>Создайте проект</strong>. <a href="https://diplodoc.com/docs/ru/quickstart">1</a> Он состоит из нескольких конфигурационных файлов и страниц с контентом. <a href="https://diplodoc.com/docs/ru/quickstart">1</a></p></li><li><p><strong>Запустите сборку проекта</strong>. <a href="https://diplodoc.com/docs/ru/quickstart">1</a><a href="https://diplodoc.com/docs/ru/tools/docs/build">3</a> Для этого используйте инструмент Builder в командной строке. <a href="https://diplodoc.com/docs/ru/quickstart">1</a> Укажите обязательные ключи запуска: <strong>input (–i) — путь до директории проекта, output (–o) — путь до директории для выходных данных (статических HTML)</strong>. <a href="https://diplodoc.com/docs/ru/quickstart">1</a><a href="https://diplodoc.com/docs/ru/tools/docs/build">3</a> Пример команды: <code>yfm -i ./input-folder -o ./ouput-folder</code>. <a href="https://diplodoc.com/docs/ru/quickstart">1</a></p></li><li><p><strong>Настройте сборку в YFM</strong>. <a href="https://diplodoc.com/docs/ru/tools/docs/build">3</a> Для этого при выполнении команды yfm укажите ключ запуска <strong>--output-format=md</strong>. <a href="https://diplodoc.com/docs/ru/tools/docs/build">3</a> Сборка в YFM позволяет использовать вставки и условия видимости разделов, условия отображения контента и подстановки переменных. <a href="https://diplodoc.com/docs/ru/tools/docs/build">3</a></p></li><li><p><strong>Используйте готовый проект</strong>. <a href="https://diplodoc.com/docs/ru/quickstart">1</a> Проекты в формате HTML можно использовать локально или разместить на хостинге, в GitHub Pages или S3. <a href="https://diplodoc.com/docs/ru/quickstart">1</a><a href="https://diplodoc.com/docs/ru/index-yfm">4</a></p></li></ul>',
role: 'assistant',
},
links: [
'https://diplodoc.com/docs/ru/quickstart',
'https://diplodoc.com/docs/ru/syntax/base',
'https://diplodoc.com/docs/ru/tools/docs/build',
'https://diplodoc.com/docs/ru/index-yfm',
'https://diplodoc.com/docs/en/how-it-work',
],
titles: [
'Быстрый старт | Diplodoc',
'Базовая разметка | Diplodoc',
'Сборка | Diplodoc',
'Yandex Flavored Markdown | Diplodoc',
'Main scenarios for Diplodoc usage | Diplodoc',
],
final_search_query: 'как работать с yfm',
is_answer_rejected: false,
is_bullet_answer: false,
search_reqid: '1722674507173832-17567698128095587952-ngp6et3xflkdijxp-BAL',
reqid: '1722674506477130-4942193876903362238-balancer-l7leveler-kubr-yp-sas-214-BAL',
};
4 changes: 4 additions & 0 deletions demo/src/Components/SearchSuggest/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import type {FC, PropsWithChildren} from 'react';
import type {SearchProvider, SearchResult} from '@diplodoc/components';

Expand Down Expand Up @@ -57,6 +58,9 @@ const SearchSuggestDemo = () => {
provider={provider}
onFocus={() => setSearch(true)}
onBlur={() => setSearch(false)}
generativeSuggestOnClick={(link) =>
console.log(`Clicked on generative search banner going to ${link}`)
}
/>
</FakeHeader>
);
Expand Down
Loading
Loading