Skip to content

Commit

Permalink
added support for functions (Helicone#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
chitalian authored Jun 22, 2023
1 parent ac106e0 commit d306608
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/components/shared/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const capitalizeWords = (str: string) => {
return capitalizedWords.join(" ");
};

function removeLeadingWhitespace(str: string): string {
function removeLeadingWhitespace(str: string | null): string {
if (!str) return "";
return str.replace(/^\s+/, ""); // Replace one or more whitespace characters at the beginning of the string with an empty string
}

Expand Down
2 changes: 1 addition & 1 deletion web/components/templates/requests/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export const Chat = (props: ChatProps) => {
const completionRequestMessages: ChatCompletionRequestMessage[] =
heliconeMessagesInput.slice(0, index + 1).map((message: Message) => {
const formattedPrompt = formatPrompt2({
prompt: message.content,
prompt: message.content ?? "",
values: props.keys,
});
const content = formattedPrompt.data;
Expand Down
2 changes: 1 addition & 1 deletion web/components/templates/requests/requestsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import useRequestsPage, {

export type Message = {
role: string;
content: string;
content: string | null;
};

export type ChatProperties = {
Expand Down

0 comments on commit d306608

Please sign in to comment.