Skip to content

Commit

Permalink
chore: update dalle meta type
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Nov 22, 2023
1 parent 5478d65 commit 9f777c2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"cSpell.words": [
"backoff",
"chatgpt",
"dalle",
"datetime",
"davinci",
"headlessui",
Expand Down
12 changes: 10 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,18 @@ interface MultiModalInputImage {
*/
asset_pointer: string
content_type: 'image_asset_pointer' & (string & {})
fovea: number
height: number
size_bytes: number
width: number
metadata?: {
dalle?: {
gen_id: string
prompt: string
seed: number
serialization_title: string
}
}
}

export interface ConversationNodeMessage {
Expand Down Expand Up @@ -112,7 +121,7 @@ export interface ConversationNodeMessage {
end_turn: boolean
id: string
metadata?: MessageMeta
recipient: 'all' | 'browser' | 'dalle.text2im' & (string & {})
recipient: 'all' | 'browser' | 'python' | 'dalle.text2im' & (string & {})
status: string
weight: number
}
Expand Down Expand Up @@ -222,7 +231,6 @@ async function replaceImageAssets(conversation: ApiConversation): Promise<void>
}
catch (error) {
console.error('Failed to fetch image asset', error)
// do nothing
}
}))
}
Expand Down
2 changes: 1 addition & 1 deletion src/exporter/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function conversationToHtml(conversation: ConversationResult, avatar: string, me
// Skip tool's intermediate message.
//
// HACK: we special case the content_type 'multimodal_text' here because it is used by
// the dall-e tool to return the image result, and we do want to show that.
// the dalle tool to return the image result, and we do want to show that.
if (message.author.role === 'tool' && message.content.content_type !== 'multimodal_text') return null

const author = transformAuthor(message.author)
Expand Down
2 changes: 1 addition & 1 deletion src/exporter/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function conversationToMarkdown(conversation: ConversationResult, metaList?: Exp
// Skip tool's intermediate message.
//
// HACK: we special case the content_type 'multimodal_text' here because it is used by
// the dall-e tool to return the image result, and we do want to show that.
// the dalle tool to return the image result, and we do want to show that.
if (message.author.role === 'tool' && message.content.content_type !== 'multimodal_text') return null

const timestamp = message?.create_time ?? ''
Expand Down
2 changes: 1 addition & 1 deletion src/exporter/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function transformMessage(message?: ConversationNodeMessage) {
// Skip tool's intermediate message.
//
// HACK: we special case the content_type 'multimodal_text' here because it is used by
// the dall-e tool to return the image result, and we do want to show that.
// the dalle tool to return the image result, and we do want to show that.
if (message.author.role === 'tool' && message.content.content_type !== 'multimodal_text') return null

const author = transformAuthor(message.author)
Expand Down

0 comments on commit 9f777c2

Please sign in to comment.