Skip to content

Commit

Permalink
fix: empty assistant instruction by default
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Dec 5, 2023
1 parent 27b62ed commit 6ab908f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
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 6ab908f

Please sign in to comment.