Let $(X,O_X)$ be an integral scheme of finite type over a field $k$ such that $dim(X)=1$, and let $\eta$ be the generic point of $X$. Then $X=|X|\sqcup\{\eta\}$, where $|X|$ is the set of closed points of $X$. For $x\in|X|$, let $i_x:\{x\}\to X$ be the inclusion, and note that we can consider $O_{X,x}$ as a subring of $K(X)$, the function field of $X$, i.e. $O_{X,\eta}$. Denote by $K$ the constant sheaf on $X$ with value $K(X)$. I am trying to show that there is an isomorphism $K/O_X\to\bigoplus_{x\in|X|}i_{x,\ast}(K(X)/O_{X,x})$. I have started by defining a map from $K$ to the direct sum sheaf (it's a sheaf because $X$ is Noetherian), by sending, for an open $U$ of $X$, $[V,f]\in K(U)=K(X)$ to $([V,f]+O_{X,x})_{x\in U\cap|X|}\in\bigoplus_{x\in U\cap|X|}K(X)/O_{X,x}$. Then one can argue that the kernel of this map is precisely $O_X(U)$, so if its surjective this defines an iso of (pre)sheaves (which then turns into an iso of sheaves after sheafifying). However, I am running into a few things here:
Is this map even well-defined? I.e., why does it map to the direct sum, i.e. why are only finitely many elements not in $O_{X,x}$?
Why is it surjective? I have started with a bunch of elements $([V_x,f_x]+O_{X,x})_{x\in U\cap|X|}$ and then tried to define an open $W=\cap V_x$ (there are finitely many not in $O_{X,x}$, so this is open) and $f=\sum f^x|_W$ (again, finitely many so well-defined.), but then I have no idea how to construct a section over $U$ out of this.
Finally, it seems to me that $O_X(U)$ does not inject into $K(X)$: if $f$ and $g$ are sections over $U$ that are different but that coincide on some open, then their images will coincide in the direct sum sheaf. So how does this "inclusion" work and how can we make sense of this quotient?
Edit: $O_X(U)$ injects into $K(X)$ precisely because $X$ is integral, and affinely this map corresponds to $A\to Frac(A)$.
Any clarification is welcome.