Skip to content

Commit

Permalink
Merge branch 'main' into users/ramukaritik/copresence-worker-script
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikramuka authored Oct 17, 2023
2 parents 0eb314a + ebdf563 commit c92c819
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 82 deletions.
214 changes: 152 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
{
"submenu": "microsoft-powerapps-portals.powerpages-copilot",
"group": "0_powerpages-copilot",
"when": "never"
"when": "(powerpages.copilot.isVisible) && ((!virtualWorkspace && powerpages.websiteYmlExists && config.powerPlatform.experimental.copilotEnabled) || (isWeb && config.powerPlatform.experimental.enableWebCopilot))"
}
],
"microsoft-powerapps-portals.powerpages-copilot": [
Expand Down Expand Up @@ -1036,6 +1036,7 @@
"find-process": "^1.4.7",
"fluid-framework": "^1.3.7",
"glob": "^7.1.7",
"gpt-tokenizer": "^2.1.1",
"liquidjs": "^10.2.0",
"n-readlines": "^1.0.1",
"puppeteer-core": "^14.4.1",
Expand Down
8 changes: 4 additions & 4 deletions src/common/copilot/IntelligenceApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fetch, { RequestInit } from "node-fetch";
import { INAPPROPRIATE_CONTENT, INPUT_CONTENT_FILTERED, INVALID_INFERENCE_INPUT, InvalidResponse, MalaciousScenerioResponse, NetworkError, PROMPT_LIMIT_EXCEEDED, PromptLimitExceededResponse, RELEVANCY_CHECK_FAILED, RateLimitingResponse, UnauthorizedResponse } from "./constants";
import { INAPPROPRIATE_CONTENT, INPUT_CONTENT_FILTERED, INVALID_INFERENCE_INPUT, InvalidResponse, MalaciousScenerioResponse, NetworkError, PROMPT_LIMIT_EXCEEDED, PromptLimitExceededResponse, RELEVANCY_CHECK_FAILED, RateLimitingResponse, UnauthorizedResponse, UserPrompt } from "./constants";
import { IActiveFileParams } from "./model";
import { sendTelemetryEvent } from "./telemetry/copilotTelemetry";
import { ITelemetry } from "../../client/telemetry/ITelemetry";
Expand All @@ -15,14 +15,14 @@ import { EXTENSION_NAME } from "../../client/constants";
const clientType = EXTENSION_NAME + '-' + getExtensionType();
const clientVersion = getExtensionVersion();

export async function sendApiRequest(userPrompt: string, activeFileParams: IActiveFileParams, orgID: string, apiToken: string, sessionID: string, entityName: string, entityColumns: string[], telemetry: ITelemetry, aibEndpoint: string | null) {
export async function sendApiRequest(userPrompt: UserPrompt[], activeFileParams: IActiveFileParams, orgID: string, apiToken: string, sessionID: string, entityName: string, entityColumns: string[], telemetry: ITelemetry, aibEndpoint: string | null) {

if (!aibEndpoint) {
return NetworkError;
}

const requestBody = {
"question": userPrompt,
"question": userPrompt[0].displayText,
"top": 1,
"context": {
"sessionId": sessionID,
Expand All @@ -33,7 +33,7 @@ export async function sendApiRequest(userPrompt: string, activeFileParams: IActi
"dataverseEntity": activeFileParams.dataverseEntity,
"entityField": activeFileParams.entityField,
"fieldType": activeFileParams.fieldType,
"activeFileContent": '', //TODO: Add active file content (selected code)
"activeFileContent": userPrompt[0].code, //Active file content (selected code)
"targetEntity": entityName,
"targetColumns": entityColumns,
"clientType": clientType,
Expand Down
Loading

0 comments on commit c92c819

Please sign in to comment.