Skip to content

Commit f8b63dc

Browse files
merge branch v2 (release 2.0.0-beta.44)
2 parents f652576 + 79e485e commit f8b63dc

15 files changed

Lines changed: 173 additions & 141 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
# Changelog
22

3-
## [v2.0.0-beta.43](https://github.com/marcantondahmen/automad/commit/5814fd5fd37c8260b4edbab1cda460f6ae3fa07b)
3+
## [v2.0.0-beta.44](https://github.com/marcantondahmen/automad/commit/5719c15ba70ffba792a21759de3e87be48151e96)
44

5-
Sun, 14 Jun 2026 20:35:51 +0200
5+
Sat, 20 Jun 2026 11:46:22 +0200
6+
7+
### New Features
8+
9+
- update standard lite theme ([9a863a771](https://github.com/marcantondahmen/automad/commit/9a863a77134c2959683d62804c238118a4ea3652))
10+
11+
### Bugfixes
12+
13+
- clear cache when changing ai provider settings in order to display changes correctly ([03f0fc3df](https://github.com/marcantondahmen/automad/commit/03f0fc3df1b69bd80e8606b117eec7063492dfa9))
14+
- fix height calculation of auto-sized textareas ([a4f8c7511](https://github.com/marcantondahmen/automad/commit/a4f8c7511f806632efbcbea4fe2c4701501fae16))
15+
- fix selecting a tag from dropdown when using the enter key ([319ba32d1](https://github.com/marcantondahmen/automad/commit/319ba32d1d6aeb3c88eff44cdabd5b70e3fddd72))
16+
- fix warning when unserializing ai provider configs ([b5fb2751b](https://github.com/marcantondahmen/automad/commit/b5fb2751b55b884bbfde9363ef5efd880b1466d5))
17+
- remove markdown code blocks from ai assistance output ([f7904fed1](https://github.com/marcantondahmen/automad/commit/f7904fed178e6062bbb8b53be7dac54c05aa4136))
18+
19+
## [v2.0.0-beta.43](https://github.com/marcantondahmen/automad/commit/f652576a419b0b2993815e480228f74a1da6f510)
20+
21+
Sun, 14 Jun 2026 20:39:14 +0200
622

723
### Bugfixes
824

automad/src/client/admin/components/Root.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import {
4545
initTooltips,
4646
requestAPI,
4747
Attr,
48-
initEnterKeyHandler,
4948
initWindowErrorHandler,
5049
fire,
5150
EventName,
@@ -117,7 +116,6 @@ export class RootComponent extends BaseComponent {
117116
App.root.update();
118117
});
119118

120-
initEnterKeyHandler();
121119
initInputChangeHandler();
122120
this.validateSession();
123121

automad/src/client/admin/core/events.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,6 @@ export const listenToClassChange = (
208208
return { remove };
209209
};
210210

211-
/**
212-
* Make any focused element clickable using the enter key.
213-
*
214-
* @return the listener
215-
*/
216-
export const initEnterKeyHandler = (): Listener => {
217-
return listen(document, 'keydown', (event: KeyboardEvent): void => {
218-
if (event.keyCode == 13) {
219-
(document.activeElement as HTMLButtonElement).click();
220-
}
221-
});
222-
};
223-
224211
/**
225212
* Add validate class to changed input field.
226213
*

automad/src/client/admin/styles/components/field.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434

3535
.am-c-field {
36+
position: relative;
3637
display: flex;
3738
flex-direction: column;
3839
gap: @am-flex-gap;

automad/src/client/admin/styles/form/input.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@
133133
resize: none;
134134
scrollbar-width: thin !important;
135135
overflow-y: hidden;
136+
text-wrap: wrap;
137+
word-break: break-word;
138+
overflow-wrap: break-word;
136139
}
137140

138141
&-combo {

automad/src/server/App.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* @license See LICENSE.md for license information
5757
*/
5858
class App {
59-
const VERSION = '2.0.0-beta.43';
59+
const VERSION = '2.0.0-beta.44';
6060

6161
/**
6262
* Required PHP version.

automad/src/server/Controllers/API/AiAssistanceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function text(): Response {
9292
$ConfigFile->set('AM_AI_PROVIDER_ID', $providerId);
9393
$ConfigFile->write();
9494

95-
$Response->setData(array('output' => $provider->requestTextApi($prompt, $target, $context, $Messenger)));
95+
$Response->setData(array('output' => $provider->generate($prompt, $target, $context, $Messenger)));
9696

9797
return $Response->setError($Messenger->getError());
9898
}

automad/src/server/Controllers/API/AiProviderController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
namespace Automad\Controllers\API;
3737

3838
use Automad\API\Response;
39+
use Automad\Core\Cache;
3940
use Automad\Core\Request;
4041
use Automad\Core\Text;
4142
use Automad\System\Ai\ProviderCollection;
@@ -106,6 +107,8 @@ public static function remove(): Response {
106107

107108
$provider->remove();
108109

110+
Cache::clear();
111+
109112
return $Response;
110113
}
111114

@@ -137,6 +140,8 @@ public static function setApiKey(): Response {
137140

138141
$provider->setApiKey($apiKey);
139142

143+
Cache::clear();
144+
140145
return $Response;
141146
}
142147

@@ -164,6 +169,8 @@ public static function setModel(): Response {
164169

165170
$provider->setModel($model);
166171

172+
Cache::clear();
173+
167174
return $Response;
168175
}
169176

automad/src/server/System/Ai/ProviderConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function load(string $providerId): ProviderConfig|null {
9999
}
100100

101101
try {
102-
return unserialize(strval(file_get_contents($path)));
102+
return unserialize(trim(strval(file_get_contents($path))));
103103
} catch (\Throwable $th) {
104104
return null;
105105
}

automad/src/server/System/Ai/Providers/AbstractProvider.php

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
use Automad\Core\Debug;
3939
use Automad\Core\Messenger;
40+
use Automad\Core\Str;
4041
use Automad\System\Ai\ProviderConfig;
4142
use Automad\System\Fetch;
4243

@@ -62,6 +63,24 @@ public function __construct() {
6263
$this->ProviderConfig = ProviderConfig::load($this->getId()) ?? new ProviderConfig($this->getId());
6364
}
6465

66+
/**
67+
* Generate text.
68+
*
69+
* @param string $prompt
70+
* @param string $target
71+
* @param string $context
72+
* @param Messenger $Messenger
73+
* @return string
74+
*/
75+
public function generate(string $prompt, string $target, string $context, Messenger $Messenger): string {
76+
$output = $this->requestTextApi($prompt, $target, $context, $Messenger);
77+
78+
$output = Str::stripStart($output, '```html');
79+
$output = Str::stripEnd($output, '```');
80+
81+
return trim($output);
82+
}
83+
6584
/**
6685
* The help text that is shown alongside the API key dialog on setup.
6786
*
@@ -123,17 +142,6 @@ public function remove(): void {
123142
$this->ProviderConfig->delete();
124143
}
125144

126-
/**
127-
* Make a request to the provider's text endpoint.
128-
*
129-
* @param string $prompt
130-
* @param string $target
131-
* @param string $context
132-
* @param Messenger $Messenger
133-
* @return string
134-
*/
135-
abstract public function requestTextApi(string $prompt, string $target, string $context, Messenger $Messenger): string;
136-
137145
/**
138146
* Set a provider api key.
139147
*
@@ -303,6 +311,7 @@ protected function getInstructions(): string {
303311
- explain changes
304312
- add introductions
305313
- add labels
314+
- add markdown
306315
- mention the task
307316
- wrap the result in quotes
308317
@@ -349,4 +358,15 @@ protected function requestProviderApi(string $endpoint, array|null $data = null,
349358

350359
return $response;
351360
}
361+
362+
/**
363+
* Make a request to the provider's text endpoint.
364+
*
365+
* @param string $prompt
366+
* @param string $target
367+
* @param string $context
368+
* @param Messenger $Messenger
369+
* @return string
370+
*/
371+
abstract protected function requestTextApi(string $prompt, string $target, string $context, Messenger $Messenger): string;
352372
}

0 commit comments

Comments
 (0)