Skip to content

Commit

Permalink
* Update agent.go to limit the number of cells that get generated
Browse files Browse the repository at this point in the history
* Fix the cicd/job.yaml so that it can correctly release our containers.
  • Loading branch information
jlewi committed Oct 22, 2024
1 parent 1cb849b commit e0d65ed
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
27 changes: 16 additions & 11 deletions app/pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func (a *Agent) StreamGenerate(ctx context.Context, stream *connect.BidiStream[v
if !shouldTrigger(doc, selectedCell) {
continue
}

log.Info("Received request", logs.ZapProto("request", req))
// Serialize the doc and make it available for processing
func() {
Expand Down Expand Up @@ -604,18 +604,9 @@ func (a *Agent) LogEvents(ctx context.Context, req *connect.Request[v1alpha1.Log

// postProcessBlocks is a helper function to post process the blocks generated by the agent.
func postProcessBlocks(blocks []*v1alpha1.Block) ([]*v1alpha1.Block, error) {
// Only return a single code block and only the code block.
// We do this because
// 1. Due https://github.com/jlewi/foyle/issues/168 we can't render markdown as ghostcells
// so we only want to return the code block.
// 2. We don't want to return multiple code blocks because that can be confusing. We can potentially relax that
// in the future if everything is working
// Post process the blocks
results := make([]*v1alpha1.Block, 0, len(blocks))
for _, block := range blocks {
//if block.GetKind() != v1alpha1.BlockKind_CODE {
// continue
//}
// The model sometimes returns just the "</output>" tag but inside a code block.
// We want to ignore such blocks.
if isOutputTag(block.Contents) {
Expand All @@ -627,8 +618,22 @@ func postProcessBlocks(blocks []*v1alpha1.Block) ([]*v1alpha1.Block, error) {
continue
}

if len(results) > 0 && block.Kind == v1alpha1.BlockKind_MARKUP {
// If the previous block is a markup block we want to merge this one without.
// This is because the more blocks we show to the user the more confusing it is
// TODO(jeremy): log an assertion here?
continue
}

results = append(results, block)
// return results, nil

// Once we reach a code block drop any other code blocks. This is because showing multiple code blocks
// can be confusing.
// TODO(jeremy): Should we make this a configurable option so its easy to experiment?
if block.Kind == v1alpha1.BlockKind_CODE {
// TODO(jeremy): log a level 1 assertion here?
return results, nil
}
}
return results, nil
}
Expand Down
21 changes: 16 additions & 5 deletions cicd/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,22 @@ spec:
containers:
- image: us-west1-docker.pkg.dev/foyle-public/images/hydros/hydros
name: hydros
#image: amd64/busybox
# command:
# - tail
# - -f
# - /dev/null
command:
- /hydros
- --config=/config/config.yaml
- apply
- /tmp/hydros_work_dir/jlewi/foyle/releasing.yaml
- /hydros
- --config=/config/config.yaml
- apply
- /tmp/hydros_work_dir/github.com/jlewi/foyle/releasing.yaml
env:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: github-token-ghcr
key: GITHUB_TOKEN
resources:
limits:
cpu: "4"
Expand All @@ -62,6 +73,6 @@ spec:
volumes:
- name: config
configMap:
name: config-8gm57kk49d
name: config-8gm57kk49d
- name: data
emptyDir: {}
10 changes: 10 additions & 0 deletions developer_guides/runme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ Now we can install the extension using the vscode binary
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --force --install-extension ~/git_vscode-runme/runme-extension.vsix
```

```bash {"id":"01JAH5BVWFNHDGGECF7PRE2EE9","interactive":"false"}
# To check the installed version of the RunMe extension in Visual Studio Code after installation, use the following command:
BINARY="/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
$BINARY --list-extensions --show-versions | grep stateful.runme
```

```bash {"id":"01JAH14Y3CWES4H2DNBY621N0R","interactive":"false"}
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --force --install-extension ~/git_vscode-runme/runme-X.Y.Z.vsix
```

```sh {"id":"01HY264KZTS4J9NHJASJT1GYJ7"}
ls -la ~/git_vscode-runme/dist
```
Expand Down

0 comments on commit e0d65ed

Please sign in to comment.