Versions in this module Expand all Collapse all v0 v0.0.1 Aug 14, 2024 Changes in this version + const API_AUDIO_TO_TEXT + const API_CHAT_MESSAGES + const API_CHAT_MESSAGES_STOP + const API_COMPLETION_MESSAGES + const API_COMPLETION_MESSAGES_STOP + const API_CONVERSATIONS + const API_CONVERSATIONS_DELETE + const API_CONVERSATIONS_RENAME + const API_FILE_UPLOAD + const API_MESSAGES + const API_MESSAGES_FEEDBACKS + const API_MESSAGES_SUGGESTED + const API_META + const API_PARAMETERS + const API_PARAM_CONVERSATION_ID + const API_PARAM_MESSAGE_ID + const API_PARAM_TASK_ID + const API_TEXT_TO_AUDIO + const CONSOLE_API_CURRENT_WORKSPACE_RERANK_MODEL + const CONSOLE_API_DATASETS_CREATE + const CONSOLE_API_DATASETS_DELETE + const CONSOLE_API_DATASETS_INIT + const CONSOLE_API_DATASETS_INIT_STATUS + const CONSOLE_API_DATASETS_LIST + const CONSOLE_API_FILE_UPLOAD + const CONSOLE_API_LOGIN + const CONSOLE_API_PARAM_DATASETS_ID + const CONSOLE_API_WORKSPACES_RERANK_MODEL + const DEFAULT_TIMEOUT + const DEFAULT_USER + const RESPONSE_MODE_BLOCKING + const RESPONSE_MODE_STREAMING + func CommonRiskForSendRequest(code int, err error) error + func CommonRiskForSendRequestWithCode(code int, err error, targetCode int) error + func PrepareChatPayload(payload map[string]interface{}) (string, error) + func PrepareCompletionPayload(payload map[string]interface{}) (string, error) + func SendGetRequest(forConsole bool, dc *DifyClient, api string) (httpCode int, bodyText []byte, err error) + func SendGetRequestToAPI(dc *DifyClient, api string) (httpCode int, bodyText []byte, err error) + func SendGetRequestToConsole(dc *DifyClient, api string) (httpCode int, bodyText []byte, err error) + func SendPostRequest(forConsole bool, dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error) + func SendPostRequestToAPI(dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error) + func SendPostRequestToConsole(dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error) + func UpdateAPIParam(api, key, value string) string + type AudioToTextResponse struct + Text string + type ChatMessagesPayload struct + ConversationID string + Files []ChatMessagesPayloadFile + Inputs any + Query string + ResponseMode string + User string + type ChatMessagesPayloadFile struct + TransferMethod string + Type string + URL string + UploadFileID string + type ChatMessagesResponse struct + Answer string + ConversationID string + CreatedAt int + Event string + MessageID string + Metadata any + Mode string + type ChatMessagesStopResponse struct + Result string + type CompletionMessagesPayload struct + ConversationID string + Inputs any + ResponseMode string + User string + type CompletionMessagesResponse struct + Answer string + CreatedAt int + Event string + ID string + MessageID string + Metadata any + Mode string + TaskID string + type CompletionMessagesStopResponse struct + Result string + type ConversationsResponse struct + Data []struct{ ... } + HasMore bool + Limit int + type CreateDatasetsPayload struct + Name string + type CreateDatasetsResponse struct + AppCount int + CreatedAt int + CreatedBy string + DataSourceType any + Description any + DocumentCount int + EmbeddingAvailable any + EmbeddingModel any + EmbeddingModelProvider any + ID string + IndexingTechnique any + Name string + Permission string + Provider string + RetrievalModelDict struct{ ... } + Tags []any + UpdatedAt int + UpdatedBy string + WordCount int + type DeleteConversationsResponse struct + Result string + type DifyClient struct + Client *http.Client + ConsoleHost string + ConsoleToken string + Host string + Key string + SkipTLS bool + Timeout time.Duration + User string + func CreateDifyClient(config DifyClientConfig) (*DifyClient, error) + func (dc *DifyClient) AudioToText(filePath string) (result AudioToTextResponse, err error) + func (dc *DifyClient) ChatMessages(query string, inputs string, conversation_id string, files []any) (result ChatMessagesResponse, err error) + func (dc *DifyClient) ChatMessagesStop(task_id string) (result ChatMessagesStopResponse, err error) + func (dc *DifyClient) ChatMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error) + func (dc *DifyClient) CompletionMessages(inputs string, conversation_id string, files []any) (result CompletionMessagesResponse, err error) + func (dc *DifyClient) CompletionMessagesStop(task_id string) (result CompletionMessagesStopResponse, err error) + func (dc *DifyClient) CompletionMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error) + func (dc *DifyClient) Conversations(last_id string, limit int) (result ConversationsResponse, err error) + func (dc *DifyClient) CreateDatasets(datasets_name string) (result CreateDatasetsResponse, err error) + func (dc *DifyClient) DatasetsFileUpload(filePath string, fileName string) (result FileUploadResponse, err error) + func (dc *DifyClient) DeleteConversation(conversation_id string) (result DeleteConversationsResponse, err error) + func (dc *DifyClient) DeleteDatasets(datasets_id string) (ok bool, err error) + func (dc *DifyClient) FileUpload(filePath string, fileName string) (result FileUploadResponse, err error) + func (dc *DifyClient) GetAPI(api string) string + func (dc *DifyClient) GetConsoleAPI(api string) string + func (dc *DifyClient) GetCurrentWorkspaceRerankDefaultModel() (result GetCurrentWorkspaceRerankDefaultModelResponse, err error) + func (dc *DifyClient) GetMeta() (result GetMetaResponse, err error) + func (dc *DifyClient) GetParameters() (result GetParametersResponse, err error) + func (dc *DifyClient) InitDatasetsByUploadFile(datasets_ids []string) (result InitDatasetsResponse, err error) + func (dc *DifyClient) InitDatasetsIndexingStatus(datasets_id string) (result InitDatasetsIndexingStatusResponse, err error) + func (dc *DifyClient) ListDatasets(page int, limit int) (result ListDatasetsResponse, err error) + func (dc *DifyClient) ListWorkspacesRerankModels() (result ListWorkspacesRerankModelsResponse, err error) + func (dc *DifyClient) Messages(conversation_id string) (result MessagesResponse, err error) + func (dc *DifyClient) MessagesFeedbacks(message_id string, rating string) (result MessagesFeedbacksResponse, err error) + func (dc *DifyClient) MessagesSuggested(message_id string) (result MessagesSuggestedResponse, err error) + func (dc *DifyClient) RenameConversation(conversation_id string) (result RenameConversationsResponse, err error) + func (dc *DifyClient) TextToAudio(text string) (result any, err error) + func (dc *DifyClient) TextToAudioStreaming(text string) (result any, err error) + func (dc *DifyClient) UserLogin(email string, password string) (result UserLoginResponse, err error) + type DifyClientConfig struct + ConsoleHost string + Host string + Key string + SkipTLS bool + Timeout int + User string + type FileUploadResponse struct + CreatedAt int + CreatedBy string + Extension string + ID string + MimeType string + Name string + Size int + type GetCurrentWorkspaceRerankDefaultModelResponse struct + Data any + type GetMetaResponse struct + ToolIcons struct{ ... } + type GetParametersResponse struct + AnnotationReply struct{ ... } + FileUpload struct{ ... } + MoreLikeThis struct{ ... } + OpeningStatement string + RetrieverResource struct{ ... } + SensitiveWordAvoidance struct{ ... } + SpeechToText struct{ ... } + SuggestedQuestions []any + SuggestedQuestionsAfterAnswer struct{ ... } + SystemParameters struct{ ... } + TextToSpeech struct{ ... } + UserInputForm []struct{ ... } + type InitDatasetsIndexingStatusData struct + CleaningCompletedAt any + CompletedAt any + CompletedSegments int + Error any + ID string + IndexingStatus string + ParsingCompletedAt any + PausedAt any + ProcessingStartedAt int + SplittingCompletedAt any + StoppedAt any + TotalSegments int + type InitDatasetsIndexingStatusResponse struct + Data []InitDatasetsIndexingStatusData + type InitDatasetsPayload struct + DataSource InitDatasetsPayloadDataSource + DocForm string + DocLanguage string + IndexingTechnique string + ProcessRule InitDatasetsPayloadProcessRule + RetrievalModel InitDatasetsPayloadRetrievalModel + type InitDatasetsPayloadDataSource struct + InfoList InitDatasetsPayloadDataSourceInfoList + Type string + type InitDatasetsPayloadDataSourceFileInfoList struct + FileIds []string + type InitDatasetsPayloadDataSourceInfoList struct + DataSourceType string + FileInfoList InitDatasetsPayloadDataSourceFileInfoList + type InitDatasetsPayloadProcessRule struct + Mode string + Rules struct{} + type InitDatasetsPayloadRerankingModel struct + RerankingModelName string + RerankingProviderName string + type InitDatasetsPayloadRetrievalModel struct + RerankingEnable bool + RerankingModel InitDatasetsPayloadRerankingModel + ScoreThreshold float64 + ScoreThresholdEnabled bool + SearchMethod string + TopK int + type InitDatasetsResponse struct + Batch string + Dataset InitDatasetsResponseDataset + Documents []InitDatasetsResponseDatasetDocument + type InitDatasetsResponseDataset struct + CreatedAt int + CreatedBy string + DataSourceType string + Description string + ID string + IndexingTechnique string + Name string + Permission string + type InitDatasetsResponseDatasetDocument struct + Archived bool + CreatedAt int + CreatedBy string + CreatedFrom string + DataSourceInfo struct{ ... } + DataSourceType string + DatasetProcessRuleID string + DisabledAt any + DisabledBy any + DisplayStatus string + DocForm string + Enabled bool + Error any + HitCount int + ID string + IndexingStatus string + Name string + Position int + Tokens int + WordCount int + type ListDatasetsItem struct + CreatedAt int + Description string + ID string + Icon string + IconBackground string + Mode string + ModelConfig ListDatasetsModelConfig + Name string + Tags []any + type ListDatasetsModelConfig struct + Model ListDatasetsModelConfigDetail + PrePrompt string + type ListDatasetsModelConfigDetail struct + CompletionParams struct{} + Mode string + Name string + Provider string + type ListDatasetsResponse struct + Data []ListDatasetsItem + HasMore bool + Limit int + Page int + Total int + type ListWorkspacesRerankItem struct + IconLarge struct{ ... } + IconSmall struct{ ... } + Label struct{ ... } + Models []ListWorkspacesRerankModel + Provider string + Status string + type ListWorkspacesRerankModel struct + Deprecated bool + Features any + FetchFrom string + Label struct{ ... } + Model string + ModelProperties struct{ ... } + ModelType string + Status string + type ListWorkspacesRerankModelsResponse struct + Data []ListWorkspacesRerankItem + type MessagesFeedbacksResponse struct + Result string + type MessagesResponse struct + Data []struct{ ... } + HasMore bool + Limit int + type MessagesSuggestedResponse struct + Data []string + Result string + type RenameConversationsResponse struct + Result string + type UserLoginParams struct + Email string + Password string + RememberMe bool + type UserLoginResponse struct + Data string + Result string