From 30dd46d4dd4f8f0c5891fb2aa7fee42755e0d4a9 Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Wed, 6 Dec 2023 16:36:14 -0300 Subject: [PATCH] chore: update readme --- README.md | 186 ++++++++---------------------------------------------- 1 file changed, 27 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index 650eadc..28a0b48 100644 --- a/README.md +++ b/README.md @@ -1,176 +1,44 @@ -# Dash Ai Search +# Ask Dash Flutter Demo -![coverage][coverage_badge] -[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link] -[![License: MIT][license_badge]][license_link] +## Overview -Generated by the [Very Good CLI][very_good_cli_link] πŸ€– +To set up the LLM Search backend for the demo, you'll need the following: +- A Datastore with the website you want to index +- An App to access that data +- A Cloud Function to act as an API wrapper -A Very Good Project created by Very Good CLI. +## Create a Datastore ---- +1. Go to the Google Cloud Console and search for "Search And Conversation" +2. On the left, select Data Stores and then New Data Store +3. For source select Website URL and enter you site info +4. Enter a name for your Datastore to finalize -## Getting Started πŸš€ +Note that it might take up to 4 hours to fully index your website. -This project contains 3 flavors: +## Create an App to access your Datastore -- development -- staging -- production +1. Still in the Search And Conversation section, select Apps and New App +2. For type select Search and enter a name for your app and company +3. For data select the Datastore that you created already -To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands: +Once your website has been indexed you should be able to search it directly from the Console. Select your App from the list of Apps and enter a question to try it out. -```sh -# Development -$ flutter run --flavor development --target lib/main_development.dart +If the data is ready to be searched you should see a natural language answer along with a list of citations from your own website. If you get a generic negative response like "I don't know what you mean" make sure that your site has been fully indexed and it's a question which is answered somewhere on it. -# Staging -$ flutter run --flavor staging --target lib/main_staging.dart +## Build a Cloud Function API wrapper -# Production -$ flutter run --flavor production --target lib/main_production.dart -``` - -_\*Dash Ai Search works on iOS, Android, Web, and Windows._ - ---- - -## Running Tests πŸ§ͺ - -To run all unit and widget tests use the following command: - -```sh -$ flutter test --coverage --test-randomize-ordering-seed random -``` - -To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov). - -```sh -# Generate Coverage Report -$ genhtml coverage/lcov.info -o coverage/ - -# Open Coverage Report -$ open coverage/index.html -``` - ---- - -## Working with Translations 🌐 - -This project relies on [flutter_localizations][flutter_localizations_link] and follows the [official internationalization guide for Flutter][internationalization_link]. +1. In the Cloud Console search Cloud Functions +2. Select Create Function and enter a name +3. Python 3.11 as the runtime and paste the **insert link to function code here** into the source text editor -### Adding Strings - -1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb`. - -```arb -{ - "@@locale": "en", - "counterAppBarTitle": "Counter", - "@counterAppBarTitle": { - "description": "Text shown in the AppBar of the Counter Page" - } -} -``` - -2. Then add a new key/value and description - -```arb +Your Search backend is now ready to go! To validate it's working correctly, on the Function page select Testing and enter a JSON object with format: +```JSON { - "@@locale": "en", - "counterAppBarTitle": "Counter", - "@counterAppBarTitle": { - "description": "Text shown in the AppBar of the Counter Page" - }, - "helloWorld": "Hello World", - "@helloWorld": { - "description": "Hello World Text" - } + "search_term": "{your question here}" } ``` -3. Use the new string - -```dart -import 'package:dash_ai_search/l10n/l10n.dart'; - -@override -Widget build(BuildContext context) { - final l10n = context.l10n; - return Text(l10n.helloWorld); -} -``` - -### Adding Supported Locales - -Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info.plist` to include the new locale. - -```xml - ... - - CFBundleLocalizations - - en - es - - - ... -``` - -### Adding Translations - -1. For each supported locale, add a new ARB file in `lib/l10n/arb`. - -``` -β”œβ”€β”€ l10n -β”‚ β”œβ”€β”€ arb -β”‚ β”‚ β”œβ”€β”€ app_en.arb -β”‚ β”‚ └── app_es.arb -``` - -2. Add the translated strings to each `.arb` file: - -`app_en.arb` - -```arb -{ - "@@locale": "en", - "counterAppBarTitle": "Counter", - "@counterAppBarTitle": { - "description": "Text shown in the AppBar of the Counter Page" - } -} -``` - -`app_es.arb` - -```arb -{ - "@@locale": "es", - "counterAppBarTitle": "Contador", - "@counterAppBarTitle": { - "description": "Texto mostrado en la AppBar de la pΓ‘gina del contador" - } -} -``` - -### Generating Translations - -To use the latest translations changes, you will need to generate them: - -1. Generate localizations for the current project: - -```sh -flutter gen-l10n --arb-dir="lib/l10n/arb" -``` - -Alternatively, run `flutter run` and code generation will take place automatically. +If everything is set up correctly you'll see the response in the Output box, which includes a natural language summary, citations, and short summaries of all the pages it references. If there are any problems check the logs on the same page to troubleshoot. -[coverage_badge]: coverage_badge.svg -[flutter_localizations_link]: https://api.flutter.dev/flutter/flutter_localizations/flutter_localizations-library.html -[internationalization_link]: https://flutter.dev/docs/development/accessibility-and-localization/internationalization -[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg -[license_link]: https://opensource.org/licenses/MIT -[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg -[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis -[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli +To control access to your API you can set up authentication using Cloud IAM, but that is beyond the scope of this tutorial.