Download src/studio-agent/tests/support/scripted-studio-model.ts from Bin29/ManimCat: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/studio-agent/tests/support/scripted-studio-model.ts
- Command line
-
hf download hf://spaces/Bin29/ManimCat/src/studio-agent/tests/support/scripted-studio-model.ts
-
curl -L -o scripted-studio-model.ts https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/studio-agent/tests/support/scripted-studio-model.ts
637 Bytes
| import type { StudioModelPort, StudioModelRequest, StudioModelResponse } from '../../model/studio-model-port' | |
| export class ScriptedStudioModel implements StudioModelPort { | |
| readonly requests: StudioModelRequest[] = [] | |
| private readonly responses: StudioModelResponse[] | |
| constructor(responses: StudioModelResponse[]) { | |
| this.responses = [...responses] | |
| } | |
| async complete(request: StudioModelRequest): Promise<StudioModelResponse> { | |
| this.requests.push(request) | |
| const response = this.responses.shift() | |
| if (!response) { | |
| throw new Error('ScriptedStudioModel ran out of responses') | |
| } | |
| return response | |
| } | |
| } | |