Skip to content

Commit

Permalink
Merge pull request #96 from technologiestiftung/staging
Browse files Browse the repository at this point in the history
staging to prod
  • Loading branch information
Jaszkowic authored Nov 8, 2024
2 parents fd93532 + 81c2669 commit 5b27e55
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 253 deletions.
31 changes: 30 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,36 @@
"imageSize": 64,
"commit": true,
"commitConvention": "angular",
"contributors": [],
"contributors": [
{
"login": "Esshahn",
"name": "Ingo Hinterding",
"avatar_url": "https://avatars.githubusercontent.com/u/434355?v=4",
"profile": "http://www.awsm.de/",
"contributions": ["doc"]
},
{
"login": "raphael-arce",
"name": "Raphael.A",
"avatar_url": "https://avatars.githubusercontent.com/u/8709861?v=4",
"profile": "https://github.com/raphael-arce",
"contributions": ["doc"]
},
{
"login": "aeschi",
"name": "aeschi",
"avatar_url": "https://avatars.githubusercontent.com/u/56318362?v=4",
"profile": "https://github.com/aeschi",
"contributions": ["doc"]
},
{
"login": "Jaszkowic",
"name": "Jonas Jaszkowic",
"avatar_url": "https://avatars.githubusercontent.com/u/10830180?v=4",
"profile": "https://github.com/Jaszkowic",
"contributions": ["doc"]
}
],
"contributorsPerLine": 7,
"skipCi": true
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.15.1
20.18.0
96 changes: 53 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,71 @@

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

# {repo-template}
# _BärGPT - AI chat assistant_

## TODO (after you generated the repo)
BärGPT is a productive AI testing environment available for employees of the Berlin state administration, provided by CityLAB Berlin. BärGPT is designed to help test the practical applications of artificial intelligence for administrative work. In addition to a chat function, BärGPT includes a number of initial smaller applications (AI apps) for specific tasks in the administrative context. The list of applications will be continuously expanded in dialogue with employees of the Berlin administration. To support this, we will offer regular workshops in the future and welcome ideas and feedback.

- [ ] Review the content of the README.md and adjust to your liking
- [ ] Read the README.md till the end and adjust the content licensing,
logos, etc (I know you stopped at tbd...)
- [ ] Adjust the file [.github/CODEOWNERS](./.github/CODEOWNERS)
- [ ] Adjust the files under [.github/ISSUE_TEMPLATE](./.github/ISSUE_TEMPLATE)
- [ ] If you use staging and main branches use this template for [.github/renovate.json](./.github/renovate.json)
## Why did we develop BärGPT?

```json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>technologiestiftung/renovate-config"],
"baseBranches": ["staging"]
}
```
In the spring of 2024, the Berlin Senate Chancellery convened an "AI Taskforce" and organized a series of workshops at CityLAB Berlin to discuss the potential applications of artificial intelligence in administrative work. During these discussions, it became clear that there was a need to provide employees with a low-threshold testing environment, allowing them to experiment with initial ideas in a protected setting. In response, CityLAB offered to establish such a platform.

- [ ] Do you want to honor all kinds of contributions? Use [all-contributors](https://allcontributors.org/)
## What should I keep in mind regarding data protection and data security?

```bash
npx all-contributors-cli check
npx all-contributors-cli add ff6347 doc
```
BärGPT offers users a selection of different large language models, which vary in terms of data protection.

You can use it on GitHub just by commenting on PRs and issues:
- The model `azure-gpt-4o-mini` is operated by Microsoft in a data center in Sweden, and thus falls under GDPR regulations. Input data is neither stored nor used for training purposes. This model offers a higher level of data protection compared to similar offerings from the U.S.
- The model `openai-gpt-4o-mini` provides the same functionality but is operated by OpenAI in the United States. This model should only be used for comparison purposes, as it offers no advantages over the Microsoft model.
- The model `citylab-macstudio-llama-3.1` is hosted by CityLAB Berlin in compliance with data protection regulations. It is an open-source model, which in many cases can match the quality of commercial models.
It is important to note that none of the available AI models are operated within the Berlin state network. Therefore, personal or otherwise sensitive data, as well as data intended exclusively for use within the Berlin state network, must not be entered.

```plain
@all-contributors please add @ff6347 for infrastructure, tests and code
```
## Can BärGPT also be used for other use cases?

BärGPT is a flexible AI infrastructure and can, in principle, be adapted and further developed for various use cases and contexts. Do you have an idea for a specific use case where BärGPT could be helpful? If so, we would be happy to hear from you.

- [ ] Add your project description
- [ ] Get fancy shields at https://shields.io
n line with the principle of "Public Money - Public Code," CityLAB Berlin releases all prototypes, including BärGPT, under an Open Source license. This means that BärGPT can and should be used and further developed without restrictions or prior permission. However, we would appreciate feedback if BärGPT is being used and are happy to assist with the initial steps.

## Prerequisites

tbd...
- Node.js / npm (https://nodejs.org/en)
- For deployment: Vercel.com account (https://vercel.com/) or any other service of your choice

## Development setup

Prepare required env variables:

- Setup `.env` file by copying `.env.sample`
- Set `VITE_X_API_KEY` to the API key of the [BärGPT API](https://github.com/technologiestiftung/ber-gpt-backend)
- Set `VITE_API_URL` to the API endpoint of the [BärGPT API](https://github.com/technologiestiftung/ber-gpt-backend)

Prepare optional env variables to enable [Matomo](https://matomo.org/) tracking:

- `NEXT_PUBLIC_MATOMO_URL=...`
- `NEXT_PUBLIC_MATOMO_SITE_ID=..`

## Installation
Install dependencies:

tbd...
- `npm ci`

## Usage or Deployment
Run development server:

tbd...
- `npm run dev`

## Development
Open [http://localhost:5173](http://localhost:5173) with your browser to see the application running.

tbd...
## Deploy

You can deploy and run the BärGPT on the platform of your choice.
We use Vercel.com, you can follow their step-by-step guides to deploy your version of BärGPT.

## Tests

tbd...
```bash
npm t
```

## Contributing

Expand All @@ -73,8 +80,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
</tr>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/raphael-arce"><img src="https://avatars.githubusercontent.com/u/8709861?v=4?s=64" width="64px;" alt="Raphael.A"/><br /><sub><b>Raphael.A</b></sub></a><br /><a href="https://github.com/technologiestiftung/template-default/commits?author=raphael-arce" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/aeschi"><img src="https://avatars.githubusercontent.com/u/56318362?v=4?s=64" width="64px;" alt="aeschi"/><br /><sub><b>aeschi</b></sub></a><br /><a href="https://github.com/technologiestiftung/template-default/commits?author=aeschi" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Jaszkowic"><img src="https://avatars.githubusercontent.com/u/10830180?v=4?s=64" width="64px;" alt="Jonas Jaszkowic"/><br /><sub><b>Jonas Jaszkowic</b></sub></a><br /><a href="https://github.com/technologiestiftung/template-default/commits?author=Jaszkowic" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.awsm.de/"><img src="https://avatars.githubusercontent.com/u/434355?v=4?s=64" width="64px;" alt="Ingo Hinterding"/><br /><sub><b>Ingo Hinterding</b></sub></a><br /><a href="https://github.com/technologiestiftung/template-default/commits?author=Esshahn" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
Expand All @@ -84,12 +97,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

## Content Licensing

Texts and content available as [CC BY](https://creativecommons.org/licenses/by/3.0/de/).

Illustrations by {MARIA_MUSTERFRAU}, all rights reserved.

## Credits

<table>
Expand Down Expand Up @@ -119,3 +126,6 @@ Illustrations by {MARIA_MUSTERFRAU}, all rights reserved.
</table>

## Related Projects

- https://github.com/technologiestiftung/ber-gpt-backend
<!-- touch again -->
56 changes: 31 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
},
"dependencies": {
"date-fns": "3.6.0",
"js-tiktoken": "1.0.14",
"js-tiktoken": "1.0.15",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-markdown": "9.0.1",
"react-router-dom": "6.25.1",
"zustand": "4.5.4"
"react-router-dom": "6.26.2",
"zustand": "4.5.5"
},
"devDependencies": {
"@technologiestiftung/eslint-config": "0.2.0",
Expand Down
22 changes: 21 additions & 1 deletion src/components/buttons/copy-to-clipboard-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@ interface CopyToClipboardButtonProps {
generatedAnswer: string;
}

/**
* check if the text has indented sections - return original text if not
* otherwise only copy the indented sections
*/
const checkForIndentedText = (text: string) => {
if (!text.includes("> ")) {
return text;
}

const lines = text.split("\n");

const indentedLines = lines.filter((line) => line.startsWith("> "));
const cleanedIndentedLines = indentedLines.map((line) =>
line.replace("> ", "").replace(/\*\*/g, ""),
);

return cleanedIndentedLines.join("\n");
};

export const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps> = ({
generatedAnswer,
}) => {
const [isCopiedToClipboard, setIsCopiedToClipboard] = useState(false);

const copyToClipboard = async () => {
await navigator.clipboard.writeText(generatedAnswer);
const filteredText = checkForIndentedText(generatedAnswer);
await navigator.clipboard.writeText(filteredText);
setIsCopiedToClipboard(true);
};

Expand Down
Loading

0 comments on commit 5b27e55

Please sign in to comment.