Skip to content

Commit

Permalink
Refactor ConsolidateAIConfig to only take in specificed sub-actions (#…
Browse files Browse the repository at this point in the history
…917)

Refactor ConsolidateAIConfig to only take in specificed sub-actions

I was having some trouble converting everything to
`STREAM_AICONFIG_CHUNK` so I'm just doing really easy steps to keep
diffs easy to review and test. You'll see final code changes at end of
diff stack.

## This diff
No functional changes, but I want to use the `CONSOLIDATE_AICONFIG`
event to pass in nested action `STREAM_AICONFIG_CHUNK` action later in
stack, without requiring me to pass it in directly to the
`aiconfigReducer`. By separating these, they can be distinct types and
easier to manage

---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/lastmile-ai/aiconfig/pull/917).
* #928
* #926
* #925
* #924
* #922
* #921
* #920
* #919
* #918
* __->__ #917
  • Loading branch information
rossdanlm committed Jan 15, 2024
2 parents 9a61384 + 00ef845 commit a86e1d9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ export type MutateAIConfigAction =
| UpdatePromptParametersAction
| UpdateGlobalParametersAction;

// Actions that appear when called via ConsolidateAIConfigAction
export type ConsolidateAIConfigSubAction =
| AddPromptAction
| RunPromptAction
| UpdatePromptInputAction;

export type ConsolidateAIConfigAction = {
type: "CONSOLIDATE_AICONFIG";
action: MutateAIConfigAction;
action: ConsolidateAIConfigSubAction;
config: AIConfig;
};

Expand Down Expand Up @@ -159,7 +165,7 @@ function reduceInsertPromptAtIndex(

function reduceConsolidateAIConfig(
state: ClientAIConfig,
action: MutateAIConfigAction,
action: ConsolidateAIConfigSubAction,
responseConfig: AIConfig
): ClientAIConfig {
// Make sure prompt structure is properly updated. Client input and metadata takes precedence
Expand Down

0 comments on commit a86e1d9

Please sign in to comment.