Skip to content

Commit

Permalink
MAJOR REFACTOR (mckaywrigley#494)
Browse files Browse the repository at this point in the history
* move index to home folder, create state and context files and barrell folder

* Sanity Check Commit:  reducer added to home.tsx manual QA all working

* WIP: promptBar

* fix missing json parse on folders and prompts

* split context and add promptbar context

* add context to nested prompt componets and componetize Folder componet

* remove log

* Create buttons folder and componetize sidebar action button

* tidy up prompt handlers

* componetized sidebar

* added back chatbar componet to left side sidebar

* monster commit: Componetized the common code between chatbar and promptbar into new componet Sidebar and added context to both bars

* add useFetch service

* added prettier import sort to keep imports ordered and easier to indentify

* added react query and useFetch to work with RQ

* added apiService, errorService and reactQuery

* add callback and tidy up error service

* refactor chat and child componets to useContext

* fix extra calls and bad calls to mel endpoint

* minor import cleanup

---------

Co-authored-by: jc.durbin <[email protected]>
  • Loading branch information
mckaywrigley and foolishsailor authored Apr 11, 2023
1 parent 68c9cd4 commit 6500db9
Show file tree
Hide file tree
Showing 128 changed files with 3,665 additions and 3,052 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ name: Docker

on:
push:
branches: [ "main" ]
branches: ['main']

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
image: node:16

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: npm ci
- name: Install dependencies
run: npm ci

- name: Run Vitest Suite
run: npm test
- name: Run Vitest Suite
run: npm test
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Contributing Guidelines

**Welcome to Chatbot UI!**

We appreciate your interest in contributing to our project.

Before you get started, please read our guidelines for contributing.

## Types of Contributions

We welcome the following types of contributions:

- Bug fixes
Expand All @@ -15,8 +17,8 @@ We welcome the following types of contributions:
- Translations
- Tests


## Getting Started

To get started, fork the project on GitHub and clone it locally on your machine. Then, create a new branch to work on your changes.

```
Expand All @@ -29,6 +31,7 @@ git checkout -b my-branch-name
Before submitting your pull request, please make sure your changes pass our automated tests and adhere to our code style guidelines.

## Pull Request Process

1. Fork the project on GitHub.
2. Clone your forked repository locally on your machine.
3. Create a new branch from the main branch.
Expand All @@ -38,4 +41,5 @@ Before submitting your pull request, please make sure your changes pass our auto
7. Submit a pull request to the main branch of the main repository.

## Contact
If you have any questions or need help getting started, feel free to reach out to me on [Twitter](https://twitter.com/mckaywrigley).

If you have any questions or need help getting started, feel free to reach out to me on [Twitter](https://twitter.com/mckaywrigley).
15 changes: 7 additions & 8 deletions __tests__/utils/app/importExports.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { ExportFormatV1, ExportFormatV2, ExportFormatV4 } from '@/types/export';
import { OpenAIModels, OpenAIModelID } from '@/types/openai';
import { DEFAULT_SYSTEM_PROMPT } from '@/utils/app/const';
import { it, describe, expect } from 'vitest';

import {
cleanData,
isExportFormatV1,
Expand All @@ -12,6 +8,11 @@ import {
isLatestExportFormat,
} from '@/utils/app/importExport';

import { ExportFormatV1, ExportFormatV2, ExportFormatV4 } from '@/types/export';
import { OpenAIModelID, OpenAIModels } from '@/types/openai';

import { describe, expect, it } from 'vitest';

describe('Export Format Functions', () => {
describe('isExportFormatV1', () => {
it('should return true for v1 format', () => {
Expand Down Expand Up @@ -105,7 +106,7 @@ describe('cleanData Functions', () => {
},
],
folders: [],
prompts:[]
prompts: [],
});
});
});
Expand Down Expand Up @@ -212,7 +213,7 @@ describe('cleanData Functions', () => {
},
],
} as ExportFormatV4;

const obj = cleanData(data);
expect(isLatestExportFormat(obj)).toBe(true);
expect(obj).toEqual({
Expand Down Expand Up @@ -253,9 +254,7 @@ describe('cleanData Functions', () => {
folderId: null,
},
],

});
});
});

});
17 changes: 17 additions & 0 deletions components/Buttons/SidebarActionButton/SidebarActionButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MouseEventHandler, ReactElement } from 'react';

interface Props {
handleClick: MouseEventHandler<HTMLButtonElement>;
children: ReactElement;
}

const SidebarActionButton = ({ handleClick, children }: Props) => (
<button
className="min-w-[20px] p-1 text-neutral-400 hover:text-neutral-100"
onClick={handleClick}
>
{children}
</button>
);

export default SidebarActionButton;
1 change: 1 addition & 0 deletions components/Buttons/SidebarActionButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './SidebarActionButton';
Loading

0 comments on commit 6500db9

Please sign in to comment.