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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ versions follow [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [0.7.0] - 2026-12-02

Details and migration steps: [docs/en/changelogs/0.7.0.md](docs/en/changelogs/0.7.0.md)

- `ChatRunner.SupersedesEarlierContext` sends earlier prompts' context by its label alone: the latest prompt that carries a `PromptContext` the function accepts, and every prompt after it, send their context in full, and each earlier context goes to the model as its label with a note that it is not repeated. An application that sends the same document with each prompt no longer sends a copy of it for every earlier prompt. `SaveHistory` and the views keep every context's text; nothing changes for an application that does not set it.
- A table wider than a reply shows a button at its top right corner that opens the whole table over the window (Avalonia) or the page (Blazor), where it scrolls both ways. `ChatStrings.ExpandTable` labels the button, in every language the package ships.
- **Change:** both views take `Polhem.Markdown.Avalonia` and `Polhem.Markdown.Blazor` 0.8.0, and with them `Polhem.Markdown` 0.8.0 and the viewer fixes since 0.6.1: the Avalonia viewer no longer reads a `file` image that names a Windows network share, and an unchecked task box stands out from the background. Both viewers pin `Polhem.Markdown` to exactly 0.8.0, so an application that references it itself uses 0.8.0, and one that references a viewer package itself uses 0.8.0 or later. In the Blazor view, a reply's table cells now keep their text on one line, so a wide table scrolls sideways instead of breaking its words.
Expand Down Expand Up @@ -101,7 +105,8 @@ Details: [docs/en/changelogs/0.1.0.md](docs/en/changelogs/0.1.0.md)
- The prompt box sends on Enter and ignores the Enter that confirms an input method's composition.
- English and Traditional Chinese texts, and a theme for Fluent and Semi, light and dark.

[Unreleased]: https://github.com/polhem-dev/polhem-chat/compare/v0.6.0...HEAD
[Unreleased]: https://github.com/polhem-dev/polhem-chat/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.3.0...v0.4.0
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Polhem.Chat 各套件的重要變更,每個版本只列幾項重點。每個

## [Unreleased]

## [0.7.0] - 2026-12-02

詳細內容與遷移步驟:[docs/zh-TW/changelogs/0.7.0.md](docs/zh-TW/changelogs/0.7.0.md)

- `ChatRunner.SupersedesEarlierContext` 讓較早提問的 context 只送標籤:最近一則帶有此函式接受之 `PromptContext` 的提問,以及之後的每則提問,照常送出完整 context;更早的每份 context 只以標籤加一句「不再重送」的說明交給模型。每則提問都附上同一份文件的應用程式,不再為每則較早的提問各送一份。`SaveHistory` 與兩個 view 仍保留每份 context 的全文;沒設定的應用程式行為不變。
- 比回覆寬的表格,右上角會出現一個按鈕,把整張表格蓋在視窗(Avalonia)或頁面(Blazor)上展開,可上下左右捲動。按鈕文字是 `ChatStrings.ExpandTable`,套件附帶的每種語言都有翻譯。
- **變更:** 兩個 view 改用 `Polhem.Markdown.Avalonia` 與 `Polhem.Markdown.Blazor` 0.8.0,連帶使用 `Polhem.Markdown` 0.8.0,並帶入 0.6.1 之後的 viewer 修正:Avalonia viewer 不再讀取指向 Windows 網路共用資料夾的 `file` 圖片,未勾選的工作項目方框也與背景有足夠對比。兩個 viewer 都把 `Polhem.Markdown` 鎖定在 0.8.0,所以自行引用 `Polhem.Markdown` 的應用程式要用 0.8.0,自行引用 viewer 套件的要用 0.8.0 以上。Blazor view 裡回覆的表格儲存格改為不換行,寬表格會橫向捲動,不再把字拆開擠進畫面。
Expand Down Expand Up @@ -100,7 +104,8 @@ Polhem.Chat 各套件的重要變更,每個版本只列幾項重點。每個
- 輸入框按 Enter 送出,輸入法確認組字的 Enter 不會送出。
- 內建英文與繁體中文字串,主題支援 Fluent 與 Semi 的淺色、深色。

[Unreleased]: https://github.com/polhem-dev/polhem-chat/compare/v0.6.0...HEAD
[Unreleased]: https://github.com/polhem-dev/polhem-chat/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/polhem-dev/polhem-chat/compare/v0.3.0...v0.4.0
Expand Down
79 changes: 79 additions & 0 deletions docs/en/changelogs/0.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Polhem.Chat 0.7.0 — Release Notes

[繁體中文](../../zh-TW/changelogs/0.7.0.md)

This file holds the details behind the `[0.7.0]` entry in [CHANGELOG.md](../../../CHANGELOG.md).

This release lets a runner send the context of earlier prompts by its label alone, and moves both views to
Polhem.Markdown 0.8.0, whose viewers open a wide table over the window. `ChatRunner.SupersedesEarlierContext` and
`ChatStrings.ExpandTable` are new; no public member is removed or changed.

What each kind of application has to act on:

- **Applications that reference a Polhem.Markdown package themselves**:
[The Markdown viewers move to 0.8.0](#the-markdown-viewers-move-to-080).
- **Blazor applications that style the tables of the replies**:
[Table cells keep their text on one line](#table-cells-keep-their-text-on-one-line).

## New features

### Earlier prompts' context by its label alone

The model receives the whole history with every request, so an application that sends the same document with each
prompt, through a `PromptContext`, sent a copy of it for every earlier prompt too, most of them out of date.
`ChatRunner.SupersedesEarlierContext` tells which contexts make the earlier ones unnecessary
([#67](https://github.com/polhem-dev/polhem-chat/issues/67)):

```csharp
runner.SupersedesEarlierContext = context => context.Label == "Document";
```

- The latest prompt that carries a context the function accepts, and every prompt after it, send their context in
full.
- Each context of an earlier prompt is sent as its label, with a short note that it is not repeated, so the model still
knows what the prompt was about.
- When no prompt carries a context the function accepts, every context is sent in full.
- Only the request changes: `SaveHistory`, `LoadHistory` and the views keep every context's text. The function is read
for each request, including the one sent after the user approves a tool call.

Nothing changes for an application that does not set it.

### Opening a wide table over the window

A table wider than a reply still scrolls sideways, and now also shows a button at the top right corner of the part in
view, which opens the whole table over the window (Avalonia) or the page (Blazor), on a dark backdrop, where it scrolls
both ways. Escape, the close button or a click beside the table closes it. A table that fits shows no button.

`ChatStrings.ExpandTable` labels the button, as `ChatStrings.CopyCode` labels the copy button of a code block. It ships
as "Expand table", 「展開表格」, 「展开表格」 and 「表を拡大表示」, and an application that gives the view its own
`ChatStrings` changes it like any other text.

## Changes in behaviour

### The Markdown viewers move to 0.8.0

The Avalonia control takes `Polhem.Markdown.Avalonia` 0.8.0 and the Blazor component `Polhem.Markdown.Blazor` 0.8.0,
both 0.6.1 before. Both pin `Polhem.Markdown` to exactly 0.8.0. Polhem.Markdown 0.7.0 to 0.8.0 remove no public member.
Besides the expand button, the viewers that show the replies change in these ways:

- The Avalonia viewer no longer reads a `file` image whose path names a Windows network share, and no longer opens a
`file` link to a share itself when the application leaves the link unhandled.
- An unchecked task box is drawn in the text colour, faded, so it stands out from the background in light and dark
themes.
- A block formula in the Avalonia viewer takes the new text colour when the theme changes.

See [Polhem.Markdown's changelog](https://github.com/polhem-dev/polhem-markdown/blob/main/CHANGELOG.md).

**What to do**: an application that references `Polhem.Markdown` itself uses 0.8.0, and one that references
`Polhem.Markdown.Avalonia` or `Polhem.Markdown.Blazor` itself uses 0.8.0 or later; otherwise NuGet reports a version
conflict.

### Table cells keep their text on one line

In the Blazor view, a reply's table is now in a `div.pmd-table-frame`, which also holds the expand button, and its cells
keep their text on one line, as the Avalonia view's always have. Before, the cells broke words anywhere, so a wide table
was squeezed into the reply.

**What to do**: nothing, unless the application's stylesheet styles the tables of the replies through the element they
sit in, or relies on their cells wrapping. Point such a rule at `.pmd-table-frame`. For the old wrapping, set
`white-space: normal` on `.pmd th, .pmd td`; a table squeezed that way no longer overflows, so it shows no button.
68 changes: 68 additions & 0 deletions docs/zh-TW/changelogs/0.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Polhem.Chat 0.7.0 — 發佈說明

[English](../../en/changelogs/0.7.0.md)

本檔是 [CHANGELOG.zh-TW.md](../../../CHANGELOG.zh-TW.md) 中 `[0.7.0]` 條目的詳細內容。

這一版讓 runner 可以只用標籤送出較早提問的 context,並把兩個 view 改用 Polhem.Markdown 0.8.0,它的 viewer 能把寬表格蓋在
視窗上展開。新增 `ChatRunner.SupersedesEarlierContext` 與 `ChatStrings.ExpandTable`;沒有移除或變更任何公開成員。

各類應用程式要處理的事項:

- **自行引用 Polhem.Markdown 套件的應用程式**:[Markdown 檢視器升到 0.8.0](#markdown-檢視器升到-080)。
- **替回覆中的表格自訂樣式的 Blazor 應用程式**:[表格儲存格不再換行](#表格儲存格不再換行)。

## 新功能

### 較早提問的 context 只送標籤

每次送出請求,模型都會收到完整的對話紀錄,所以每則提問都透過 `PromptContext` 附上同一份文件的應用程式,也會為每則較早的
提問再送一份,其中大多已經過時。`ChatRunner.SupersedesEarlierContext` 指定哪些 context 會讓較早的 context 不必再送
([#67](https://github.com/polhem-dev/polhem-chat/issues/67)):

```csharp
runner.SupersedesEarlierContext = context => context.Label == "Document";
```

- 最近一則帶有此函式接受之 context 的提問,以及之後的每則提問,照常送出完整 context。
- 更早提問的每份 context 只送出標籤,加上一句「不再重送」的說明,讓模型仍知道那則提問在講什麼。
- 沒有任何提問帶有此函式接受的 context 時,每份 context 都完整送出。
- 只有送出的請求會改變:`SaveHistory`、`LoadHistory` 與兩個 view 仍保留每份 context 的全文。每次送出請求時都會讀取此函式,
使用者核准工具呼叫後送出的那次也一樣。

沒設定的應用程式行為不變。

### 把寬表格蓋在視窗上展開

比回覆寬的表格仍可橫向捲動,另外會在可見部分的右上角出現一個按鈕,把整張表格蓋在視窗(Avalonia)或頁面(Blazor)上的
深色背景展開,可上下左右捲動。按 Esc、關閉按鈕或點表格旁邊即可關閉。放得下的表格不會出現按鈕。

按鈕文字是 `ChatStrings.ExpandTable`,就像程式碼區塊的複製按鈕用 `ChatStrings.CopyCode`。內建 "Expand table"、
「展開表格」、「展开表格」與「表を拡大表示」;自行提供 `ChatStrings` 給 view 的應用程式,可以像其他文字一樣修改。

## 行為變更

### Markdown 檢視器升到 0.8.0

Avalonia 控制項改用 `Polhem.Markdown.Avalonia` 0.8.0,Blazor 元件改用 `Polhem.Markdown.Blazor` 0.8.0,原本都是 0.6.1。
兩者都把 `Polhem.Markdown` 鎖定在 0.8.0。Polhem.Markdown 0.7.0 到 0.8.0 沒有移除任何公開成員;除了展開按鈕,顯示回覆的
viewer 還有以下改變:

- Avalonia viewer 不再讀取路徑指向 Windows 網路共用資料夾的 `file` 圖片;應用程式沒有處理指向共用資料夾的 `file` 連結時,
viewer 也不會自己開啟。
- 未勾選的工作項目方框改用淡化的文字顏色繪製,在淺色與深色主題下都與背景有足夠對比。
- Avalonia viewer 的區塊公式在主題變更時會改用新的文字顏色。

詳見 [Polhem.Markdown 的變更紀錄](https://github.com/polhem-dev/polhem-markdown/blob/main/CHANGELOG.md)。

**處理方式**:自行引用 `Polhem.Markdown` 的應用程式要用 0.8.0,自行引用 `Polhem.Markdown.Avalonia` 或
`Polhem.Markdown.Blazor` 的要用 0.8.0 以上,否則 NuGet 會回報版本衝突。

### 表格儲存格不再換行

Blazor view 裡回覆的表格現在放在 `div.pmd-table-frame` 中,展開按鈕也在裡面;儲存格改為不換行,與 Avalonia view 一直以來
的做法相同。原本儲存格會在任意位置斷字,寬表格因此被擠進回覆的寬度裡。

**處理方式**:不必處理,除非應用程式的樣式表透過表格的外層元素設定樣式,或仰賴儲存格換行。這類規則請改指向
`.pmd-table-frame`。若要恢復原本的換行,在 `.pmd th, .pmd td` 設定 `white-space: normal`;這樣擠進去的表格不會溢出,
也就不會出現按鈕。
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!-- The single source of the package version. Only the projects under src/ are packed, and the packages are
always released together under this one version. -->
<Version>0.6.0</Version>
<Version>0.7.0</Version>

<!-- Package metadata -->
<Authors>Polhem contributors</Authors>
Expand Down
4 changes: 4 additions & 0 deletions src/Polhem.Chat/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ Polhem.Chat.ChatRunner.ResponseReceived -> System.EventHandler<Polhem.Chat.Respo
Polhem.Chat.ChatRunner.SendAsync(string! text, System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.DataContent!>! attachments, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Polhem.Chat.ChatTurnResult?>!
Polhem.Chat.ChatRunner.SendAsync(string! text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Polhem.Chat.ChatTurnResult?>!
Polhem.Chat.ChatRunner.Stop() -> void
Polhem.Chat.ChatRunner.SupersedesEarlierContext.get -> System.Func<Polhem.Chat.PromptContext!, bool>?
Polhem.Chat.ChatRunner.SupersedesEarlierContext.set -> void
Polhem.Chat.ChatStrings
Polhem.Chat.ChatStrings.Approve.get -> string!
Polhem.Chat.ChatStrings.Approve.set -> void
Expand Down Expand Up @@ -174,6 +176,8 @@ Polhem.Chat.ChatStrings.ElapsedFormat.get -> string!
Polhem.Chat.ChatStrings.ElapsedFormat.set -> void
Polhem.Chat.ChatStrings.EmptyTitle.get -> string!
Polhem.Chat.ChatStrings.EmptyTitle.set -> void
Polhem.Chat.ChatStrings.ExpandTable.get -> string!
Polhem.Chat.ChatStrings.ExpandTable.set -> void
Polhem.Chat.ChatStrings.JumpToLatest.get -> string!
Polhem.Chat.ChatStrings.JumpToLatest.set -> void
Polhem.Chat.ChatStrings.KilobytesFormat.get -> string!
Expand Down
4 changes: 0 additions & 4 deletions src/Polhem.Chat/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#nullable enable
Polhem.Chat.ChatRunner.SupersedesEarlierContext.get -> System.Func<Polhem.Chat.PromptContext!, bool>?
Polhem.Chat.ChatRunner.SupersedesEarlierContext.set -> void
Polhem.Chat.ChatStrings.ExpandTable.get -> string!
Polhem.Chat.ChatStrings.ExpandTable.set -> void
Loading