From 9f777c2d12d34d79d245ef060ee67cb3a00897e4 Mon Sep 17 00:00:00 2001 From: Pionxzh Date: Thu, 23 Nov 2023 01:06:38 +0800 Subject: [PATCH] chore: update dalle meta type --- .vscode/settings.json | 1 + src/api.ts | 12 ++++++++++-- src/exporter/html.ts | 2 +- src/exporter/markdown.ts | 2 +- src/exporter/text.ts | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 31388f6..f69b938 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,6 +23,7 @@ "cSpell.words": [ "backoff", "chatgpt", + "dalle", "datetime", "davinci", "headlessui", diff --git a/src/api.ts b/src/api.ts index 7fb3f47..c6a3148 100644 --- a/src/api.ts +++ b/src/api.ts @@ -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 { @@ -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 } @@ -222,7 +231,6 @@ async function replaceImageAssets(conversation: ApiConversation): Promise } catch (error) { console.error('Failed to fetch image asset', error) - // do nothing } })) } diff --git a/src/exporter/html.ts b/src/exporter/html.ts index 157dc8f..b914fb7 100644 --- a/src/exporter/html.ts +++ b/src/exporter/html.ts @@ -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) diff --git a/src/exporter/markdown.ts b/src/exporter/markdown.ts index d0455da..9000d48 100644 --- a/src/exporter/markdown.ts +++ b/src/exporter/markdown.ts @@ -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 ?? '' diff --git a/src/exporter/text.ts b/src/exporter/text.ts index 8e11837..8ceceba 100644 --- a/src/exporter/text.ts +++ b/src/exporter/text.ts @@ -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)