acheong08 / BingImageCreator

High quality image generation by Microsoft. Reverse engineered API.
The Unlicense
295 stars 90 forks source link

Support Microsoft Designer #30

Open RubyAILab opened 1 year ago

RubyAILab commented 1 year ago

I see Microsoft just release a new product name is Mcrosoft Design with Dall e 2.5. Can you intergrate this repo with it

acheong08 commented 1 year ago

Send a link

Delamcode commented 1 year ago

https://designer.microsoft.com/

acheong08 commented 1 year ago

POST to https://designerapp.officeapps.live.com/designerapp/suggestions.ashx with request

{
  "ImageFiles": [],
  "ImageUrls": [],
  "Title": {
    "Text": ""
  },
  "SubTitle": {
    "Text": ""
  },
  "Expectations": {
    "Dimension": {
      "Width": 1200,
      "Height": 628
    },
    "ExcludeDesignMetadata": [],
    "MaxCount": 15,
    "MinCount": 3,
    "TypeMetadata": [
      "png",
      "bmp",
      "jpg",
      "oxsd"
    ],
    "IsBrandKit": false
  },
  "Hints": {
    "Trigger": "DesignFromScratch",
    "EnableGetty3PImages": "true",
    "EnableGetty3PVideos": "true",
    "image2HeadingsForDFS": "true",
    "DesignQuery": "A sarcastic twitter post about an NFT launch",
    "HasDalleImage": "false",
    "AllImagesAreDalleImages": "false",
    "LastDalleQuery": "",
    "EnableThumbnailDownsample": "true",
    "EnableHighResImagesForRenderingThumbnail": "true"
  }
}
acheong08 commented 1 year ago

The results are disappointing

Delamcode commented 1 year ago

If you make images with it there isn’t a watermark

acheong08 commented 1 year ago

Oh I see. I was looking at the designer rather than Dalle. I'll add support for it

acheong08 commented 1 year ago

https://designerapp.officeapps.live.com/designerapp/DallE.ashx?action=GetDallEImagesCogSci POST

dalle-caption: {query}
dalle-scenario-name: TextToImage
dalle-batch-size: 3
dalle-image-response-format: URLWithBase64Thumbnail
dalle-seed: {random}
Delamcode commented 1 year ago

I don’t understand?

acheong08 commented 1 year ago

Just throwing notes here on the request structure

acheong08 commented 1 year ago

I'm stuck on authentication

acheong08 commented 1 year ago

They encrypt their JWTs

acheong08 commented 1 year ago

From a websocket:

{
    "sessionUrlBase": "https://eastus-pb00.augloop.office.com/session",
    "sliceUrl": "wss://eastus-pb00.augloop.office.com",
    "sessionKey": "91e7889a-96b4-4e47-a149-f6aad88821b3",
    "origin": "abcbbacf",
    "messageId": "c1",
    "forceReconnect": false,
    "workflowInputTypes": [
        "AugLoop_Image_ImageTile",
        "AugLoop_Core_GridCell",
        "AugLoop_Core_Document",
        "AugLoop_Automatic_Clp_SensitiveItemAnnotation",
        "AugLoop_Powerpoint_PowerPointSlide",
        "AugLoop_Text_TextTile",
        "AugLoop_Automatic_Clp_EditAnnotation",
        "AugLoop_AiMaker_AiMakerGenerateImagesSignal",
        "AugLoop_TextToSuggestions_TextToSuggestionSignal",
        "AugLoop_TextToImage_TextToImageSignal",
        "AugLoop_TextToIcon_TextToIconSignal",
        "AugLoop_TextToImage_TextToImageTraceSignal",
        "AugLoop_TextToIcon_TextToIconTraceSignal",
        "AugLoop_LensInference_LensInferenceTile",
        "AugLoop_AcsImageTransform_ACSBackgroundRemovalSignal",
        "AugLoop_AiAssistedTasks_SuggestedTasksHandshakeSignal",
        "AugLoop_AiAssistedTasks_TranscriptMetadataSignal",
        "AugLoop_Text_FormattedTextTile",
        "AugLoop_AiFeedback_OnDemandRewriteSignal",
        "AugLoop_Word_MainSubDocument",
        "AugLoop_AiFeedback_FeedbackRequest",
        "AugLoop_AiInsert_AiInsertSignal",
        "AugLoop_Copywriter_CopywriterSignal",
        "AugLoop_DocumentTextContentGenerator_DocumentTextContentGeneratorSignal",
        "AugLoop_DocumentTextContentGenerator_PromptAssistanceSignal",
        "AugLoop_DynamicBlocklist_DynamicBlockListSignal",
        "AugLoop_Signals_IdeasEngagementSignal",
        "AugLoop_Core_UserContextHolder",
        "AugLoop_Signals_NeuralRewriteSignal",
        "AugLoop_Mail_MailDocument",
        "AugLoop_ObservationalAssistance_SystemInitiatedRequest",
        "AugLoop_ObservationalAssistance_FlagRequest",
        "AugLoop_ObservationalAssistance_SessionConfig",
        "AugLoop_Signals_TextPredictorSignal",
        "AugLoop_TextPrediction_InDocumentLearnedModel",
        "AugLoop_Substrate_OfficePersonalizationModel",
        "AugLoop_TextPredictionEngagement_TextPredictionInfoAnnotation",
        "AugLoop_TextPredictionEngagement_TextPredictionInfoSignal",
        "AugLoop_TextTranslation_TranslationTile",
        "AugLoop_WritersUnblock_WritersUnblockRequest",
        "AugLoop_RoleDetection_DocumentRoleDetectionAnnotation",
        "AugLoop_RoleDetection_RoleDetectionAnnotation",
        "AugLoop_RoleDetection_RoleDetectionSettings",
        "AugLoop_ThemeGenerator_ThemeGeneratorSignal",
        "AugLoop_OrganizationMetadata_OrganizationMetadataAnnotation",
        "AugLoop_DocumentTypeClassifier_DocumentTypeClassifierAnnotation",
        "AugLoop_Goals_GoalsAnnotation",
        "AugLoop_Insights_WordCount",
        "AugLoop_Insights_CharacterCount",
        "AugLoop_Insights_CharacterWithoutSpacesCount",
        "AugLoop_Insights_ParagraphCount",
        "AugLoop_CommercialUserLicensing_LicensingAnnotation",
        "AugLoop_ThemeGenerator_ThemeOperationSignal",
        "AugLoop_ThemeGenerator_PersonalizerThemesRankedAnnotation",
        "AugLoop_ThemeGenerator_ThemeOperationHistoryAnnotation",
        "AugLoop_PullQuotes_PullQuotesSignal",
        "AugLoop_Acronyms_AcronymInsights",
        "AugLoop_Embeddings_DocumentEmbeddingAnnotationV3",
        "AugLoop_Signals_DocumentTypeClassifierSignal",
        "AugLoop_Signals_SimilarityCheckSignal",
        "AugLoop_Insights_InsightsAnalyzerData",
        "AugLoop_Goals_GoalSelected",
        "AugLoop_TopProofingIssues_TopProofingIssuesSignal",
        "AugLoop_SmartCompose_SmartComposeSignal",
        "AugLoop_SmartCompose_Message",
        "AugLoop_SmartCompose_ConversationContext",
        "AugLoop_SmartCompose_SCTelemetry",
        "AugLoop_Honeybee_UserDataSignal",
        "AugLoop_Honeybee_HoneybeeServiceSuggestion",
        "AugLoop_SmartComposeIntentDetection_IntentSuggestion",
        "AugLoop_GraphIntentDetection_GraphIntentSuggestion",
        "AugLoop_Honeybee_HoneybeeServiceRequest",
        "AugLoop_SmartCompose_Suggestion",
        "AugLoop_Voice_BatchTranscriptionConversation",
        "AugLoop_TranscriptionOnedriveUpload_OneDriveFastUploadInput",
        "AugLoop_TranscriptionOnedriveUpload_OneDriveFastTranscriptDownloadInput",
        "AugLoop_TranscriptionOnedriveUpload_TranscriptionStatusRequest",
        "AugLoop_Voice_VoiceTile",
        "AugLoop_Voice_SpeechToTextFinalResult",
        "AugLoop_VoiceUxo_UxoConnectionTile",
        "AugLoop_VoiceUxo_UxoMessageTile",
        "AugLoop_VoiceUxo_UxoBinaryMessageTile",
        "AugLoop_VoiceBlobStorage_TranscriptionClose",
        "AugLoop_Voice_SpeechSessionEvent",
        "AugLoop_Voice_SpeechErrorEvent",
        "AugLoop_Voice_SpeechToTextPartialResult",
        "AugLoop_VoiceBlobStorage_VoiceBlobStorage",
        "AugLoop_VoiceOnedrive_OneDriveFileUploadInput",
        "AugLoop_Text_LanguageCountAnnotationLocalized",
        "AugLoop_PlannerFileRecommendations_PlannerTask",
        "AugLoop_PlannerFileRecommendations_RecommendationTraceSignal",
        "AugLoop_TextSummarization_GenerateTextSummarySignal",
        "AugLoop_TextSummarization_GptSummarySignal",
        "AugLoop_Signals_BaseSubstrateSignal",
        "AugLoop_ThemeExtractor_ThemeExtractorSignal",
        "AugLoop_RoamingSettings_RoamingSettingsSignal",
        "AugLoop_Core_TenantContextHolder",
        "AugLoop_Avert_AvertSignal",
        "AugLoop_Table_WordTable",
        "AugLoop_Table_TableRow",
        "AugLoop_Table_TableCell",
        "AugLoop_Translator_TranslateContentSignal",
        "AugLoop_Translator_TranslateFileSignal",
        "AugLoop_Translator_DictionaryLookupSignal",
        "AugLoop_Translator_SupportedLanguagesSignal",
        "AugLoop_Translator_DictionaryExamplesSignal",
        "AugLoop_Translator_BreakSentencesSignal",
        "AugLoop_Translator_TranslateChunkedFileChunk",
        "AugLoop_Translator_TranslateChunkedFileSignal",
        "AugLoop_TextExtractiveSummarization_GenerateTextExtractiveSummarySignal",
        "AugLoop_AzureTextAbstractiveSummarization_GenerateTextAbstractiveSummarySignal",
        "AugLoop_SendToKindle_PrepareSendToKindleSignal",
        "AugLoop_SendToKindle_StartSendToKindleSignal",
        "AugLoop_SendToKindle_LogoutFromAmazonSignal",
        "AugLoop_ActionAi_ActionAISignal",
        "AugLoop_CopilotChatHistory_CopilotChatHistorySignal",
        "AugLoop_CopilotLicensing_CopilotLicenseEnabledAnnotation",
        "AugLoop_Storyteller_StorytellerSignal",
        "AugLoop_CopilotLicensing_CopilotLicensingAnnotation",
        "AugLoop_AnswerContentQuestion_AnswerContentQuestionSignal",
        "AugLoop_ComprehensionSummary_ComprehensionSummarySignal",
        "AugLoop_PptInsights_PptInsightsSignal",
        "AugLoop_LanguageDetection_LanguageDetectionSignal",
        "AugLoop_ChangeSummaries_ChangeSummariesRequest",
        "AugLoop_Proofing_UserProofingAnnotation",
        "AugLoop_Text_Critique",
        "AugLoop_QuickStart_SelectedTheme",
        "AugLoop_QuickStart_GetThemesSignal",
        "AugLoop_QuickStart_ExcludeThemes",
        "AugLoop_SearchProvider_SearchProviderSignal",
        "AugLoop_SearchSuggestion_SearchSuggestionSignal",
        "AugLoop_Excel_ExcelMergedCell",
        "AugLoop_Excel_ExcelTable",
        "AugLoop_Excel_ExcelPivotTable",
        "AugLoop_Excel_Worksheet",
        "AugLoop_Excel_ExcelDetectedTableBoundaryPartNew",
        "AugLoop_ExcelTableAi_ExcelRecognizedTableNew",
        "AugLoop_ExcelCleanData_RowsIdentityAnnotation",
        "AugLoop_Excel_ExcelTableColumn",
        "AugLoop_ExcelCleanData_UnprintableCharactersColumnAnnotation",
        "AugLoop_ExcelIntelligence_ExcelIntelligenceTableSignal",
        "AugLoop_ExcelProactiveSuggestion_PivotTableProactiveSuggestionSignal",
        "AugLoop_ExcelTableAi_ExcelDetectedTableBoundaryNew",
        "AugLoop_ExcelTableAi_ExcelTableDataGridPartNew",
        "AugLoop_ExcelTableai_RangeDataSignal",
        "AugLoop_Tablelint_TableLintColumnAnnotation",
        "AugLoop_Tablelint_TableLintErrorAnnotation",
        "AugLoop_Tablelint_TableLintUnsupportedFeatureAnnotation",
        "AugLoop_UnitTelemetry_UnitTelemetryAnnotation",
        "AugLoop_FormulaByExample_FormulaByExampleSignal",
        "AugLoop_Ink_InkSignal",
        "AugLoop_ContentExtensions_UserSearchSignal",
        "AugLoop_ContentExtensions_UserDownloadSignal",
        "AugLoop_ContentExtensions_UserProfileSignal",
        "AugLoop_ContentExtensions_UserAccountDisconnectSignal",
        "AugLoop_Hubble_ContentSearchSignal",
        "AugLoop_Hubble_ContentDownloadSignal",
        "AugLoop_Hubble_ProviderContentAnnotation",
        "AugLoop_Userconfig_UserConfigAnnotation",
        "AugLoop_ObservationalAssistance_SessionStartRequest",
        "AugLoop_GraphIntentDetection_SystemInitiatedWithIntent",
        "AugLoop_ObservationalAssistance_UserInitiatedRequest",
        "AugLoop_GraphIntentDetection_FlagWithIntent",
        "AugLoop_GraphSearch_GraphSearchSignalHybrid",
        "AugLoop_ObservationalAssistance_ClientConfigSignal",
        "AugLoop_OaSettings_OASettingsAnnotation",
        "AugLoop_ObservationalAssistance_FlagAnnotation",
        "AugLoop_ObservationalAssistance_EccAnnotation",
        "AugLoop_ObservationalAssistance_NudgeAnnotation",
        "AugLoop_ObservationalAssistance_PredictionAnnotation",
        "AugLoop_ObservationalAssistance_UserInitiatedAnnotation",
        "AugLoop_ObservationalAssistance_ControlSignal",
        "AugLoop_DesignerRecommendations_DesignerRankingSignal",
        "AugLoop_DesignerRecommendations_DesignerSessionCacheAnnotation",
        "AugLoop_DesignerRecommendations_DesignerSessionCacheSignal",
        "AugLoop_SecurityShared_CLP",
        "AugLoop_SecuritySitFetch_SecurityPolicyAnnotation",
        "AugLoop_Excel_ExcelBlock",
        "AugLoop_SecurityShared_DLP",
        "AugLoop_Mail_MailAttachments",
        "AugLoop_Mail_AttachmentBody",
        "AugLoop_SecurityShared_SensitiveItemRangeAnnotation",
        "AugLoop_SecurityShared_SensitiveItemFullDocumentAnnotation",
        "AugLoop_SecurityClp_LabellingAnnotation",
        "AugLoop_Graphuserinfo_UserInfoAnnotation",
        "AugLoop_Copilot_CopilotRequest",
        "AugLoop_LoopCopilot_LoopCopilotRequest",
        "AugLoop_WhiteboardCopilot_WhiteboardCopilotCategorizeRequest",
        "AugLoop_WhiteboardCopilot_WhiteboardCopilotSuggestRequest",
        "AugLoop_WhiteboardCopilot_WhiteboardCopilotSummarizeRequest"
    ],
    "downstreamRuntimeWorkflows": [],
    "H_": {
        "T_": "AugLoop_Session_Protocol_SessionInitResponse",
        "B_": [
            "AugLoop_Session_Protocol_Response"
        ]
    },
    "anonymousToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjIyYTQwNjczNTgzNzQyYzU4MzlkMmU4MWU2ZDFmNmIwIn0.eyJhcHBpZCI6IjQzNTRlMjI1LTUwYzktNDQyMy05ZWNlLTJkNWFmZDkwNDg3MCIsImlzcyI6Imh0dHBzOi8vYXVnbG9vcC5vZmZpY2UuY29tL2Fub255bW91c1Rva2VuIiwiYXVkIjoiaHR0cHM6Ly9hdWdsb29wLm9mZmljZS5jb20vYW5vbnltb3VzVG9rZW4iLCJpYXQiOjE2ODQ2ODAxNTMsIm5iZiI6MTY4NDY3OTg1MywiZXhwIjoxNjg0NzY2NTUzLCJvaWQiOiJ2cFBFVzgwTnIxR0tzQlRoNFllZVNDaWJnMDVuZURGTFpNTFMxTHByZWprPSIsInNpZCI6IjkxZTc4ODlhLTk2YjQtNGU0Ny1hMTQ5LWY2YWFkODg4MjFiMyJ9.0x2Y-7H0UaqIfbioaFfhLMhtqjaAXWeRTzL7yn_0XmPLFxB_TBKGYVy6g5mAgeSMmLDiUvpuEvkRjB4aBUvJQA_iU_BCDOEQ6-H3fyJ4p3evp7uZwNCCu77hZPDqr9TxGXyJfqBWQKJ3__NcZbRZgpm7tAeRxAVmdvfpBkBGAHq-KC1Gfs_2dnxgcIKJnZL6KG-BXzr_q0Mwk_QmPhP21PqdLlamZr9XlpXTDc3_tNuLwPSXIywooQBjuveQ8A65-Cwvg27amAk9O_9lL7wJItBV7uVcwW0_OvR1dFu30pPXT_WBuet8UjU_9sYfzZYqc1GDptKkwoY9MBaw6xSQPA",
    "tokenExpirationTime": 1684766553,
    "tokenExpirationSeconds": 86399
}
acheong08 commented 1 year ago

But the actual token looks like this:

eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhDQkMtSFMyNTYiLCJ4NXQiOiJiWVpFTzFka1pZZVZuaFV3ZHZ4ZUJweGhxRGciLCJ6aXAiOiJERUYifQ.CNfnptOffHFaID-v8xbVoH8WKhpiOtaS2hByhPRSIcgUDt-Qgo86kZdRckCGINLkVc9rjxYVX4_qUBdZqt-1M3zUJ7BIxrbJG4L00Gp8IDbbeCz4EKpHgl7XRMLlmNntZRY9v7E4p5GioDDIG7TSxLl2fjI_xf5_ahg_Py1jp2seGl7DnraDz75w2A7e-NhQWMCKwQB4Bwy69iLhfJD8PdmEnuVAl0ykpgHEOX-jn5XRdyjG1fqAhG8TxknvKp9p3Xjgj5laKFhEapUn6R9OhaoWTFQrBVw_cc3LSaeQvvnd52FzXFXXX32R6kc7fd8wizs6Z7PgbZdtQiZz1HsmOA.d5NURwH0-OAMWBRXYTaqaQ.WFQLst7gDnOLUtbMNvgz_U5P--vuqgtHF8Nf8v0PIP4dDSiIQbqunh0RBB_nDIqJnQSouUx9-JJnPSwY8duUo8s4ii92sf-XwzEZLI3aKgtGHGsJbHFLMmwuff0BSZWsLRq4vyABoHZLzaDg9_gVgeVZtJx0PlMfAVjbx4X5LI1EhWzDfWozzHYHJtUWZh5KMMzXxuaGGnYNXS6_Vmp1dcIIQP5hSoF3uY32VEPgN4-3VZ2ArrlXgMRE8S7d8Nu9icebkoTZ7UoJyFvt_RGZVX2iguEBk3ukz-fK5NW0msFWkZbCPi85nQtEhuSmXh8ZIDIRFYHpTZwvbcxNe8HsDsu5QfXAsjBwJq7e12KTfB4F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ates?

acheong08 commented 1 year ago

No progress yet

acheong08 commented 1 year ago

can't figure out how the auth works

xtekky commented 1 year ago

looks like the JWT lasts some time, you could just ask users to fill it in or pull it from localstorage

(async () => {
    let formData = new FormData();
    formData.append("dalle-caption", "cat");
    formData.append("dalle-scenario-name", "TextToImage");
    formData.append("dalle-batch-size", "3");
    formData.append("dalle-image-response-format", "UrlWithBase64Thumbnail"); // Url, UrlWithBase64Thumbnail, Base64
    formData.append("dalle-seed", "0");

    let response = await fetch("https://designerapp.officeapps.live.com/designerapp/DallE.ashx?action=GetDallEImagesCogSci", {
        method: "POST",
        headers: {
            accept: "application/json, text/plain, */*",
            "accept-language": "en-US,en;q=0.9",
            audiencegroup: "Production",
            authorization: "Bearer token",
            caller: "DesignerApp",
            clientbuild: "1.0.20230522.13",
            clientid: crypto.randomUUID(),
            clientname: "DesignerApp",
            "sec-ch-ua": '"Microsoft Edge";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": '"Windows"',
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "cross-site",
            sessionid: crypto.randomUUID(),
            userid: Array.from({ length: 16 }, () => Math.random().toString(36)[2]).join(""),
            usertype: "MSA",
            "x-correlation": crypto.randomUUID(),
            "x-dc-hint": "EastUS",
            "x-req-start": "29115.5",
        },
        Referer: "https://designer.microsoft.com/",
        body: formData,
    });

    console.log(await response.json());
})();