Skip to content

Commit

Permalink
Merge pull request #2 from vectara/added-env-for-config
Browse files Browse the repository at this point in the history
moved the config to .env
  • Loading branch information
adeelehsan authored Jul 8, 2024
2 parents 0a1e509 + b1b3d07 commit 2b94b08
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .evn.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
REACT_APP_CORPUS_ID=<Vectara corpus ID>
REACT_APP_CUSTOMER_ID=<Vectara customer ID>
REACT_APP_APP_TITLE=<App title e.g. Search Hackernews >
REACT_APP_API_KEY=<Vectara API KEY>
REACT_APP_ENDPOINT=api.vectara.io
REACT_APP_QUESTION=<Question , separated e.g What is Gemini-Flash?,When will GPT-5 be released?>
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE /config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://discuss.vectara.com/
about: Ask questions and interact with the community here!
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE /issue-form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 🐞 Search Hackernews Bug
description: File a bug about Search Hackernews
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please complete the following form to help us assist you.
- type: textarea
id: what-happened
attributes:
label: Bug Description
description: What happened?
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: What version of search hackernews are you using?
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: Which steps should someone take to run into the same error?
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant Logs/Tracbacks
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE /new-feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 💡 New feature request
description: Something is missing in the search hackernews
labels: ["new-feat-idea"]
body:
- type: textarea
attributes:
label: Idea
description: What do you think should be in search hackernews.
validations:
required: true
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,5 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
<<<<<<< HEAD
=======

>>>>>>> 5ee796f (Initial commit)
.idea/
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Contributing to Search Hackernews

Thank you for your interest in Search Hackernews and considering contributing to our project!
Whether it's a bugfix or anything else - we truly appreciate your time and effort.

This document provides guidelines and best practices to help you contribute effectively.

## Getting started

1. Fork the repository and clone your fork.
2. Create a new branch for your changes (e.g. `bug-fix-1234`)
3. Make your changes in the new branch and test.
4. Commit and push your changes to your fork. Add useful comments to describe your changes.
5. Create a pull request following the guidelines in the [Submitting Pull Requests](#submitting-pull-requests) section.

## Contributing

### Reporting bugs

If you find a bug in the project, please create an issue on GitHub with the following information:

- A clear, descriptive title for the issue.
- A description of the problem, including steps to reproduce the issue.
- Any relevant logs, screenshots, or other supporting information.

### Suggesting enhancements

If you have an idea for a new feature or improvement, please create an issue on GitHub with the following information:

- A clear, descriptive title for the issue.
- A detailed description of the proposed enhancement, including any benefits and potential drawbacks.
- Any relevant examples, mockups, or supporting information.

### Submitting pull requests

When submitting a pull request, please ensure that your changes meet the following criteria:

- Your pull request should be atomic and focus on a single change.
- You should have thoroughly tested your changes with multiple different scenarios.
- You should have considered potential risks and mitigations for your changes.
- You should have documented your changes clearly and comprehensively.
- Please do not include any unrelated or "extra" small tweaks or changes.
59 changes: 36 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,15 @@ npm install

## Configuration

The app expects to find a `configuration.ts` file in the `/src` directory with this minimal configuration:
Rename `.env.example` to `.env` or create a new `.env` and replace the configurations.

```ts
import { Config } from "./contexts/ConfigurationContext";

export const configuration: Config = {
customerId: "<your customer ID here>",
corpusId: "<your corpus ID here>",
apiKey: "<your API key here>",
endpoint: "api.vectara.io"
};
```

Sample questions are configued like this:

```ts
export const configuration: Config = {
// ... other configs here
questions: [
"what was announced in GTC 2024?",
"bash power user",
"Open source LLM",
"What is a vector database?"
]
};
REACT_APP_CORPUS_ID=<Vectara corpus ID>
REACT_APP_CUSTOMER_ID=<Vectara customer ID>
REACT_APP_APP_TITLE=<App title - e.g Search Hackernews >
REACT_APP_API_KEY=<Vectara API KEY>
REACT_APP_ENDPOINT=api.vectara.io
REACT_APP_QUESTION=<Questions , separated - e.g What is Gemini-Flash?,When will GPT-5 be released?>
```

## Running locally
Expand All @@ -51,6 +35,12 @@ npm run start

If you make changes to the source code, the app will automatically reload with your changes.

## Running it with Docker
To run it wit docker execute the following command.
```
bash ./docker/run.sh
```

## Codebase

### Front-end
Expand Down Expand Up @@ -101,3 +91,26 @@ type Configuration = {
appTitle?: string;
};
```
# Author

👤 **Vectara**

- Website: https://vectara.com
- Twitter: [@vectara](https://twitter.com/vectara)
- GitHub: [@vectara](https://github.com/vectara)
- LinkedIn: [@vectara](https://www.linkedin.com/company/vectara/)
- Discord: [@vectara](https://discord.gg/GFb8gMz6UH)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br/>
Feel free to check [issues page](https://github.com/vectara/search-hackernews/issues). You can also take a look at the [contributing guide](https://github.com/vectara/vectara-answer/blob/master/CONTRIBUTING.md).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2024 [Vectara](https://github.com/vectara).<br />
This project is [Apache 2.0](https://github.com/vectara/search-hackernews/blob/main/LICENSE) licensed.
9 changes: 9 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security Policy

The Vectara trust and security center, including our security policy, can be found at
[https://vectara.com/legal/security-at-vectara/](https://vectara.com/legal/security-at-vectara/).


## Reporting a Vulnerability

Please send security vulnerability reports to security@vectara.com.
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ COPY ../public ./public
COPY ../src ./src
COPY ../tsconfig.json ./
COPY ../.eslintrc.js ./
COPY .env .env
RUN npm run build
RUN rm -r node_modules
COPY docker/package.json docker/package-lock.json ./
Expand Down
15 changes: 6 additions & 9 deletions src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { Config } from "./contexts/ConfigurationContext";

export const configuration: Config = {
corpusId: "265",
customerId: "1526022105",
appTitle: "Search HackerNews",
apiKey: "zqt_WvU_2YIBRMve7vmQP3h70deqDOgYM0W5VpYeXQ",
endpoint: "api.vectara.io",
questions: [
"What is Gemini-Flash?", "When will GPT-5 be released?",
"What is Llama3?", "can I win the Arc-AGI competition?"
]
corpusId: process.env.REACT_APP_CORPUS_ID,
customerId: process.env.REACT_APP_CUSTOMER_ID,
appTitle: process.env.REACT_APP_APP_TITLE,
apiKey: process.env.REACT_APP_API_KEY,
endpoint: process.env.REACT_APP_ENDPOINT,
questions: process.env.REACT_APP_QUESTION?.split(',') || []
};
12 changes: 6 additions & 6 deletions src/contexts/ConfigurationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { configuration } from "../configuration";

export interface Config {
// Search
endpoint: string;
corpusId: string;
customerId: string;
apiKey: string;
endpoint: string | undefined;
corpusId: string | undefined;
customerId: string | undefined;
apiKey: string | undefined;

// App
appTitle?: string;
appTitle?: string | undefined;

// Questions
questions?: string[];
questions?: string[] | [];
}

type Search = {
Expand Down

0 comments on commit 2b94b08

Please sign in to comment.