Skip to content

Commit

Permalink
Merge pull request #163 from Azure-Samples/gk/prompt-engineering-note…
Browse files Browse the repository at this point in the history
…book
  • Loading branch information
thegovind committed Oct 30, 2023
2 parents f4e2897 + 516881b commit 24a8c69
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
Binary file modified assets/images/copilot-stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions ui/typescript/src/components/chat/chat-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,39 @@ import {ChatProps} from "@/types";

export default function ChatMessage({ chat }: { chat: ChatProps }) {
const {
userName,
authorRole,
content
} = chat ?? {};

return (
<div className="chat-content">
<div className={cn('flex items-end ', {
'justify-end':
userName !== Chats[0].userName,
authorRole !== Chats[0].authorRole,
})}>
<div className={cn('flex flex-col space-y-2 text-xs max-w-xs mx-2 order-2 ', {
'items-end':
userName !== Chats[0].userName,
authorRole !== Chats[0].authorRole,
'items-start':
userName == Chats[0].userName,
authorRole === Chats[0].authorRole,
})}>
<div><span
className={cn('px-4 py-2 rounded-lg inline-block ', {
'rounded-br-none bg-blue-600 text-white':
userName !== Chats[0].userName,
authorRole !== Chats[0].authorRole,
'rounded-bl-none bg-gray-300 text-gray-600':
userName == Chats[0].userName,
authorRole === Chats[0].authorRole,
})}>{content}</span>
</div>
</div>
<Image
width={10} height={10}
src={(userName == Chats[0].userName) ? miyagilogo : usericon}
src={(authorRole == Chats[0].authorRole) ? miyagilogo : usericon}
alt="Actor" className={cn('w-6 h-6 rounded-full ', {
'order-2':
userName !== Chats[0].userName,
authorRole !== Chats[0].authorRole,
'order-1':
userName == Chats[0].userName,
authorRole === Chats[0].authorRole,
})} />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/typescript/src/data/static/chats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export const Chats = [
userId: 'bot',
userName: 'bot',
chatId: '',
messageType: "1"
authorRole: 1
}
]
2 changes: 1 addition & 1 deletion ui/typescript/src/data/static/user-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const UserInfo = {
"firstName": "Govind",
"lastName": "Kamtamneni",
"age": 50,
"messageType": "0",
"authorRole": 0,
"riskLevel": "aggressive",
"annualHouseholdIncome": 80000,
"favoriteBook": "intelligent-investor",
Expand Down
6 changes: 3 additions & 3 deletions ui/typescript/src/layouts/sidebar/chat-blade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function Sidebar({ className, setSelectedSession, setUserInfoAtom
userId: userInfo.userId,
userName: userInfo.userName,
chatId: userInfo.chatId,
messageType: "0",
authorRole: 0,
};

// Update chatsAtom with the user's message first
Expand All @@ -89,7 +89,7 @@ export default function Sidebar({ className, setSelectedSession, setUserInfoAtom
body: JSON.stringify({
input: userInput,
variables: [
{ key: 'messageType', value: userInfo.messageType },
{ key: 'messageType', value: userInfo.authorRole.toString() },
{ key: 'chatId', value: userInfo.chatId },
],
}),
Expand All @@ -111,7 +111,7 @@ export default function Sidebar({ className, setSelectedSession, setUserInfoAtom
userId: "bot",
userName: "bot",
chatId: userInfo.chatId,
messageType: "1",
authorRole: 1,
},
];
});
Expand Down
2 changes: 1 addition & 1 deletion ui/typescript/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ReactElement, ReactNode } from 'react';

export type ChatProps = {
id: string;
messageType: string;
authorRole: number;
content: string;
timestamp: string;
userId: string;
Expand Down

0 comments on commit 24a8c69

Please sign in to comment.