Skip to content

Commit

Permalink
semantics: test for model availability in advance
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Nov 7, 2023
1 parent 752be70 commit 8f81eec
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
*SqueakInboxTalkExtras-Semantics-Core
initializeSemanticCorpus

SemanticText assureSearchAvailableOr: [:requirements |
TalkSemanticModelNotReady new
featureName: 'semantic search';
requirements: requirements;
signal].

self messages size > 100 ifTrue:
["we would use #inform: but that is not thread-safe"
self notify: 'Initialize semantic corpus now? This may take a while.'].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
},
"instance" : {
"assureSemanticCorpus" : "ct 8/15/2023 16:20",
"initializeSemanticCorpus" : "ct 8/21/2023 01:47",
"initializeSemanticCorpus" : "ct 10/18/2023 18:10",
"semanticCorpus" : "ct 8/21/2023 01:46" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ private
smartSummary

| fullText |
SemanticText assureConversationAvailableOr: [:requirements |
TalkSemanticModelNotReady new
featureName: 'smart summaries';
requirements: requirements;
signal].

fullText := self conversation fullTextForSummary.

smartSummaryConversation := (Smalltalk classNamed: #SemanticConversation) new.
smartSummaryConversation := SemanticConversation new.
smartSummaryConversation config: self class semanticConversationConfig.
self changed: #smartSummaryHeader.
^ smartSummaryConversation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"smartCancelIcon" : "ct 8/21/2023 02:28",
"smartChatIcon" : "ct 8/21/2023 02:28",
"smartRerequestIcon" : "ct 8/21/2023 02:28",
"smartSummary" : "ct 8/21/2023 02:25",
"smartSummary" : "ct 10/18/2023 18:02",
"smartSummaryHeader" : "ct 8/21/2023 02:37",
"smartSummaryText" : "ct 8/21/2023 02:19",
"windowIsClosing" : "ct 8/27/2023 22:01" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ embeddings
updateFromInbox

| newMessages |
SemanticText assureSearchAvailableOr: [:requirements |
(Project uiManager
chooseOptionFromLabeledValues:
(OrderedDictionary new
at: 'Show instructions' put:
[| steps |
steps := 'To update the corpus for semantic search, you need to {1}. After that, please refresh the inbox again.' asText format:
{SemanticText
formatRequirements: requirements
retry: []}.
steps editWithLabel: 'Squeak Inbox Talk'];
at: 'Ignore once' put: nil;
yourself)
title: 'To update the corpus for semantic search, you need to configure SemanticText first.')
value].

newMessages := self inbox messages asSet copyWithoutAll: self knownMessages asSet. "optimization (because data view hashes are so slow)"
newMessages
do: [:message | self addFragmentDocumentsFrom: message]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"initializeForInbox:" : "ct 8/21/2023 00:33",
"knownMessages" : "ct 8/15/2023 18:07",
"readHeaderFrom:" : "ct 8/28/2023 00:03",
"updateFromInbox" : "ct 8/21/2023 00:25",
"updateFromInbox" : "ct 11/7/2023 10:15",
"writeHeaderOn:" : "ct 8/15/2023 12:36" } }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
handling
cancel

| process |
process := Processor activeProcess.
Project current spawnNewProcessIfThisIsUI: process.
process terminate.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
featureName: aString

featureName := aString.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
featureName

^ featureName
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
printing
messageText

^ 'SemanticText is not yet configured'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
requirements: specs

requirements := specs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
requirements

^ requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
printing
richMessageText

^ '{1}\\{2} to try again.' withCRs asText format:
{(self featureName ifNil: ['You need to {2}.'] ifNotNil: ['To enable {1}, you need to {2}.']) asText format:
{self featureName.
SemanticText
formatRequirements: self requirements
retry: [self cancel]}.
'Click here' asText
addAttribute: (PluggableTextAttribute evalBlock: [self cancel]);
yourself}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
},
"instance" : {
"cancel" : "ct 10/18/2023 18:03",
"featureName" : "ct 10/18/2023 18:00",
"featureName:" : "ct 10/18/2023 18:00",
"messageText" : "ct 10/18/2023 17:57",
"requirements" : "ct 10/18/2023 17:56",
"requirements:" : "ct 10/18/2023 17:57",
"richMessageText" : "ct 10/18/2023 18:06" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "SqueakInboxTalkExtras-Semantics-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"requirements",
"featureName" ],
"name" : "TalkSemanticModelNotReady",
"pools" : [
],
"super" : "Error",
"type" : "normal" }

0 comments on commit 8f81eec

Please sign in to comment.