chore: clean up

This commit is contained in:
Louis 2024-12-16 20:48:10 +07:00
parent 1de98873c1
commit 8cc24df902
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
8 changed files with 14 additions and 18 deletions

View File

@ -108,7 +108,7 @@ export const test = base.extend<
})
test.beforeAll(async () => {
await rmSync(path.join(__dirname, '../../test-data'), {
rmSync(path.join(__dirname, '../../test-data'), {
recursive: true,
force: true,
})
@ -122,5 +122,5 @@ test.beforeAll(async () => {
})
test.afterAll(async () => {
teardownElectron()
// teardownElectron()
})

View File

@ -2,11 +2,8 @@ import { expect } from '@playwright/test'
import { page, test, TIMEOUT } from '../config/fixtures'
test('renders left navigation panel', async () => {
const settingsBtn = await page
.getByTestId('Thread')
.first()
.isEnabled({ timeout: TIMEOUT })
expect([settingsBtn].filter((e) => !e).length).toBe(0)
const threadBtn = page.getByTestId('Thread').first()
await expect(threadBtn).toBeVisible({ timeout: TIMEOUT })
// Chat section should be there
await page.getByTestId('Local API Server').first().click({
timeout: TIMEOUT,

View File

@ -158,7 +158,7 @@ export const useCreateNewThread = () => {
//TODO: Why do we have thread list then thread states? Should combine them
try {
const createdThread = await persistNewThread(thread, assistantInfo)
if (!createdThread) throw 'Thread creation failed'
if (!createdThread) throw 'Thread created failed.'
createNewThread(createdThread)
setSelectedModel(defaultModel)

View File

@ -33,7 +33,7 @@ const nextConfig = {
ANALYTICS_ID: JSON.stringify(process.env.ANALYTICS_ID),
ANALYTICS_HOST: JSON.stringify(process.env.ANALYTICS_HOST),
API_BASE_URL: JSON.stringify(
process.env.API_BASE_URL ?? 'http://localhost:1337'
process.env.API_BASE_URL ?? 'http://127.0.0.1:39291'
),
isMac: process.platform === 'darwin',
isWindows: process.platform === 'win32',

View File

@ -55,7 +55,7 @@ const MessageToolbar = ({ message }: { message: ThreadMessage }) => {
.slice(-1)[0]
if (thread) {
// Should also delete error messages to clear out the error state
// TODO: Should also delete error messages to clear out the error state
await extensionManager
.get<ConversationalExtension>(ExtensionTypeEnum.Conversational)
?.deleteMessage(thread.id, message.id)

View File

@ -81,10 +81,7 @@ const ThreadLeftPanel = () => {
)
const selectedModel = model[0] || recommendedModel
requestCreateNewThread(
{
...assistants[0],
...activeAssistant,
},
{ ...assistants[0], ...activeAssistant },
selectedModel
)
} else if (threadDataReady && !activeThreadId) {

View File

@ -176,9 +176,7 @@ const ThreadRightPanel = () => {
const onValueChanged = useCallback(
(key: string, value: string | number | boolean | string[]) => {
if (!activeThread || !activeAssistant) {
return
}
if (!activeThread || !activeAssistant) return
setEngineParamsUpdate(true)
resetModel()

View File

@ -30,9 +30,13 @@ export const getFileInfoFromFile = async (
return result
}
/**
* This function creates an Uppy instance with XHR plugin for file upload to the server.
* @returns Uppy instance
*/
export const uploader = () => {
const uppy = new Uppy().use(XHR, {
endpoint: 'http://127.0.0.1:39291/v1/files',
endpoint: `${API_BASE_URL}/v1/files`,
method: 'POST',
fieldName: 'file',
formData: true,