@assistant-ui/react 0.5.37 → 0.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1078,7 +1078,7 @@ var LocalThreadRuntime = class {
1078
1078
  this.configProvider = configProvider;
1079
1079
  this.adapter = adapter;
1080
1080
  this.options = options;
1081
- if (options?.initialMessages) {
1081
+ if (options.initialMessages) {
1082
1082
  let parentId = null;
1083
1083
  const messages = fromCoreMessages(options.initialMessages);
1084
1084
  for (const message of messages) {
@@ -1175,7 +1175,7 @@ var LocalThreadRuntime = class {
1175
1175
  this.repository.addOrUpdateMessage(parentId, message);
1176
1176
  this.notifySubscribers();
1177
1177
  };
1178
- const maxToolRoundtrips = this.options?.maxToolRoundtrips ?? 1;
1178
+ const maxToolRoundtrips = this.options.maxToolRoundtrips ?? 1;
1179
1179
  const toolRoundtrips = message.metadata?.roundtrips?.length ?? 0;
1180
1180
  if (toolRoundtrips > maxToolRoundtrips) {
1181
1181
  updateMessage({
@@ -1286,6 +1286,9 @@ var LocalRuntime = class extends BaseAssistantRuntime {
1286
1286
  set adapter(adapter) {
1287
1287
  this.thread.adapter = adapter;
1288
1288
  }
1289
+ set options(options) {
1290
+ this.thread.options = options;
1291
+ }
1289
1292
  registerModelConfigProvider(provider) {
1290
1293
  return this._proxyConfigProvider.registerModelConfigProvider(provider);
1291
1294
  }
@@ -1293,9 +1296,11 @@ var LocalRuntime = class extends BaseAssistantRuntime {
1293
1296
  if (threadId) {
1294
1297
  throw new Error("LocalRuntime does not yet support switching threads");
1295
1298
  }
1299
+ const { initialMessages, ...options } = this.thread.options;
1296
1300
  return this.thread = new LocalThreadRuntime(
1297
1301
  this._proxyConfigProvider,
1298
- this.thread.adapter
1302
+ this.thread.adapter,
1303
+ options
1299
1304
  );
1300
1305
  }
1301
1306
  reset({
@@ -1314,10 +1319,11 @@ var LocalRuntime = class extends BaseAssistantRuntime {
1314
1319
  };
1315
1320
 
1316
1321
  // src/runtimes/local/useLocalRuntime.tsx
1317
- var useLocalRuntime = (adapter, options) => {
1322
+ var useLocalRuntime = (adapter, options = {}) => {
1318
1323
  const [runtime] = useState4(() => new LocalRuntime(adapter, options));
1319
1324
  useInsertionEffect(() => {
1320
1325
  runtime.adapter = adapter;
1326
+ runtime.options = options;
1321
1327
  });
1322
1328
  return runtime;
1323
1329
  };