Skip to content

Commit

Permalink
fix: enable use tools + display bearer token (#549)
Browse files Browse the repository at this point in the history
* fix: enable use tools

* feat: display bearer token
  • Loading branch information
paulclindo authored Dec 3, 2024
1 parent dd9c89e commit 2dcda5c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ function ConversationEmptyFooter() {
chatForm.setValue('message', promptSelected?.prompt ?? '');
}, [chatForm, promptSelected]);

useEffect(() => {
chatConfigForm.setValue(
'useTools',
promptSelected?.useTools ? true : DEFAULT_CHAT_CONFIG.use_tools,
);
}, [chatConfigForm, chatForm, promptSelected]);

const onSubmit = async (data: CreateJobFormSchema) => {
if (!auth || data.message.trim() === '') return;
const selectedVRFiles =
Expand Down
2 changes: 2 additions & 0 deletions apps/shinkai-desktop/src/pages/chat/empty-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const EmptyMessage = () => {
temperature: DEFAULT_CHAT_CONFIG.temperature,
top_p: DEFAULT_CHAT_CONFIG.top_p,
top_k: DEFAULT_CHAT_CONFIG.top_k,
use_tools: DEFAULT_CHAT_CONFIG.use_tools,
},
});
};
Expand Down Expand Up @@ -130,6 +131,7 @@ const EmptyMessage = () => {
is_favorite: false,
is_system: true,
version: '1',
useTools: true,
});
const element = document.querySelector(
'#chat-input',
Expand Down
27 changes: 27 additions & 0 deletions apps/shinkai-desktop/src/pages/public-keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const PublicKeys = () => {
profile_identity_pk: auth?.profile_identity_pk,
my_device_encryption_pk: auth?.my_device_encryption_pk,
my_device_identity_pk: auth?.my_device_identity_pk,
api_v2_key: auth?.api_v2_key,
},
});

Expand Down Expand Up @@ -184,6 +185,32 @@ export const PublicKeys = () => {
</div>
</div>
</div>
<div>
<h2 className="text-gray-80 mb-2 text-sm">API Bearer Token</h2>
<div className="space-y-3">
<FormField
control={form.control}
name="api_v2_key"
render={({ field }) => (
<TextField
classes={{
input: 'font-mono',
}}
endAdornment={
<div className="w-8">
<CopyToClipboardIcon
className="peer/adornment adornment absolute right-1 top-4 rounded-md border border-gray-200 bg-gray-300 px-2"
string={field.value}
/>
</div>
}
field={{ ...field, readOnly: true }}
label={'Bearer Token'}
/>
)}
/>
</div>
</div>
</form>
</Form>
</div>
Expand Down
1 change: 1 addition & 0 deletions libs/shinkai-message-ts/src/api/tools/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export type Prompt = {
version: string;
is_favorite: boolean;
embedding?: string;
useTools?: boolean;
};
export type GetAllPromptsResponse = Prompt[];
export type SearchPromptsResponse = Prompt[];
Expand Down
1 change: 1 addition & 0 deletions libs/shinkai-node-state/src/forms/settings/public-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const publicKeysSchema = z.object({
profile_identity_pk: z.string().optional(),
my_device_encryption_pk: z.string().optional(),
my_device_identity_pk: z.string().optional(),
api_v2_key: z.string().optional(),
});

export type PublicKeysFormSchema = z.infer<typeof publicKeysSchema>;

0 comments on commit 2dcda5c

Please sign in to comment.