mirror of https://github.com/buster-so/buster.git
logic fix and ci improvement
This commit is contained in:
parent
584387b9c1
commit
5f779a6fe1
|
@ -30,7 +30,7 @@ jobs:
|
|||
uses: useblacksmith/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'pnpm'
|
||||
# Remove cache here since we're using stickydisk for pnpm store
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
|
@ -49,8 +49,21 @@ jobs:
|
|||
key: ${{ github.repository }}-turbo-cache
|
||||
path: ./.turbo
|
||||
|
||||
- name: Check if lockfile changed
|
||||
id: lockfile-check
|
||||
run: |
|
||||
if git diff HEAD~1 HEAD --name-only | grep -q "pnpm-lock.yaml"; then
|
||||
echo "changed=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Fetch dependencies (if lockfile changed)
|
||||
if: steps.lockfile-check.outputs.changed == 'true'
|
||||
run: pnpm fetch --frozen-lockfile
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Build all packages (excluding web)
|
||||
run: pnpm build --filter='!@buster-app/web'
|
||||
|
|
|
@ -174,6 +174,9 @@ export class FallbackModel implements LanguageModelV1 {
|
|||
const result = await currentModel.doStream(options);
|
||||
|
||||
let hasStreamedAny = false;
|
||||
let streamRetryAttempts = 0;
|
||||
const maxStreamRetries = self.settings.models.length - 1; // -1 because we already tried one
|
||||
|
||||
// Wrap the stream to handle errors and switch providers if needed
|
||||
const wrappedStream = new ReadableStream<LanguageModelV1StreamPart>({
|
||||
async start(controller) {
|
||||
|
@ -191,9 +194,13 @@ export class FallbackModel implements LanguageModelV1 {
|
|||
if (self.settings.onError) {
|
||||
await self.settings.onError(error as Error, self.modelId);
|
||||
}
|
||||
if (!hasStreamedAny || self.retryAfterOutput) {
|
||||
// If nothing was streamed yet, switch models and retry
|
||||
if (
|
||||
(!hasStreamedAny || self.retryAfterOutput) &&
|
||||
streamRetryAttempts < maxStreamRetries
|
||||
) {
|
||||
// If nothing was streamed yet and we haven't exhausted retries, switch models and retry
|
||||
self.switchToNextModel();
|
||||
streamRetryAttempts++;
|
||||
try {
|
||||
const nextResult = await self.doStream(options);
|
||||
const nextReader = nextResult.stream.getReader();
|
||||
|
|
Loading…
Reference in New Issue