From 0e28bcaf130b253740a9c00f10dd347dc581e890 Mon Sep 17 00:00:00 2001 From: Robat Williams Date: Fri, 15 Dec 2023 17:15:14 +0000 Subject: [PATCH] Make entityKind private --- src/functions/functions.js | 7 +++++-- testFramework/completionEntityStub.mjs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/functions/functions.js b/src/functions/functions.js index b2f916e..3c02696 100644 --- a/src/functions/functions.js +++ b/src/functions/functions.js @@ -55,7 +55,10 @@ CustomFunctions.associate('CHAT_COMPLETE', async (messages, params) => { type: Excel.CellValueType.entity, text: json.choices[0].message.content, properties: { - entityKind: COMPLETION_ENTITY_KIND, + // These are accessible using formulas. Prefix any that are only for + // this addin's use, or only for display use, with _. + + _entityKind: COMPLETION_ENTITY_KIND, // For visibility of newlines without needing to use cell text wrap. _lines: @@ -161,7 +164,7 @@ function validateIsCompletion(anyTypedParameter) { if ( !( anyTypedParameter.type === Excel.CellValueType.entity && - anyTypedParameter.properties.entityKind.basicValue === + anyTypedParameter.properties._entityKind.basicValue === COMPLETION_ENTITY_KIND ) ) { diff --git a/testFramework/completionEntityStub.mjs b/testFramework/completionEntityStub.mjs index b6def06..8e713e8 100644 --- a/testFramework/completionEntityStub.mjs +++ b/testFramework/completionEntityStub.mjs @@ -5,12 +5,12 @@ export function makeCompletionEntity({ content }) { basicValue: '#VALUE!', text: undefined, // Not for programmatic use properties: { - _lines: undefined, // Not for programmatic use - entityKind: { + _entityKind: { type: 'String', basicType: 'String', basicValue: 'openai-excel-formulas:chat-completion', }, + _lines: undefined, // Not for programmatic use requestBody: { type: 'Entity', basicType: 'Error',