Skip to content

Commit

Permalink
fix: empty assistant instruction by default (janhq#855)
Browse files Browse the repository at this point in the history
* fix: empty assistant instruction by default

* chore: there should be no error dialog for in-app update
  • Loading branch information
louis-jan authored Dec 5, 2023
1 parent 27b62ed commit 07fc1a9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
1 change: 0 additions & 1 deletion electron/handlers/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function handleAppUpdates() {

/* App Update Error */
autoUpdater.on("error", (info: any) => {
dialog.showMessageBox({ message: info.message });
WindowManager.instance.currentWindow?.webContents.send(
"APP_UPDATE_ERROR",
{}
Expand Down
2 changes: 1 addition & 1 deletion extensions/assistant-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default class JanAssistantExtension implements AssistantExtension {
name: "Jan",
description: "A default assistant that can use all downloaded models",
model: "*",
instructions: "Your name is Jan.",
instructions: "",
tools: undefined,
file_ids: [],
metadata: undefined,
Expand Down
2 changes: 2 additions & 0 deletions web/hooks/useSendChatMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function useSendChatMessage() {
const messages: ChatCompletionMessage[] = [
activeThread.assistants[0]?.instructions,
]
.filter((e) => e && e.trim() !== '')
.map<ChatCompletionMessage>((instructions) => {
const systemMessage: ChatCompletionMessage = {
role: ChatCompletionRole.System,
Expand Down Expand Up @@ -138,6 +139,7 @@ export default function useSendChatMessage() {
const messages: ChatCompletionMessage[] = [
activeThread.assistants[0]?.instructions,
]
.filter((e) => e && e.trim() !== '')
.map<ChatCompletionMessage>((instructions) => {
const systemMessage: ChatCompletionMessage = {
role: ChatCompletionRole.System,
Expand Down
17 changes: 10 additions & 7 deletions web/screens/Chat/MessageToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import { twMerge } from 'tailwind-merge'

import { toaster } from '@/containers/Toast'

import useSendChatMessage from '@/hooks/useSendChatMessage'

import { extensionManager } from '@/extension'
import {
deleteMessageAtom,
getCurrentChatMessagesAtom,
} from '@/helpers/atoms/ChatMessage.atom'
import { activeThreadAtom } from '@/helpers/atoms/Conversation.atom'
import useSendChatMessage from '@/hooks/useSendChatMessage'

const MessageToolbar = ({ message }: { message: ThreadMessage }) => {
const deleteMessage = useSetAtom(deleteMessageAtom)
Expand Down Expand Up @@ -82,12 +83,14 @@ const MessageToolbar = ({ message }: { message: ThreadMessage }) => {
>
<Copy size={14} />
</div>
<div
className="cursor-pointer px-2 py-2 hover:bg-background/80"
onClick={onDeleteClick}
>
<Trash2Icon size={14} />
</div>
{message.status === MessageStatus.Ready && (
<div
className="cursor-pointer px-2 py-2 hover:bg-background/80"
onClick={onDeleteClick}
>
<Trash2Icon size={14} />
</div>
)}
</div>
</div>
)
Expand Down

0 comments on commit 07fc1a9

Please sign in to comment.