Skip to content

Commit

Permalink
Merge pull request #68 from hpi-swa-lab/feat/semantics
Browse files Browse the repository at this point in the history
Semantics Plugin
  • Loading branch information
LinqLover authored Aug 27, 2023
2 parents 395904c + f4a753b commit 6a24b29
Show file tree
Hide file tree
Showing 213 changed files with 1,351 additions and 141 deletions.
3 changes: 2 additions & 1 deletion .squot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OrderedDictionary {
'packages/BaselineOfSqueakInboxTalk.package' : #SquotCypressCodeSerializer,
'packages/SqueakInboxTalk.package' : #SquotCypressCodeSerializer,
'packages/SqueakInboxTalkTests.package' : #SquotCypressCodeSerializer
'packages/SqueakInboxTalkTests.package' : #SquotCypressCodeSerializer,
'packages/SqueakInboxTalkExtras-Semantics.package' : #SquotCypressCodeSerializer
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ These filters should make it easier to survey certain domains, gain a better und

Basically, Squeak Inbox Talk is implemented by reusing and assembling together the following existing solutions: [Squeak History](https://github.com/hpi-swa/squeak-history), a project originally developed by Marcel (mt) that scrapes and processes all mailing list conversations from the [mailman archives](https://lists.squeakfoundation.org/archives/); the `SMTPClient` in Squeak for sending messages; and the Monticello infrastructure, which remains the heart of our development workflow. Optionally, further components such as [`IMAPClient`](https://github.com/hpi-swa-teaching/IMAPClient) might follow later. On top of this, Squeak Inbox Talk adds a convenient layer for exploring and filtering conversations and contributions.

## Semantics Plugin (experimental)

This repository includes an optional plugin that enhances the browsing experience by contributing features such as semantic search, similar conversations, and AI-generated summaries of conversations to Squeak Inbox Talk.
The plugin uses the [SemanticText](https://github.com/LinqLover/squeak-chatgpt) package and OpenAI's APIs for text embedding and generation.
You can enable the plugin by turning on the "Semantic search in Squeak Inbox Talk" option in the preferences.
This feature is currently in a very early stage.
Feedback and ideas welcome!

## Implementational notes

- This project is proud to use [smalltalkCI](https://github.com/hpi-swa/smalltalkCI) and the [create-image GitHub action](https://github.com/marketplace/actions/create-image).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ baseline: spec

spec for: #common do: [
"dependencies"
spec baseline: 'SemanticText' with: [
spec repository: 'github://LinqLover/squeak-chatgpt:main/packages'].
spec baseline: 'SqueakHistory' with: [
spec
repository: 'github://LinqLover/squeak-history:stream-github--hpi-swa-lab--squeak-inbox-talk/packages';
Expand All @@ -14,11 +16,14 @@ baseline: spec
spec
requires: 'SqueakHistory';
postLoadDoIt: #postLoad].
spec package: 'SqueakInboxTalkExtras-Semantics' with: [
spec requires: #('SqueakInboxTalk' 'SemanticText')].
"test packages"
spec package: 'SqueakInboxTalkTests' with: [spec requires: #(#app)].

"groups"
spec
group: #app with: 'SqueakInboxTalk';
group: #default with: #(#app #tests);
group: #tests with: 'SqueakInboxTalkTests']
group: #tests with: 'SqueakInboxTalkTests';
group: #withAllExtras with: #(app 'SqueakInboxTalkExtras-Semantics')]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ installDependencies
baseline: 'SqueakHistory';
repository: 'github://LinqLover/squeak-history:stream-github--hpi-swa-lab--squeak-inbox-talk/packages';
get;
load: 'SqueakHistory'.
load: 'SqueakHistory'.

(Smalltalk hasClassNamed: #TalkSemanticConversationBrowserPlugin) ifTrue: [
self flag: #todo. "rename repo"
Metacello new
baseline: 'SemanticText';
repository: 'github://LinqLover/squeak-chatgpt:main';
get;
load].
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"class" : {
},
"instance" : {
"baseline:" : "ct 6/3/2023 19:47",
"baseline:" : "ct 8/27/2023 22:22",
"initializeSqhPreferences" : "ct 7/8/2021 21:00",
"installChatGPT" : "ct 6/23/2023 00:29",
"installDependencies" : "ct 6/3/2023 19:54",
"installDependencies" : "ct 8/27/2023 21:35",
"isCI" : "ct 10/15/2022 21:23",
"openWelcomeContentsSync" : "ct 7/8/2021 21:00",
"postLoad" : "ct 5/26/2021 15:42",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*SqueakInboxTalk-UI-testing
isTalkBackgroundException

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"isTalkBackgroundException" : "ct 8/15/2023 16:51" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "Object" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I hold an exception that was raised from a (background) process and interrupted that process. Similar to a debugger, I can display the exception and resolve it later.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
for: anException

^ self new exception: anException
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resolving
debug

resolution := [self exception resumeUnchecked: self exception]. "just like Debugger proceed"
^ ToolSet
debugProcess: self process
context: self exception signalerContext
label: self exception description
contents: self messageText
fullView: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
exception: anException

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

^ exception
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isTalkBackgroundException

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
printing
messageText

| text |
(self exception respondsTo: #richMessageText) ifTrue:
["ASSUMPTION: All text actions in #richMessageText send a handling message to the exception, so we forward these sends to the original process. However, there might be violations to this assumptions in other cases. If needed, we would need to inject the original exception at #resumeEvaluating:, #return:, etc. ..."
^ self exception richMessageText copy
replaceAttributesThat: [:attr | attr isKindOf: TextAction]
by: [:attr |
PluggableTextAttribute evalBlock: [:object |
self resolve: [attr actOnClickFor: object]]]].

text := '{1}<br>{2} to debug the exception.' asTextFromHtml format:
{self exception description.
'Click here' asText
addAttribute: TextEmphasis bold;
addAttribute: (PluggableTextAttribute evalBlock: [self debug]);
yourself}.
text addAttribute: self textColorForError.
^ text
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
process

^ process
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resolving
resolve: aSymbolOrBlock

resolution := aSymbolOrBlock.
process
ifNil: [self resolve]
ifNotNil: [process resume].
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resolving
resolve

^ [resolution isSymbol
ifTrue: [self exception perform: resolution]
ifFalse: [resolution cull: self exception]]
ensure: [resolution := nil]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
printing
textColorForError

^ TextColor color:
((UserInterfaceTheme current get: #errorColor for: #TestRunner)
ifNil: [Color red])
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resolving
waitForResolution
"Remember and suspend the active process until is resumed through a resolution."

process := Processor activeProcess.
[process suspend]
ensure: [process := nil].
self resolve.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"class" : {
"for:" : "ct 8/15/2023 16:48" },
"instance" : {
"debug" : "ct 8/21/2023 01:25",
"exception" : "ct 8/15/2023 16:47",
"exception:" : "ct 8/15/2023 16:47",
"isTalkBackgroundException" : "ct 8/15/2023 16:51",
"messageText" : "ct 8/20/2023 22:06",
"process" : "ct 8/15/2023 16:58",
"resolve" : "ct 8/15/2023 17:01",
"resolve:" : "ct 8/20/2023 21:44",
"textColorForError" : "ct 8/15/2023 16:55",
"waitForResolution" : "ct 8/20/2023 21:47" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category" : "SqueakInboxTalk-UI",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "ct 8/20/2023 21:45",
"instvars" : [
"process",
"exception",
"resolution" ],
"name" : "TalkBackgroundException",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"contributionState" : "ct 7/14/2021 23:07",
"contributions" : "ct 5/7/2021 19:36",
"dataKey" : "ct 5/7/2021 17:36",
"fullTextForSummary" : "ct 6/22/2023 22:06",
"hasContributions" : "ct 5/7/2021 19:36",
"hyperkittyUrl" : "ct 6/1/2023 18:26",
"inbox" : "ct 5/7/2021 15:38",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ aspectDependencies
at: #revertChanges put: #(#currentText);
at: #selectedMessageIndex put: #(#selectedMessage);
at: #selectedMatch put: #(#search);
at: #smartSummaryText put: #(smartSummary);
at: #text put: #(#messageFormat #selectedMessage #search #smartSummaryText);
at: #text put: #(#messageFormat #selectedMessage #search);
at: #textSelection put: #(#text);
yourself
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
accessing - state
currentText

self hasSpecialMessageSelected ifTrue: [^ self text].

searchModel hasSearchError ifTrue: [^ searchModel debuggableErrorText].

^ self annotateMatchesIn: (self text ifNil: [^ nil])
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
testing
hasSpecialMessageSelected

^ self selectedMessage isSymbol
^ self selectedMessage isArray
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ headerText

| args message |
message := self selectedMessage ifNil: [^ nil].
message = #smartSummary ifTrue: [^ self smartSummaryHeader].
message isArray ifTrue: [^ self perform: message third "headerSelector"].

args := OrderedDictionary new
at: 'Subject' put: message subject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ messageColumns
messages := self messages.
^ {#authorTimestamp} collect: [:columnBlock |
messages collect: [:message |
message = #smartSummary
ifTrue: ['smart summary' asText addAttribute: TextEmphasis italic; yourself]
message isArray
ifTrue: [(message first "key" findFeatures joinSeparatedBy: String space) asText
addAttribute: TextEmphasis italic;
yourself]
ifFalse: [columnBlock value: message]]]
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
toolbuilder
messageMenu: menu

self hasSpecialMessageSelected ifTrue: [^ menu].
self hasSpecialMessageSelected ifTrue: [
^ self specialMessageMenu: menu].

menu defaultTarget: (self selectedMessage ifNil: [self conversation]).
menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ messages

| messages |
messages := self actualMessages ifNil: [^ nil].
self shouldIncludeSmartSummary ifTrue: [
messages := messages copyWithFirst: #smartSummary].
messages := self specialMessages , messages.
^ messages

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing - state
selectedActualMessage

^ selectedMessage isSymbol ifFalse: [selectedMessage]
^ selectedMessage isArray ifFalse: [selectedMessage]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing - state
selectedSpecialMessage

^ selectedMessage isArray ifTrue: [selectedMessage]

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6a24b29

Please sign in to comment.