
Announcements
I Created the App in Power Apps like Chat GPT using Custom Connector and Custom Connector created by API Key and Endpoint URL is these :- https://api.openai.com/v1/chat/completions then after the app is Created and after that I have Created Database in SQL Server My SQL Server Name is :-W10-8GB-DEV-5\SQLEXPRESS and Database Name :- Master In that have Mainly 5 tables of SQL Connected Completion Usage, Conversations Message, Node, User.
Completion Usage have fields like :- [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,[CompletionTokens] [int] NOT NULL, [PromptTokens] [int] NOT NULL, [TotalTokens] [int] NOT NULL)
User :-[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, [UserName] [nvarchar](max) NULL, [Email] [nvarchar](max) NULL, [FirstName] [nvarchar](max) NULL, [LastName] [nvarchar](max) NULL)
Conversations :- [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, [Title] [nvarchar](max) NOT NULL, [Created] [datetime2](7) NOT NULL DEFAULT(getutcdate()), [IsDeleted] [bit] NOT NULL, [SearchTokens] [nvarchar](max) NULL, [UserId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[User](Id))
Node :- [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, [UserId] [nvarchar](max) NULL, [ParentId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[Node](Id), [ConversationId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[Conversations](Id))
Message :- [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, [UserId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[User](Id), [Content] [varchar](max) NOT NULL, [NodeId] UNIQUEIDENTIFIER NOT NULL REFERENCES [dbo].[Node] ([Id]), [ConversationIdentifier] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[Conversations](Id), [Role] [nvarchar](max) NULL, [Created] [datetime2](7) NULL DEFAULT(getutcdate()), [ParentId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[Message] ([Id]), [CompletionUsageId] UNIQUEIDENTIFIER NULL REFERENCES [dbo].[CompletionUsage] ([Id]))
so Now I want to store this Data in SQL Tables What user Conversation.
In These App There are Only one Screen in these I have Mainly 5 Controls One Gallery, One TextInput , one Icon .
In Gallery I Inserted Two Label and give me More Details about of Control Gallery Item Property :- colChat, Icon
onselect :- Set(varResponse,ChatGPTConnector.ChatAPI("gpt-3.5-turbo",Collect(colChat,{role : "user", content : txtinputMessage.Text}))); Collect(colChat,First(varResponse.choices).message); Reset(txtinputMessage)
and the Label Inside Gallery one label Have Text Property is this :- ThisItem.Role and
Other label Text Property :- ThisItem.Content
so I want to store Data in SQL in Respective Columns. Please free to ask If you Have any Query in Understanding the Question and also Please Help me if You Have any Idea
Hi Again! @Anonymous, Please confirm that these are transactional tables:
Completion Usage
User
Conversations
Node
Message
Also, how you want to save the data to table? I mean every time user click on enter icon or you want that it should be saved in one go (complete conversation)
Also from where you will get Completion Usage information? Basically you need to use Patch function.
Thanks,
ANB