InlineAIPrompt
TsgcHTMLComponent_InlineAIPrompt: 사용자가 작업하는 바로 그 자리, 즉 메모, 리치 편집기 옆이나 그리드 열의 헤더에서 어시스턴트에게 묻는 팝오버로, Delphi, C++ Builder 및 .NET에서 사용할 수 있습니다. 무엇을 남길지는 사람이 결정합니다.
TsgcHTMLComponent_InlineAIPrompt: 사용자가 작업하는 바로 그 자리, 즉 메모, 리치 편집기 옆이나 그리드 열의 헤더에서 어시스턴트에게 묻는 팝오버로, Delphi, C++ Builder 및 .NET에서 사용할 수 있습니다. 무엇을 남길지는 사람이 결정합니다.
휴먼 인 더 루프 컨트롤입니다. 프롬프트는 팝오버에서 입력하고 답변도 그 안에 표시되며, Accept를 눌러야만 답변이 OnAIAccept를 통해 애플리케이션에 전달됩니다. 컴포넌트는 데이터셋, 필드, 페이지에 절대 쓰지 않습니다. 답변은 AIAssistant 속성(TsgcHTMLAIAssistant)을 통해 얻습니다.
TsgcHTMLComponent_InlineAIPrompt(유닛 sgcHTML_Component_InlineAIPrompt)
트리거 버튼, 그리고 프롬프트 상자, 답변, Accept, Discard가 있는 팝오버 카드
Delphi, C++ Builder, .NET
팝오버에 PromptID와 TargetName을 지정하고, AIAssistant를 지정하고, 어시스턴트가 볼 수 있는 행으로 Context를 채우고, 팝오버가 게시하는 네 가지 액션을 Open, ProcessPrompt, Accept, Discard로 라우팅합니다. 수락된 내용은 OnAIAccept로 전달됩니다.
uses
sgcHTML_AI, sgcHTML_Component_InlineAIPrompt;
FAI := TsgcHTMLAIAssistant.Create(Self);
FAI.Provider := aiprOpenAI;
FAI.APIKey := 'API_KEY';
FAI.AllowRowDataToProvider := True; // the answer is drafted over Context
FPrompt := TsgcHTMLComponent_InlineAIPrompt.Create(Self);
FPrompt.PromptID := 'notePrompt';
FPrompt.TargetName := 'Note';
FPrompt.Title := 'Draft the note';
FPrompt.Placeholder := 'e.g. write a short delivery note';
FPrompt.AIAssistant := FAI;
FPrompt.Context.Add('Customer=Northwind'); // the rows the assistant may see
FPrompt.OnAIAccept := PromptAccept;
Response := FPrompt.HTML; // the trigger, and the popover while IsOpen
// only when a human presses Accept, aValue is the answer that was on screen
procedure TMain.PromptAccept(Sender: TObject; const aValue: string);
begin
SaveNote(aValue); // your application writes it where it belongs
end;
// in the message handler, one call for each action the popover posts
if vAction = 'inlineAIOpen' then
FPrompt.Open
else if vAction = 'inlineAIAsk' then
FPrompt.ProcessPrompt(vText)
else if vAction = 'inlineAIAccept' then
FPrompt.Accept
else if vAction = 'inlineAIDiscard' then
FPrompt.Discard;
oHTMX.PushFragment(vGuid, FPrompt.HTML);
// includes: sgcHTML_AI.hpp, sgcHTML_Component_InlineAIPrompt.hpp
FAI = new TsgcHTMLAIAssistant(this);
FAI->Provider = aiprOpenAI;
FAI->APIKey = "API_KEY";
FAI->AllowRowDataToProvider = true; // the answer is drafted over Context
FPrompt = new TsgcHTMLComponent_InlineAIPrompt(this);
FPrompt->PromptID = "notePrompt";
FPrompt->TargetName = "Note";
FPrompt->Title = "Draft the note";
FPrompt->Placeholder = "e.g. write a short delivery note";
FPrompt->AIAssistant = FAI;
FPrompt->Context->Add("Customer=Northwind"); // the rows the assistant may see
FPrompt->OnAIAccept = PromptAccept;
String html = FPrompt->HTML; // the trigger, and the popover while IsOpen
// only when a human presses Accept, aValue is the answer that was on screen
void __fastcall TMain::PromptAccept(TObject *Sender, const String aValue)
{
SaveNote(aValue); // your application writes it where it belongs
}
// in the message handler, one call for each action the popover posts
if (vAction == "inlineAIOpen")
FPrompt->Open();
else if (vAction == "inlineAIAsk")
FPrompt->ProcessPrompt(vText);
else if (vAction == "inlineAIAccept")
FPrompt->Accept();
else if (vAction == "inlineAIDiscard")
FPrompt->Discard();
oHTMX->PushFragment(vGuid, FPrompt->HTML);
using esegece.sgcWebSockets;
var ai = new TsgcHTMLAIAssistant();
ai.Provider = TsgcHTMLAIAssistant.TsgcHTMLAIProvider.aiprOpenAI;
ai.APIKey = "API_KEY";
ai.AllowRowDataToProvider = true; // the answer is drafted over Context
var prompt = new TsgcHTMLComponent_InlineAIPrompt();
prompt.PromptID = "notePrompt";
prompt.TargetName = "Note";
prompt.Title = "Draft the note";
prompt.Placeholder = "e.g. write a short delivery note";
prompt.AIAssistant = ai;
prompt.Context.Add("Customer=Northwind"); // the rows the assistant may see
prompt.OnAIAccept += PromptAccept;
string html = prompt.HTML; // the trigger, and the popover while IsOpen
// only when a human presses Accept, value is the answer that was on screen
void PromptAccept(object sender, string value)
{
SaveNote(value); // your application writes it where it belongs
}
// in the message handler, one call for each action the popover posts
if (action == "inlineAIOpen")
prompt.Open();
else if (action == "inlineAIAsk")
prompt.ProcessPrompt(text);
else if (action == "inlineAIAccept")
prompt.Accept();
else if (action == "inlineAIDiscard")
prompt.Discard();
htmx.PushFragment(guid, prompt.HTML);
가장 자주 사용하게 되는 멤버.
프롬프트는 팝오버에서 입력하고 답변도 그 안에 표시되며, Accept만이 OnAIAccept를 통해 답변을 애플리케이션에 전달합니다. Discard는 팝오버를 닫고 답변을 버립니다. 컴포넌트는 데이터셋, 필드, 페이지에 절대 쓰지 않으며, 돌아온 내용을 어떻게 처리할지는 애플리케이션이 결정합니다. 모델 텍스트는 노드 계층을 통해 기록되므로 이스케이프되며 마크업이 될 수 없습니다.
Open은 아직 프롬프트를 입력하지 않은 상태로 팝오버를 엽니다. ProcessPrompt(aPrompt)는 먼저 OnAIPrompt에 묻고, 그것이 처리하지 않으면 Context를 대상으로 어시스턴트에게 물은 다음, 답변을 ResultText에 담아 팝오버를 열어 둡니다. Accept는 ResultText를 OnAIAccept로 전달하고 팝오버를 닫으며, 답변이 없으면 아무것도 전달하지 않습니다. Discard는 팝오버를 닫습니다.
OnAIPrompt(Sender, aPrompt, aResult, aHandled)는 애플리케이션이 직접 응답하게 해 줍니다. aResult와 aHandled를 설정하십시오. aHandled를 False로 두면 대신 어시스턴트에게 묻습니다. OnAIAccept(Sender, aValue)는 사람이 Accept를 누를 때 발생하며, aValue는 화면에 표시되어 있던 답변입니다.
TsgcHTMLAIAssistant를 AIAssistant에 지정합니다. AIAssistant를 참조하십시오. 팝오버는 어시스턴트의 SuggestColumnValues를 Context(행마다 한 줄씩 담은 TStringList)에 대해 호출합니다. 이는 행 데이터입니다. 어시스턴트의 AllowRowDataToProvider가 False인 동안에는 아무것도 전송되지 않으며, Context가 비어 있고 OnAIPrompt가 응답하지 않은 경우에는 아무것도 요청하지 않습니다.
PromptID(기본값 sgcInlineAI)는 팝오버의 ID이자 prompt 필드로 게시되는 값입니다. TargetName은 수락된 답변이 속하는 컨트롤의 이름이며 target 필드로 게시되므로, 이를 라우팅할 수 있습니다. Title, Placeholder, ButtonText가 텍스트를 설정하고, IsOpen은 패널을 표시하며, PromptText와 ResultText는 질문한 내용과 답변한 내용을 담습니다.
HTTP 라우트는 없습니다. 모든 컨트롤은 data-sgc-ws-send 폼입니다. inlineAIOpen(필드 prompt, target), inlineAIAsk(추가로 text), inlineAIAccept, inlineAIDiscard입니다. action으로 분기하고, prompt를 확인하여 어느 팝오버가 보냈는지 알아내고, 다시 렌더링된 컴포넌트를 되돌려 푸시하십시오. 답변을 스트리밍하는 호스트는 ResultText가 늘어난 상태로 다시 렌더링합니다.
트리거는 항상 렌더링됩니다. IsOpen이 켜져 있으면 그 옆에 제목, 프롬프트 상자, 질문 버튼, 그리고 답변이 있으면 답변과 함께 Accept 및 Discard 컨트롤이 있는 카드가 렌더링됩니다. 텍스트는 현지화된 문자열 AIAsk, AIAccept, AIDiscard에서 가져옵니다.
컴포넌트는 두 메시지 사이에 질문과 대기 중인 답변을 유지하므로 인스턴스 하나는 사용자 한 명에 해당합니다. 다중 사용자 애플리케이션에서는 세션별로 키를 지정하십시오. 다른 htmx WebSocket 메시지와 마찬가지로 메시지에는 CSRF 검사가 없으므로, OnAIAccept가 수행하는 일에 대한 권한 부여는 서버에서 유지하십시오.
이 유닛은 SGC_HTML이 정의된 경우에 컴파일되며, sgcVer.inc는 Android와 iOS에는 이를 정의하지 않습니다. 제공자에는 Enterprise 또는 All-Access 에디션 또는 sgcAI 팩의 AI 유닛이 필요하며, 이 유닛들은 Windows 전용입니다. 이 컴포넌트에는 규칙 기반 폴백이 없으므로, 다른 플랫폼이나 제공자가 없는 경우에는 OnAIPrompt에서 직접 응답하십시오.
| 온라인 도움말이 찱포넌트의 전체 API 참조 및 사용 가이드입니다. | 열기 | |
| AI Data Pack 가이드어시스턴트, 작업 모델, 데이터 컴포넌트가 어떻게 맞물리는지, 그리고 컴퓨터 밖으로 나가는 데이터가 무엇인지 설명합니다. | 열기 | |
| 모든 sgcHTML 컴포넌트80개 이상의 컴포넌트 전체 기능 매트릭스를 둘러보십시오. | 열기 | |
| 무료 체험판 다운로드30일 체험판은 60.HTML 데모 프로젝트를 포함하며, 그중 18.AIData에서는 팝오버가 폼의 메모를 초안으로 작성합니다. | 열기 | |
| 가격전체 소스 코드가 포함된 Single, Team 및 Site 라이선스. | 열기 |