Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,16 @@ jobs:
run: npm install
- name: Run tests
run: npm run test

types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm install
- name: Check types
run: npm run check
37 changes: 25 additions & 12 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"prepare": "npm run build"
},
"peerDependencies": {
"@iiif/parser": "^2.2.0",
"@iiif/presentation-3": "^2.2.3",
"@samvera/clover-iiif": "^2.16.8",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand All @@ -63,7 +65,6 @@
"@ai-sdk/anthropic": "^1.2.12",
"@ai-sdk/google": "^1.2.22",
"@ai-sdk/openai": "^1.3.22",
"@iiif/parser": "^2.2.0",
"@langchain/community": "^0.3.53",
"@langchain/core": "^0.3.72",
"ai": "^4.3.19",
Expand All @@ -74,7 +75,6 @@
"devDependencies": {
"@alcalzone/esm2cjs": "^1.4.1",
"@eslint/js": "^9.28.0",
"@iiif/presentation-3": "^2.2.3",
"@samvera/clover-iiif": "^2.16.9",
"@storybook/addon-a11y": "^9.0.9",
"@storybook/addon-docs": "^9.0.9",
Expand Down
26 changes: 21 additions & 5 deletions src/components/Messages/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
});

const messages: IMessage[] = [
{ role: "user", content: [{ type: "text", content: "Hello" }] },
{ role: "user", content: [{ type: "text", content: "Hello" }], context: { canvas: {} as any } },

Check warning on line 17 in src/components/Messages/index.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
{ role: "assistant", type: "response", content: { type: "text", content: "Hi there!" } },
];

Expand Down Expand Up @@ -43,7 +43,11 @@

it("updates filler height when a new user message is added", () => {
const initialMessages: IMessage[] = [
{ role: "user", content: [{ type: "text", content: "Hello" }] },
{
role: "user",
content: [{ type: "text", content: "Hello" }],
context: { canvas: {} as any },

Check warning on line 49 in src/components/Messages/index.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
{ role: "assistant", type: "response", content: { type: "text", content: "Hi there!" } },
];

Expand Down Expand Up @@ -71,7 +75,11 @@
// Add a new user message
const updatedMessages: IMessage[] = [
...initialMessages,
{ role: "user", content: [{ type: "text", content: "How are you?" }] },
{
role: "user",
content: [{ type: "text", content: "How are you?" }],
context: { canvas: {} as any },

Check warning on line 81 in src/components/Messages/index.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
];

rerender(<MessagesContainer conversationState="idle" messages={updatedMessages} />);
Expand All @@ -86,9 +94,17 @@

it("updates filler height when a new assistant message is added", () => {
const initialMessages: IMessage[] = [
{ role: "user", content: [{ type: "text", content: "Hello" }] },
{
role: "user",
content: [{ type: "text", content: "Hello" }],
context: { canvas: {} as any },

Check warning on line 100 in src/components/Messages/index.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
{ role: "assistant", type: "response", content: { type: "text", content: "Hi there!" } },
{ role: "user", content: [{ type: "text", content: "How are you?" }] },
{
role: "user",
content: [{ type: "text", content: "How are you?" }],
context: { canvas: {} as any },

Check warning on line 106 in src/components/Messages/index.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
];

// Mock clientHeight with realistic values
Expand Down
20 changes: 17 additions & 3 deletions src/plugin/context/plugin-context.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@

it("should handle addMessages", () => {
const newMessages: Message[] = [
{ role: "user", content: [{ type: "text", content: "Hello" }] },
{
role: "user",
content: [{ type: "text", content: "Hello" }],
context: { canvas: {} as any },

Check warning on line 83 in src/plugin/context/plugin-context.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
];
const action: PluginContextActions = { type: "addMessages", messages: newMessages };
const newState = pluginReducer(mockInitialState, action);
Expand All @@ -90,7 +94,11 @@
...mockInitialState,
messages: [
{ role: "system", content: { type: "text", content: "System prompt" } },
{ role: "user", content: [{ type: "text", content: "Hello" }] },
{
role: "user",
content: [{ type: "text", content: "Hello" }],
context: { canvas: {} as any },

Check warning on line 100 in src/plugin/context/plugin-context.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
],
};
const action: PluginContextActions = { type: "clearConversation" };
Expand Down Expand Up @@ -279,7 +287,13 @@
});

it("should initialize with messages from storage", () => {
const storedMessages = [{ role: "user", content: [{ type: "text", content: "from storage" }] }];
const storedMessages = [
{
role: "user",
content: [{ type: "text", content: "from storage" }],
context: { canvas: {} as any },

Check warning on line 294 in src/plugin/context/plugin-context.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
},
];
(loadMessagesFromStorage as Mock).mockReturnValue(storedMessages);

const TestMessagesComponent = () => {
Expand Down