- /v1/responses 双向翻译(含流式 response.* 事件、tools、usage 全字段) - /v1/chat/completions 字节级透传 - STOP_SCOPE=content 内容侧 stop(保思维链 + matched_stop 回填) - b300 docker 构建 + 孔明 kaniko 构建 + 两版 cw manifest
72 lines
2.4 KiB
YAML
72 lines
2.4 KiB
YAML
# responses-shim — DeepSeek Responses API (/v1/responses) → chat completions 协议转换
|
||
# 架构: 客户端 → new-api(:31000, /v1/responses 原路径透传) → 本服务(渠道上游) → ds41-3p1d:50002
|
||
# 部署: wsl kmctl create cw ds41-resp-shim -f /mnt/d/B300/build-kmctl/responses-shim-cw.yaml --node-group B300
|
||
# 镜像: ymkymx/responses-shim:v0.1.0(scratch+静态 Go 二进制,5.6MB,
|
||
# 已 docker save | ctr -n k8s.io images import 侧载到 b300-01;Kyverno 对未映射镜像保持原名)
|
||
# 网络: 普通 Pod 网络 + ClusterIP Service(同 jaeger 之外的常规姿势);new-api 渠道 base URL 填
|
||
# http://ds41-resp-shim:8080 (同 namespace 短名可达,与 ds41-3p1d 同理)
|
||
# 透传: /v1/chat/completions 字节级透传(渠道测试/健康检查/误路由的 chat 请求都正常)
|
||
# 源码: D:\B300\responses-shim\main.go(另存 b300 /data/ymk/build/responses-shim/)
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: responses-shim
|
||
labels:
|
||
app: responses-shim
|
||
spec:
|
||
replicas: 1
|
||
strategy:
|
||
type: Recreate # 无状态但无需滚动,重建越快越好
|
||
selector:
|
||
matchLabels:
|
||
app: responses-shim
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: responses-shim
|
||
spec:
|
||
nodeSelector:
|
||
kubernetes.io/hostname: b300-01
|
||
containers:
|
||
- name: shim
|
||
image: ymkymx/responses-shim:v0.2.3
|
||
imagePullPolicy: IfNotPresent
|
||
env:
|
||
- name: UPSTREAM_BASE
|
||
value: "http://ds41-3p1d:50002"
|
||
- name: LISTEN
|
||
value: ":8080"
|
||
- name: STOP_SCOPE
|
||
value: "content" # stop 只在 content 上截断,思维链不被误杀(Claude stop_sequences 语义)
|
||
ports:
|
||
- {containerPort: 8080}
|
||
resources:
|
||
requests:
|
||
cpu: 200m
|
||
memory: 128Mi
|
||
limits:
|
||
cpu: "1"
|
||
memory: 512Mi
|
||
readinessProbe:
|
||
httpGet: {path: /healthz, port: 8080}
|
||
initialDelaySeconds: 2
|
||
periodSeconds: 10
|
||
livenessProbe:
|
||
httpGet: {path: /healthz, port: 8080}
|
||
initialDelaySeconds: 5
|
||
periodSeconds: 20
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: ds41-resp-shim
|
||
labels:
|
||
app: responses-shim
|
||
spec:
|
||
selector:
|
||
app: responses-shim
|
||
ports:
|
||
- name: http
|
||
port: 8080
|
||
targetPort: 8080
|